Author: James Zipperer <james.zipperer@synapse.com>
Date: Sun Aug 21 01:19:19 2016 -0700
bugfix for controller / joystick add / remove being in the event queue at the same time
This apparently has fallout: the PS4 (and maybe PS3?) controllers apparently
report some bogus axes, but it won't change the axes we currently expect, and
thus the game controller config string is still stable.
Fixes Bugzilla #2719.
--HG--
extra : rebase_source : 8c5a4d949e4706366bbf2d98d2d2df1762d040a9
It was simpler to just have the polling (actually: hotplug detection)
functions return immediately if it's not an appropriate time to poll.
Note that previously, if any joystick/controller was opened, we would poll
every time anyhow, skipping this function.
Andreas Ertelt
The problem in question is caused by changeset 7771 (http://hg.libsdl.org/SDL/rev/4434498bf4b9 / https://bugzilla.libsdl.org/show_bug.cgi?id=2121)
The redefinition of __inline__ (introduced by the addition of begin_code.h:128's "|| __STRICT_ANSI__") results in mingw's gcc throwing multiple
warning: always_inline function might not be inlinable [-Wattributes]
as well as a whole bunch of redefinitions of mingw internals which break linking of projects including the SDL2 headers.
T. Joseph Carter
As discussed (possibly to death), the Linux joystick driver does not actually report events for added or removed joysticks when you haven't got udev support.
We simply cannot know about removed joysticks without udev. But we can (and we should) report adding them. This brings the legacy case in line with pretty much the rest of SDL's joystick drivers.
This lets us change things like this...
if (Failed) {
SDL_SetError("We failed");
return -1;
}
...into this...
if (Failed) {
return SDL_SetError("We failed");
}
Fixes Bugzilla #1778.
Simon <simon@mungewell.org>
I am working on joystick support for the SRW-S1 gaming wheel on Linux,
this device has 3 dials with only a few positions each.
At present SDL2 only fail to report the highest position value, due to the
interger math used for coef[]'s.
So with a 4 position switch I have input values (with evtest)
--
Event: time 1358967246.173186, type 3 (EV_ABS), code 9 (ABS_GAS), value 2
Event: time 1358967246.173186, -------------- SYN_REPORT ------------
Event: time 1358967246.369150, type 3 (EV_ABS), code 9 (ABS_GAS), value 1
Event: time 1358967246.369150, -------------- SYN_REPORT ------------
Event: time 1358967246.930277, type 3 (EV_ABS), code 9 (ABS_GAS), value 0
Event: time 1358967246.930277, -------------- SYN_REPORT ------------
Event: time 1358967249.369832, type 3 (EV_ABS), code 9 (ABS_GAS), value 1
Event: time 1358967249.369832, -------------- SYN_REPORT ------------
Event: time 1358967249.514382, type 3 (EV_ABS), code 9 (ABS_GAS), value 2
Event: time 1358967249.514382, -------------- SYN_REPORT ------------
Event: time 1358967249.626189, type 3 (EV_ABS), code 9 (ABS_GAS), value 3
Event: time 1358967249.626189, -------------- SYN_REPORT ------------
--
Testjoystick reports
--
Joystick has 6 axes, 1 hats, 0 balls, and 17 buttons
Joystick 0 axis 5 value: 32767
Joystick 0 axis 5 value: 0
Joystick 0 axis 5 value: -32768
Joystick 0 axis 5 value: 0
Joystick 0 axis 5 value: 32767
Joystick 0 axis 5 value: 0
Joystick 0 axis 5 value: -32768
--
The attached patch 'shifts' the coef[], so that 1/2 values can be
computed/seen and allows testjoystick to report correctly.
--
Joystick has 6 axes, 1 hats, 0 balls, and 17 buttons
Joystick 0 axis 5 value: -10923
Joystick 0 axis 5 value: 10922
Joystick 0 axis 5 value: 32767
Joystick 0 axis 5 value: 10922
Joystick 0 axis 5 value: -10923
Joystick 0 axis 5 value: -32768
Joystick 0 axis 5 value: -10923
Joystick 0 axis 5 value: 10922
Joystick 0 axis 5 value: 32767
--
Cheers,
Simon
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.
This uses libudev for hotplug, but it's optional, so we'll just try to find
some reasonable defaults without it (maybe an older Linux box or under
FreeBSD's Linux emulation?).
It's been forcibly disabled since 2009, since the kernel apparently splits
these devices for us now, and apparently the code was crashing at the time
(see hg changeset 11c079bb52a8).
Also, it was a ton of messy #ifdefs in this file!