src/hidapi/windows/hid.c


Log

Author Commit Date CI Message
Sam Lantinga a91ab883 2021-08-06T12:28:03 Fixed building on Windows with cmake, ninja, and clang
Sam Lantinga 1dc9180f 2021-01-27T21:30:25 Fixed compiler warnings
Sam Lantinga d59a9268 2021-01-27T21:30:21 Fixed build warning
Sam Lantinga eb83da02 2021-01-27T21:30:17 Fixed PS4 controllers over Bluetooth on Windows 7
Sam Lantinga a4db44fa 2021-01-27T12:41:37 The Sharkoon Skiller SGH2 headset hangs in DirectInput enumeration, so avoid it here just in case. See bug 5485 for details.
Ozkan Sezer 01a2f276 2021-01-04T01:23:50 consistently use TEXT() macro with LoadLibrary() and GetModuleHandle() cf. bug #5435.
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.
Ozkan Sezer 90456670 2020-12-17T14:11:00 more "'for' loop initial declarations are only allowed in C99 mode" fixes
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 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 b0b76a61 2020-11-19T07:12:53 Fixed rumble on PS5 controllers connected to Windows over Bluetooth
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 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 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.
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.
Jimb Esser 6a7161dc 2019-07-14T16:48:31 Blacklist Corsair device causing hang
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>
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 4f41f07d 2018-08-09T16:05:48 Added missing files from previous commits