1
0
Fork 0
Commit graph

18 commits

Author SHA1 Message Date
Richard Harrison
88ee1ca7f7 refs Ticket #2766
Increased maximum number of Joystick axes to 32.

NOTE: this will only result in more axes when the underlying hardware supports it; so no change in Windows; Linux probably will work (as it uses an ioctl to get the number from the driver), but this is untested.

Note sure what will happen on OSX.

ref: https://sourceforge.net/p/flightgear/codetickets/
2023-05-21 22:18:19 +01:00
Automatic Release Builder
39f3a83a7e macOS joystick: reduce warnings on some devices
Don’t SG_WARN when we see an unhandled HID page or element, it’s not
necessary.
2021-02-04 10:31:17 +00:00
James Turner
fe17cfc84d Fix a crash on macOS if a joystick fails to open 2020-12-17 13:53:00 +00:00
James Turner
2084e11d60 Trying to fix read of uninitialised memory on Linux
This should ‘already work’, but seeing if this makes any difference.
2020-08-12 15:30:33 +01:00
James Turner
dce282d7b8 Rename js.h -> FlightGear_js.h
Ensure we don’t get weird conflicts as our internal version is
starting to diverge from the original PLIB one.
2020-06-11 17:48:49 +01:00
James Turner
00cffc2f01 Allow correct re-init of joysticks on macOS
With this change, “Reload Input” will discover newly attached devices
on macOS, which previously did not work.

Also add correct detection of disconnected devices, which previously
was not handled well, especially with the new ‘keep trying to open
devices’ behaviour of FGJoystickInput.

Should fix:
https://sourceforge.net/p/flightgear/codetickets/2259/
2020-06-11 17:43:55 +01:00
James Turner
61ed9efac8 FreeBSD: Merge from fixes from martymac
These were applied to upstream PLIB, ensure they’re applied to our
fork
2020-05-09 14:22:13 +01:00
Julian Smith
f3d1135320 Various fixes for building on OpenBSD. 2019-09-04 10:55:43 +01:00
Florent Rougon
df352346ad jsWindows: fail gracefully when joyGetDevCaps() returns undocumented values
According to Pfeffer's report[1] and many other messages on the
Internet, joyGetDevCaps() can return the (so far) undocumented value
165, which some say is JOYERR_PARMS. Since this is a valid return code
for joyGetPosEx() (not joyGetDevCaps()!), handle a few return codes from
that function too, and don't throw an exception when joyGetDevCaps()'s
return value is not one of the documented ones (we simply can't trust
its documentation).

[1] https://sourceforge.net/p/flightgear/mailman/message/36657149/
2019-05-04 08:58:15 +02:00
Florent Rougon
a5792617f7 jsWindows: throw exception instead of using an assert
Since asserts can be compiled as no-ops, throw an exception rather than
doing assert(false), in case the code passed to
joyGetDevCaps_errorString() is not one of the expected values.
2019-04-30 08:14:35 +02:00
Florent Rougon
babf0ded0c jsWindows: add debug output
Every code path that causes a joystick to report notWorking() should now
have an associated error message logged with class 'input' at level
'debug' or higher.
2019-04-29 16:38:11 +02:00
Florent Rougon
8e0271d9f6 jsWindows: remove undefined behavior when joyGetNumDevs() > INT_MAX
If joyGetNumDevs() > INT_MAX, casting it to an 'int' leads to undefined
behavior. On the other hand, after the 'ident >= 0' test succeeded, it
is perfectly safe to use static_cast<unsigned int>(ident), since 'ident'
is of type 'int'. Then we get to compare two unsigned ints, which is
well defined.
2019-04-29 13:42:32 +02:00
Ganael Laplanche
bc01619fe1 jsSetError() takes only two arguments (unlike ulSetError()) 2018-06-12 12:10:00 +02:00
Ganael Laplanche
327d8021d0 Add missing defines and includes from removed ul.h 2018-06-12 12:09:41 +02:00
James Turner
87e461bb7e Hopefully fix FreeBSD joystick support 2018-05-21 17:17:42 +02:00
James Turner
4a38fa7f19 Windows build fix 2018-05-04 08:31:11 +01:00
Florent Rougon
0aa692a4df PLIB joystick: don't nuke kernel-level deadband settings on Linux
So far, the Linux PLIB implementation used to nuke any deadband set at
kernel level with jscal(1) as soon as the joystick was opened. This
broke joystick calibration for FG and unrelated programs, for people who
cared to tune their kernel-level deadband setting.

This fixes PLIB bug #47[1]. Note that the fix has already been in Debian
buster's plib for some time (plib 1.8.5-8 uploaded on 24 Jul 2017[2]).

[1] https://sourceforge.net/p/plib/bugs/47/

[2] https://tracker.debian.org/news/858564/accepted-plib-185-8-source-into-unstable/
2018-05-03 21:51:36 +02:00
James Turner
102fe04e91 Import PLIB JS code into FlightGear
- will permit bug-fixing which cannot occur for
  official PLIB.
2018-05-03 00:02:09 +01:00