Am Dienstag, den 13.12.2011, 17:55 +0100 schrieb Nicolas Pomarède:
Le 13/12/2011 17:47, Matthias Arndt a écrit :
Hello,
you do :
+ if(strncmp(thismapping->SDLJoystickName,
SDL_JoystickName(i),strlen(thismapping->SDLJoystickName)) == 0)
this means that if SDL reports "USB Gamepad xyz" or "USB Gamepad 123" it
will match with your table "USB Gamepad".
Is this the expected behaviour (substring matching) ? Or would it be
better to use strcmp to get exact matching ? (I don't know, I don't
have any joystick)
For the time being yes, it is. The problem is that the SDL reported
names seem to be padded at times. Basically having a proper USB ID
mapping would be what is needed but SDL (ofcourse) is abstracted from
the hardware. I also don't want to add too much dynamic memory
management as of yet, just to fit the length of the strings.
I can try to make that name a lot more more explicit.
As stated, this is a temporary solution with the intend to have this
data read and stored into the configuration file.