Commit Graph

12690 Commits (3772d6cc9926f294f04d6a25be9a2c0f7a43b66a)

Author SHA1 Message Date
Simon McVittie 3772d6cc99 testevdev: Add raw HID report descriptors where available
We don't currently use these in our device-classification heuristic,
but it could be a useful input in future.

Thanks to Sam Lantinga, Ben Fradella, kevenwyld and schlegp for
providing some of these.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 07:27:48 -07:00
Simon McVittie 2b7556fea2 testevdev: Correct typo in bus type for Xbox Series S|X via Bluetooth
All Bluetooth devices are bus type 0x0005.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 07:27:48 -07:00
Simon McVittie c13e511844 testevdev: Try to correct Wii devices guessed from kernel source
The comments here disagreed with the actual bytes. According to
https://elixir.bootlin.com/linux/v6.3.7/source/drivers/hid/hid-wiimote-modules.c,
the Balance Board reports BTN_A and ABS_HAT0X, HAT0Y, HAT1X and HAT1Y.
This means the comments here were correct, but the .abs bits shown
were in the wrong byte.

Matching the Wii U Pro Controller against the same kernel source, it
appears to be correct: it's the same representation as a PS3 gamepad,
except that it lacks the Z and RZ axes for analogue triggers.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 06:38:12 -07:00
Simon McVittie ffdafcd880 testevdev: Verify most Wii devices against real hardware
Some of the test data previously seen here was guessed from kernel
source code, and not all of it was correct. The following devices have
now been verified against `evemu-describe` output with Linux 6.3
(thanks to Jeremy Whiting for collecting this):

- basic Wiimote
    - buttons
    - 3-axis accelerometer
    - infra-red sensor for Sensor Bar location (precise aim)
- Motion Plus accessory (3-axis gyroscope)
- Nunchuck accessory (joystick, 2 buttons, second 3-axis accelerometer)
- Classic Controller accessory (a complete traditional gamepad)

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 06:38:12 -07:00
SDL Wiki Bot 739f78302b Sync SDL3 wiki -> header 2023-06-16 12:22:18 +00:00
Anonymous Maarten 26df689935 docs: expand CMake documentation + add minimal CMake project for reporting issues 2023-06-16 14:21:38 +02:00
Sylvain 378e33bb2c Android: potential ANR during onKeyDown/Up
SDLActivity may call onNativeKeyDown, while application is quitting
2023-06-16 10:17:01 +02:00
Sam Lantinga e72935a445 Check for modff in addition to modf 2023-06-15 16:43:35 -07:00
Sam Lantinga dab4f296b8 Cleanup spacing 2023-06-15 16:43:22 -07:00
Simon McVittie 16b57d2ff1 testevdev: Add details of another driving simulator controller
Thanks to Ben Fradella.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-15 12:21:36 -07:00
Simon McVittie 2b00751206 testevdev: Expand test data for X-Box One Elite 2
This slightly newer device than the one from #7814 is functionally
equivalent when connected via USB. When connected via Bluetooth, it has
a different button mapping.

Thanks to Sam Lantinga.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-15 08:16:28 -07:00
Mathieu Eyraud 62ed6f453f Use SDL_strdup instead of strdup 2023-06-15 06:31:19 -07:00
Sam Lantinga 73927b0948 Removed unused function 2023-06-14 15:16:21 -07:00
Sam Lantinga 2e465ae31b Revert "Added SDL_nextafter() and SDL_nextafterf()"
This reverts commit bc5d074818.

