src/hidapi


Log

Author Commit Date CI Message
Sam Lantinga c8a64ad9 2021-01-07T10:23:55 Fixed building when SDL_LIBUSB_DYNAMIC is defined
Sam Lantinga bf754b52 2021-01-04T12:17:24 Valve contributed code is under the Zlib license
Ozkan Sezer 01a2f276 2021-01-04T01:23:50 consistently use TEXT() macro with LoadLibrary() and GetModuleHandle() cf. bug #5435.
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga f0b6c787 2021-01-02T09:58:08 Fixed Windows XP compatibility with recent hidapi commit
Cameron Gutman 414ddc32 2021-01-01T17:34:07 Do not wait in GetOverlappedResult() in hid_read_timeout() This is unsafe because the event is auto-reset, therefore the call to WaitForSingleObject() resets the event which GetOverlappedResult() will try to wait on. Even though the overlapped operation is guaranteed to be completed at the point we call GetOverlappedResult(), it will still wait on the event handle for a short time to trigger the reset for auto-reset events. This amounts to roughly a 100 ms sleep each time GetOverlappedResult() is called for a completed I/O with a non-signalled event. In the context of HIDAPI, this extra sleep means that callers that loop on hid_read_timeout() with timeout=0 will loop forever, since the 100 ms sleep each iteration ensures ReadFile() will always have new data.
Sam Lantinga ab55ec48 2021-01-01T11:12:41 Fix use-after-free SBH corruption due to overlapped ReadFile in hidapi not being canceled for all threads before device close - hidapi already called CancelIo on hid_close but that only cancels pending IO for the current thread. Controller read/writes originate from multiple threads (serialized, but on a different thread nonetheless) but device destruction was always done on the main device thread which left any pending overlapped reads still running after hidapi's internal read buffer is deallocated leading to intermittent free list corruption.
Sam Lantinga ff913a22 2020-12-23T16:16:55 Fixed compile warnings on platforms without hidapi support
Sam Lantinga 047b20e3 2020-12-23T16:11:16 Fixed compile warnings on platforms without hidapi support
Ozkan Sezer 90456670 2020-12-17T14:11:00 more "'for' loop initial declarations are only allowed in C99 mode" fixes
Sam Lantinga 14f97734 2020-12-15T14:57:47 Fixed whitespace
Sam Lantinga 706f6375 2020-12-13T01:58:05 Fixed build for platforms with only libusb hidapi implementations
Sam Lantinga 43aad966 2020-12-08T19:03:50 Fixed bug 5222 - Crash when running with -DHIDAPI=ON Mathieu Eyraud SDL dynamically loads libusb but does not check the return value of 'SDL_LoadFunction'. Also libusb is loaded and initialized several time because 'SDL_hidapi_wasinit' is never set to true. I made a patch if you want to test: - check that 'hid_init' is called once and only once, - check return value of 'hid_init', - check return value of 'SDL_LoadFunction', - check return value of 'SDL_malloc', - add some debug logging.
Sam Lantinga 59f28b7f 2020-12-03T18:17:01 Fixed whitespace
Sam Lantinga 9fc4a4c9 2020-11-24T22:25:26 Revamped Xbox One HIDAPI init sequence Added support for querying the controller serial number on newer firmware
Sam Lantinga 5b3616c3 2020-11-23T18:24:05 Generalized the raw input controller driver and moved XInput/WGI detection into it for XInput devices This fixes bad report parsing for various newer Xbox controllers, and this driver is now preferred over XInput, since it handles more than 4 controllers.
Sam Lantinga a94fe009 2020-11-21T18:40:27 Moved comment with the code it covers
Sam Lantinga 49f7be6d 2020-11-21T18:37:56 Fixed compile warning C4127: conditional expression is constant
Sam Lantinga 63b52e8e 2020-11-21T18:34:32 Remove SDL dependency in Windows code
Sam Lantinga d4954eb0 2020-11-21T18:26:43 Removed debug code
Sam Lantinga b442e617 2020-11-21T18:15:55 Fixed adding an extra zero byte for feature reports At least with PS4 and PS5 controllers DeviceIoControl() returns the correct value
Sam Lantinga 6b56b98f 2020-11-21T09:26:11 Fixed is_BLE() return value
Sam Lantinga 65c9f1d2 2020-11-21T09:06:48 Fixed upstream bug: FD 0 is a valid file descriptor https://github.com/libusb/hidapi/issues/199
Sam Lantinga b0b76a61 2020-11-19T07:12:53 Fixed rumble on PS5 controllers connected to Windows over Bluetooth
Sam Lantinga 30371f2d 2020-11-13T13:17:04 Fixed doubled report ID for Bluetooth Classic devices on Linux
Sam Lantinga e12457d8 2020-11-10T12:26:30 Added support for the Xbox Series X controller to the HIDAPI driver
Ryan C. Gordon b3a34c94 2020-05-06T03:18:25 hid: Add Microsoft Precision Mouse to the joystick blacklist. Same deal as the Razer keyboards, it hangs the enumeration.
Ryan C. Gordon 85d97410 2020-05-06T03:13:44 hid: Cleanup Windows joystick blacklist code, to make additions easier.
Ryan C. Gordon 3625b83c 2020-04-21T01:32:48 hid: Add Razer Arctosa keyboard to hid enumeration blacklist. Hangs SDL, same as the Razer Lycosa. Fixes Bugzilla #5101.
Ryan C. Gordon eaaa809e 2020-04-15T13:33:09 hidapi: Blacklist the Razer Lycosa keyboard from enumeration. It's not a joystick and it hangs device enumeration.
Sam Lantinga 6e646b61 2020-03-20T20:53:26 Removed blacklist entries for devices that aren't game controllers, allow Steam Controllers
Cameron Gutman 5ed71f3b 2020-03-20T13:44:50 Only enumerate HID devices on Windows that have gamepad HID usages There are a number of poorly behaved HID devices that time out on attempts to read various strings. Rather than end up on an endless treadmill of blacklisting broken devices, reduce our risk by only querying devices that are gamepads. SDL_hidapijoystick.c already checks these same usages, so we shouldn't exclude any working HID devices (caveat below). This also makes HidP_GetPreparsedData() and HidP_GetCaps() failure skip the device entirely, but that seems desired. If a device can't even return basic top-level collection data properly, we want nothing to do with that broken device. If we do find devices that work with HIDAPI joystick and fail these calls, we can add an exception via VID+PID matching.
Sam Lantinga 19c34844 2020-03-13T19:19:29 Fixed slow enumeration when Apple Cinema HD display 30" is plugged in
Sam Lantinga cb986aff 2020-03-13T13:05:32 Fixed exception at shutdown if the controllers are closed after the HIDDeviceManager is shutdown
Ethan Lee 133b4755 2020-03-11T14:17:19 Use LIBUSB_CALL for hidapi's read_callback function
Sam Lantinga 69a8c846 2020-03-04T09:42:08 Fixed using more than one Xbox Bluetooth controller Don't prevent duplicate devices using hidraw, instead libusb takes precedence and all hidraw devices that aren't handled by libusb are available
Sam Lantinga 96836ec6 2020-03-03T09:22:43 Add 500ms max wait time for hid_write to complete on Windows It appears that with some (presumably) flaky drivers or hardware that the WriteFile in hid_write never completes leading to GetOverlappedResult to block forever waiting for it.
Sam Lantinga 07000bfc 2020-03-02T17:31:58 Fixed bug 5010 - SDL_Init with SDL_INIT_JOYSTICK hangs for 10 seconds when playing audio from another application Jake Breen I have tracked it down to a call on hid_device_info() -> HidD_GetManufacturerString (Line 499 in src\hidapi\windows\hid.c)
Sam Lantinga bebc4867 2020-03-01T17:53:30 We already have a hidapi implementation for Windows, we don't need libusb
Sam Lantinga 1190343f 2020-01-30T16:02:56 Build hidapi as a framework on iOS, so it can be linked by the application as well.
Sam Lantinga c9c89783 2020-01-29T20:09:08 Miscellaneous pending fixes
Sam Lantinga 5e649983 2020-01-26T12:40:32 Don't enumerate devices we can't open
Sam Lantinga 43aa1fa9 2020-01-18T11:21:14 Added support for detecting previously unknown Xbox 360 and Xbox One controllers using the HIDAPI driver with libusb and Android
Sam Lantinga 4e682461 2020-01-17T10:43:14 Reattach the kernel driver after closing USB controllers
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sam Lantinga 4e1cc124 2020-01-16T15:32:39 Improved Xbox One controller initialization
Sam Lantinga 98ce0e50 2019-12-30T11:09:03 Removed unnecessary setlocale() on Mac https://github.com/signal11/hidapi/commit/240bad3b669ad4874c8aa2d68e18e82232d63e35
Sam Lantinga a9482a1d 2019-12-30T09:44:32 Added support for the Nintendo GameCube adapter, tested on Steam Link hardware
Cameron Gutman f21e1727 2019-12-20T22:25:49 Use IOHIDManagerRegisterDeviceRemovalCallback() to monitor for HID removal The function we currently use, IOHIDDeviceRegisterRemovalCallback(), often fails on Catalina with a "__CFRunLoopModeFindSourceForMachPort returned NULL" error message. Once a removal callback is missed, we will eventually crash when the joystick is closed attempting to use the invalid IOHIDDeviceRef. https://forums.developer.apple.com/thread/124444
Sam Lantinga 868551b1 2019-12-20T21:00:16 Fixed duplicate controller entries on Mac OS X when using libusb, due to the HID interface number not being available in the Mac OS X HID code.
Sam Lantinga c5024a18 2019-12-19T15:21:44 Backed out debug code
Sam Lantinga e22e77da 2019-12-19T15:01:35 Added an untested driver for the Nintendo GameCube adapter, based on code contributed by Ethan Lee
Sam Lantinga 15d30298 2019-12-19T15:01:32 Added support for wireless Xbox 360 controllers using the HIDAPI driver
Sam Lantinga 4237b183 2019-12-19T04:31:00 Fixed compiler warning
Sam Lantinga 52b6ab21 2019-12-16T17:11:23 Added support for the SteelSeries Stratus Duo
Sam Lantinga cd515bd1 2019-12-12T14:26:34 Fixed Xbox 360 Controller support using libusb on Linux
Sam Lantinga 53216436 2019-11-25T16:29:12 Use the same logic to get the config descriptor in hid_open() as in hid_enumerate()
Sam Lantinga 8243a3e8 2019-11-25T15:02:50 Added support for the Hyperkin X91
Sam Lantinga 494af7a6 2019-11-25T15:02:45 Backed out change to dynamically load udev - it's already happening in SDL_hidapi.c
Sam Lantinga 308e7f2f 2019-11-23T12:11:20 Linux hidapi code dynamically loads udev
Sam Lantinga 5c15e81c 2019-08-22T15:58:00 Prevent the SPEEDLINK COMPETITION PRO joystick from switching into Android controller mode when enumerated over HID on Windows 10.
Ethan Lee c76f0f5b 2019-08-06T23:08:01 hidapi: Explicitly include locale.h, for setlocale
Ethan Lee aa09e612 2019-08-04T00:01:38 Port libusb hid.c to SDL, add to MinGW configure
Ethan Lee f7d82e56 2019-07-31T12:20:55 hidapi: Add SDL_hidapi.c, allows support for multiple hidapi backends. This is currently supported on Linux and macOS. iOS and Android are not supported at all, Windows support could be added with some changes to the libusb backend. The Visual Studio and Xcode projects do not use this feature. Based on Valve Software's hid.cpp, written in collaboration with Andrew Eikum.
Andrew Eikum 738dff4b 2019-07-25T08:05:13 hidapi: Update repository URLs Upstream hidapi has been re-homed. Update the repo URLs to help guide folks where to contribute fixes.
Andrew Eikum 0e9560ae 2019-07-23T14:41:00 hidapi: Zero out new hid_device_info structs
Sam Lantinga 52e62329 2019-07-17T16:47:19 Fixed build error
Sam Lantinga 1dc24160 2019-07-17T16:47:13 Add linked list of opened HID devices to prevent accessing already freed devices in device removal callback that is sometimes called even after being unregistered
Jimb Esser 6a7161dc 2019-07-14T16:48:31 Blacklist Corsair device causing hang
Sam Lantinga 23a2b477 2019-06-07T09:00:26 Protect against NULL device in the Android hidapi implementation
Sam Lantinga 1a8e3a02 2019-03-12T14:44:12 HIDAPI: fix bug that caused non-HID class parts of composite devices to have windows HID functions called on them.
Sam Lantinga b08bdc44 2018-10-26T09:27:31 Don't build SDL_JOYSTICK_HIDAPI by default on iOS If you enable this, you'll need to link with CoreBluetooth.framework and add something like this to your Info.plist: <key>NSBluetoothPeripheralUsageDescription</key> <string>MyApp would like to remain connected to nearby bluetooth Game Controllers and Game Pads even when you're not using the app.</string>
Sam Lantinga c4918db5 2018-10-22T14:55:42 Add exception handling to Android hidapi.
Sam Lantinga 337cea44 2018-10-08T12:49:30 Fixed life-cycle issues with two activities sharing HIDDeviceManager
Ozkan Sezer cf7d64f2 2018-09-28T13:44:10 hidapi/windows/hid.c: comment out ntdef.h include after windows.h. not necessary and can cause redefinition errors in some toolchains.
Ozkan Sezer 283680f2 2018-09-28T11:04:55 hidapi/windows/hid.c: fix misplaced #if 0 VendorID && ProductID are only used by the test main(), otherwise they are unwanted globals.
Sam Lantinga f964ce03 2018-09-28T01:00:47 Fixed mingw-w64 build
Sam Lantinga 7df0f4fd 2018-09-27T14:56:29 Fixed bug 4277 - warnings patch Sylvain Patch a few warnings when using: -Wmissing-prototypes -Wdocumentation -Wdocumentation-unknown-command They are automatically enabled with -Wall
Sam Lantinga fb0e68ae 2018-09-25T08:23:57 Fixed building with newer Android NDK
Sam Lantinga f6a537cb 2018-09-17T11:35:24 Store the API device refcount on the device itself, so if the device is disconnected and we have multiple application references to it, we only free it once.
Ozkan Sezer 305e5968 2018-09-15T14:28:10 do not export hidapi symbols from SDL dlls (bug #4259).
Sam Lantinga e8a0e35e 2018-09-14T18:31:01 Use atomic reference counting for the HID device object
Sam Lantinga e9f6805f 2018-08-21T19:42:19 Removed dependency on C++ runtime on iOS
Sam Lantinga 0d22559e 2018-08-21T10:25:30 Fixed Android build error
Sam Lantinga 5dfa4043 2018-08-20T21:19:17 Fixed warnings building on Mac OS X 64-bit
Sam Lantinga 4f41f07d 2018-08-09T16:05:48 Added missing files from previous commits