Resend (x2) Patch - Joystick ReSync on SYN_DROPPED |
mungewell
|
Apologies if I'm starting to sound like a broken record, but I got no
commentary on the patch offered below. In my system SDL2 is dropping a chunk of joystick events, which result in a 'stuck brake/accelerator' whilst playing a racing simulator. This basically means SDL2 is unsuitable for use at this point... The patch below detects this situation and forces a re-read of all attached joystick axis - thus resync to the correct/current pedal positions. Please apply... pretty please :-) Simon. ---------------------------- Original Message ---------------------------- Subject: Re: Evdev based joystick - issues From: Date: Thu, January 17, 2013 11:10 pm To: Cc: -------------------------------------------------------------------------- If figured out a solution to this problem, patch attached. When a 'SYN_DROPPED' event is detected, each of the active axis for the joystick are polled and the result returned to the application. This counteracts the stuck axis and my driving game now works as expected. I also included a 'fresh' flag so a newly opened joystick is polled for values, which would normally only be sent when moved. This helps get controls in a 'normal' position at start of game (rather than being stuck at 1/2 value). The 'SYN_DROPPED' situation can be forced by '^Z'ing the testjoystick application and moving the joystick so the buffer overflows. 'fg' will restart the application and the axis will 'magically' return to the correct position. Cheers, Simon.
_______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||
|
Resend (x2) Patch - Joystick ReSync on SYN_DROPPED |
Sam Lantinga
|
Applied!http://hg.libsdl.org/SDL/rev/e09997fb33cc
FYI, bugzilla.libsdl.org is a better place to make sure patches don't get lost. Cheers! On Tue, Feb 5, 2013 at 4:10 PM, wrote:
|
|||||||||||||||||
|
Resend (x2) Patch - Joystick ReSync on SYN_DROPPED |
Mark de Wever
Guest
|
On Mon, Feb 11, 2013 at 04:47:01PM -0800, Sam Lantinga wrote:
The patch breaks compilation for me, the attached patch fixes it. Please CC me since I'm not subscribed. -- Regards, Mark de Wever _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Resend (x2) Patch - Joystick ReSync on SYN_DROPPED |
Sam Lantinga
|
This block at the top didn't take care of it for you?
/* This isn't defined in older Linux kernel headers */ #ifndef SYN_DROPPED #define SYN_DROPPED 3 #endif On Sun, Feb 17, 2013 at 5:27 AM, Mark de Wever wrote:
|
|||||||||||||||
|
jeffgriffin
|
Thanks for this patch! It really helped me with some issues I was having with gamepads in XBMC.
I did have to make a couple tweaks, though: 1. I placed the PollAllValues for a "fresh" device inside the read loop. This was because it would fire an axis value of zero for any gamepad which was disconnected. This would not be a problem but for the fact that zero is not the resting point for some axes, therefore disconnected controllers constantly appear to be in a modified state. This way, fresh devices will be polled once they have sent the first real event. 2. Added button states to PollAllValues. This fixes an issue in XBMC where dropped button up events cause the button to "stick". A key_map value 0 can only mean "unmapped" in this patch, as opposed to both "unmapped" and "key 0". You can see these changes here. Patch is applied to SDL-1.2.15, to keep me from needing to move my XBMC build onto the dev cut of SDL. |
|||||||||||
|