It's not clear that we need these yet, so I'm going to remove them for now.
2023-06-14 11:05:10 -07:00
Sam Lantinga 0c16f4faf0 Fixed third-party Nintendo Switch Pro controllers shutting down when we try to set the home LED.
This fixes the PDP Afterglow Wireless Deluxe Controller.
2023-06-14 10:15:06 -07:00
Sam Lantinga 23e007d3b7 Fixed third party Nintendo Switch Pro Controller resetting when being sent an unsupported command to set the Home LED
Tested with the PowerA Fusion Pro Wireless Controller in Bluetooth mode
2023-06-14 00:02:32 -07:00
Sam Lantinga 8c95bd814b Allow switching licensed Nintendo Switch Pro controllers into gyro input mode 2023-06-13 22:40:51 -07:00
Sam Lantinga cdfc0c5a33 Added support for the PowerA Fusion Pro Wireless Controller in Bluetooth mode
This controller shows up with a VID/PID of 0, but has full functionality over Bluetooth
2023-06-13 22:20:58 -07:00
Sam Lantinga 0f4b15e16b Removed more Linux Xbox mappings in favor of the automatic mapping
This fixes the Xbox Series X share button on Linux 5.x kernels.
2023-06-13 16:53:10 -07:00
Sam Lantinga 883b0f4071 Cleanup for previous change, fixing typos, etc. 2023-06-13 16:49:33 -07:00
Sam Lantinga 9567989eb3 Use the automatic mapping instead of a hardcoded one for Xbox controllers on Linux
This is much more robust and able to dynamically create a mapping for Xbox One S, Xbox Series X, and Xbox Elite 2 controllers.
2023-06-13 16:41:52 -07:00
Sam Lantinga db1d4d3d76 Added automatic mapping support for Xbox controllers on the 6.x Linux kernels
This automatically adds support for the share button and paddles when present.
2023-06-13 16:40:30 -07:00
Sylvain 0f24956b0a testautomation_hints.c: free hint memory 2023-06-13 23:12:01 +02:00
Sylvain 2c3717881f testautomation_events.c: initialize "timestamp" to solve "conditional jump or move depends on uninitialised value" 2023-06-13 23:03:32 +02:00
Simon McVittie 56ba7f2ff0 testevdev: Add details of X-Box One Elite 2 via USB
Thanks to iacore for capturing these.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-13 10:33:13 -07:00
Simon McVittie 74484511eb testevdev: Provide a pointer to more information about adding test-cases
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-13 10:33:13 -07:00
Sam Lantinga bc5d074818 Added SDL_nextafter() and SDL_nextafterf() 2023-06-13 10:32:21 -07:00
Sam Lantinga b0677f476f Added automatic mapping for Xbox Elite paddles using the xpadneo driver
We can't actually tell yet whether a controller has paddles, so this code isn't effective, but I'll file an upstream issue and see if we can get that resolved.
2023-06-13 10:06:36 -07:00
Sam Lantinga 071d1e29dd Fixed joystick vendor detection in Linux automatic gamepad mapping 2023-06-13 10:05:19 -07:00
Sam Lantinga 5a62a4596e Fixed building with the 16.1.4479499 Android toolchain
(cherry picked from commit b9d1c483b90e2a1c23053692e06d15f9dbd5fe99)
2023-06-13 07:50:00 -07:00
Simon McVittie cf1dc66e2c linux: Improve gamepad mapping heuristic to accept Android conventions
This heuristic for gamepads without a more specific mapping already
tried two incompatible conventions for handling triggers: the Linux
Gamepad Specification uses hat switch 2 for the triggers (for whatever
reason), but the de facto standard set by the drivers for older Xbox
and Playstation controllers represents each trigger as the Z-axis of
the nearest analog stick.

Android documentation encourages Bluetooth gamepad manufacturers to use
a third incompatible convention where the left and right triggers are
represented as the brake and gas pedals of a driving simulator
controller. The Android convention also changes the representation of
the right stick: instead of using X and Y rotation as a second pair
of axes, Android uses Z position as a second horizontal axis, and
Z rotation as a second vertical axis.

Try to cope gracefully with all of these. This will hopefully resolve
the issue described in #5406 (when using unpatched kernels).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-13 05:38:26 -07:00
Simon McVittie c4d49fadd4 linux: Reduce magic numbers when mapping gamepad axes
The bitfield `mapped` has two different sets of meanings, depending
whether we're setting up the triggers or the d-pad. Represent them
as symbolic constants rather than opaque integers.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-13 05:38:26 -07:00
Sam Lantinga dec0dbff13 Fixed enumerating Steam Controllers on iOS 2023-06-12 16:57:41 -07:00
Sam Lantinga d95dbe78bb Fixed n3ds build 2023-06-12 15:39:57 -07:00
Sam Lantinga cdc40ee054 Reduce the chance of destroying the joystick mutex while it's in use
Fixes https://github.com/libsdl-org/SDL/issues/7811
2023-06-12 15:27:45 -07:00
Linus Probert 6ab846b688 clipboard: Fixes additional x11 clipboard bugs found in tests 2023-06-12 10:57:06 -07:00
Linus Probert a2ba5e9052 clipboard: Fixes testautomation fails introduced by clipboard changes 2023-06-12 07:33:39 -07:00
Sylvain 4e0f94ea7d Android: add timeout when waiting the SDL thread to finish
C SDLmain() thread might have started (mSDLThread.start() called)
while the SDL_Init() might not have been called yet,
and so the previous QUIT event will be discarded by SDL_Init() and app is running, not exiting.

This is reprocible by adding instrumentation code in the SDLActivity.

And hopefully, this could fix an ANR, where SDLActivity is in WAITING state (in thread.join()):
  at java.lang.Thread.join (Thread.java:1519)
  at org.libsdl.app.SDLActivity.onDestroy (SDLActivity.java)

while SDLThread seems to be running
2023-06-12 11:53:09 +02:00
Ryan C. Gordon 125e7420ec cocoa: Warp mouse to center of window before enabling relative mouse.
This prevents the case where the mouse might be at the edge of the
window when enabling relative mode, which confuses macOS, at it
might believe the user is attempting to resize the window.

Fixes #6994.

(cherry picked from commit 2afb49ba9a2edc361a3b35d8e30be977a5bcc0c4)
2023-06-11 12:54:51 -04:00
Ozkan Sezer 4cfacd5cb7 SDL_dynapi.c: minor cosmetics. 2023-06-10 20:50:02 +03:00
Sam Lantinga 0103ec1126 Fixed accidental commit 2023-06-10 08:44:08 -07:00
SDL Wiki Bot 7f86415146 Sync SDL3 wiki -> header 2023-06-10 15:42:15 +00:00
Sam Lantinga 281018f169 Make it clear that you can't mix 2D rendering and the window surface API
Also added functions to query and destroy the window surface so you can switch between modes if you want.

See https://github.com/pygame-community/pygame-ce/issues/2190 for more details.
2023-06-10 08:39:20 -07:00
Sam Lantinga 5490873daa Fixed querying device info on the MOBAPAD M073
The query packet needs to contain valid rumble data in order to be accepted by the controller.

Fixes https://github.com/libsdl-org/SDL/issues/7788
2023-06-09 18:41:21 -07:00
Sam Lantinga 2042e9c4e3 Only update the serial number if it hasn't already been set
This fixes the serial number for Nintendo Switch Pro, which is queried from the hardware in device initialization, and was later clobbered by the USB string which isn't correct.
2023-06-09 17:34:12 -07:00
Sam Lantinga c8051b11e8 Fixed reading input from the Razer Atrox Arcade Stick using Windows Gaming Input 2023-06-09 14:35:43 -07:00
Sylvain aaccf3cd52 X11: common function to wait for the WM before sending SDL Window events 2023-06-09 19:48:59 +02:00
Sylvain 8096f7269b Android: add robustness. check that the native code is run for the first time. 2023-06-09 10:13:58 +02:00
Sylvain ae9d8acc3b Android: when an EventFilter is binded to SDL_EVENT_DID_ENTER_FOREGROUND event and triggered, GL context is expected to be already restored. 2023-06-09 10:00:01 +02:00
Sam Lantinga 4c0758a234 Fixed crash if display couldn't be found in SDL_UpdateFullscreenMode() 2023-06-08 12:39:32 -07:00