src/hidapi/mac

Branch


Log

Author Commit Date CI Message
Ozkan Sezer 0f2322ac 2023-04-24T18:55:14 hidapi/mac: replace sprintf uses with snprintf. Reference issues: - https://github.com/libusb/hidapi/pull/509 - https://github.com/libusb/hidapi/pull/511 (cherry picked from commit ae9119c36bdcf2214d83c6d35c436d22b5fd03cb)
Ozkan Sezer 5f344c17 2023-04-24T18:47:04 hidapi/mac: import mainstream commit c1b9d2ad https://github.com/libusb/hidapi/commit/c1b9d2ad985c826f7916aa793d4728885a43a0f4 Properly handle the close of run loop on macOS (https://github.com/libusb/hidapi/pull/522) - as per documentation `kCFRunLoopRunStopped` should be handled once the runloop is closed via `CFRunLoopStop`; - if it is not handled - a race condition/crash may happen on the latest macOS when a device gets disconnected while being open; (cherry picked from commit 62d1a2c836c6176a6c76d54229eafa7d011bb9fb)
Sam Lantinga f71178a1 2023-02-09T12:05:46 Fixed MFI controller being opened while HIDAPI controller was being opened This was the callstack: frame #3: 0x00000001004e1930 libSDL3.1.0.0.dylib`IOS_AddJoystickDevice(controller=0x0000600003b0c000, accelerometer=SDL_FALSE) at SDL_mfijoystick.m:528:14 frame #4: 0x00000001004e1a54 libSDL3.1.0.0.dylib`__IOS_JoystickInit_block_invoke(.block_descriptor=0x0000000100547760, note=@"GCControllerDidConnectNotification") at SDL_mfijoystick.m:673:45 frame #5: 0x000000018601e578 CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 128 frame #6: 0x00000001860bc074 CoreFoundation`___CFXRegistrationPost_block_invoke + 88 frame #7: 0x00000001860bbfbc CoreFoundation`_CFXRegistrationPost + 440 frame #8: 0x0000000185fefbac CoreFoundation`_CFXNotificationPost + 708 frame #9: 0x0000000186edc72c Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 88 frame #10: 0x000000019b054a18 GameController`__60-[_GCControllerManagerAppClient _onqueue_publishController:]_block_invoke + 156 frame #11: 0x0000000185dc19dc libdispatch.dylib`_dispatch_call_block_and_release + 32 frame #12: 0x0000000185dc3504 libdispatch.dylib`_dispatch_client_callout + 20 frame #13: 0x0000000185dd1d1c libdispatch.dylib`_dispatch_main_queue_drain + 928 frame #14: 0x0000000185dd196c libdispatch.dylib`_dispatch_main_queue_callback_4CF + 44 frame #15: 0x000000018606ad6c CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 frame #16: 0x00000001860287ec CoreFoundation`__CFRunLoopRun + 2036 frame #17: 0x00000001860278a4 CoreFoundation`CFRunLoopRunSpecific + 612 frame #18: 0x00000001003b1194 libSDL3.1.0.0.dylib`process_pending_events at hid.c:509:9 frame #19: 0x00000001003aebe8 libSDL3.1.0.0.dylib`PLATFORM_hid_open_path(path="USB_054c_05c4_0x11a104290", bExclusive=0) at hid.c:823:2 frame #20: 0x00000001003b051c libSDL3.1.0.0.dylib`SDL_hid_open_path_REAL(path="USB_054c_05c4_0x11a104290", bExclusive=0) at SDL_hidapi.c:1419:19 frame #21: 0x00000001004dabdc libSDL3.1.0.0.dylib`HIDAPI_SetupDeviceDriver(device=0x0000600003518000, removed=0x000000016fdfee3c) at SDL_hidapijoystick.c:399:19 frame #22: 0x00000001004da890 libSDL3.1.0.0.dylib`HIDAPI_AddDevice(info=0x000060000212c2d0, num_children=0, children=0x0000000000000000) at SDL_hidapijoystick.c:843:5 frame #23: 0x00000001004d9148 libSDL3.1.0.0.dylib`HIDAPI_UpdateDeviceList at SDL_hidapijoystick.c:1000:21 frame #24: 0x00000001004d9940 libSDL3.1.0.0.dylib`HIDAPI_JoystickDetect at SDL_hidapijoystick.c:1205:13 frame #25: 0x00000001003bc6d8 libSDL3.1.0.0.dylib`SDL_UpdateJoysticks_REAL at SDL_joystick.c:1703:9 frame #26: 0x00000001003a13a8 libSDL3.1.0.0.dylib`SDL_PumpEventsInternal(push_sentinel=SDL_FALSE) at SDL_events.c:855:9 frame #27: 0x00000001003a1340 libSDL3.1.0.0.dylib`SDL_PumpEvents_REAL at SDL_events.c:879:5 frame #28: 0x000000010038b380 libSDL3.1.0.0.dylib`SDL_PumpEvents at SDL_dynapi_procs.h:572:1 frame #29: 0x0000000100004524 testgamepad`loop + 40 frame #30: 0x00000001000063d8 testgamepad`main + 2140 (cherry picked from commit a9650d440a862b86dc5722a402b06bf2bbbec527)
Sam Lantinga 15a98909 2022-11-05T16:44:52 Added SDL_HINT_HIDAPI_IGNORE_DEVICES to specify devices that should be ignored in SDL_hid_enumerate()
Sam Lantinga f6b1e028 2022-10-29T10:42:48 Allow vendor matching for hid_enumerate() on all backends
Sam Lantinga aa2e2f48 2022-09-22T18:22:17 Make sure HID devices can be opened before making them available to the application This prevents a number of issues where devices are enumerated but not actually able to be opened, like https://github.com/libsdl-org/SDL/issues/5781. We currently leave the devices open, allowing us to more easily do controller feature detection, protocol negotiation, detect dropped Bluetooth connections, etc. with the expectation that the application is likely to open the controllers shortly.
Sam Lantinga 99e85cc2 2022-09-22T10:10:20 Accidentally reverted https://github.com/libsdl-org/SDL/commit/172865ff137532123ec06177119be163ba1811f5
Sam Lantinga 6cbdc666 2022-09-22T09:05:06 Fixed use of uninitialized 'size' variable (thanks @ozkan!)
Sam Lantinga 910d499c 2022-09-16T09:19:20 Fixed comment typo
Sam Lantinga 172865ff 2022-09-16T09:16:18 Don't enumerate HID devices on macOS if we don't have input monitoring permissions Unfortunately the only way to detect this is to actually try opening a device, so we wait until the application tries, and then stop enumerating afterwards. Fixes https://github.com/libsdl-org/SDL/issues/5781
Sam Lantinga 679582e7 2022-08-25T11:07:20 Fixed crash if there are no devices available
Pierre Wendling 6c536afd 2022-06-27T15:43:17 Fix C89 declaration for macOS modules. Since Clang 14, `-Wdeclaration-after-statement` is enforced on every standard.
Ryan C. Gordon 4fe7b2cb 2022-03-24T11:00:43 static analysis: Fixed several complaints from codechecker. There are still some pending Objective-C specific issues. Reference issue #4600.
Sam Lantinga 09b652b7 2022-03-09T13:54:23 Make sure the string properties are actually strings (thanks Nat!)
Sam Lantinga 14db417e 2022-03-08T21:32:27 Reenable getting the serial number on macOS We filter now on game controllers, so we shouldn't hit the crash bug on random devices that this was working around.
Sam Lantinga c3ca3445 2022-03-08T18:56:49 Prefer HIDAPI on macOS, as that has extended functionality
Cameron Gutman 343fa612 2021-11-20T13:17:59 hid: fix inconsistent indentation
Cameron Gutman db60b271 2021-11-20T13:13:17 hid: Only enumerate IOHIDDevices that are likely to be joysticks Touching HID devices with keyboard usages will trigger a keyboard capture permission prompt on macOS 11+. See #4887 Like the IOKit joystick backend, we accept HID devices that have joystick, gamepad, or multi-axis controller usages. We also allow the Valve VID for the Steam Controller, just like the Windows HIDAPI implementation does.
Sam Lantinga 5b646cd1 2021-11-07T22:58:44 Build hidapi code into SDL as a new public API This prevents conflicts with hidapi linked with applications, as well as allowing applications to make use of HIDAPI on Android and other platforms that might not normally have an implementation available.
Sam Lantinga db18764e 2021-10-01T16:27:59 Use correct relative include path
Sam Lantinga 814285d6 2021-06-23T09:19:02 Workaround for crash on Apple Mac M1 hardware
Sam Lantinga 6de33c09 2021-06-03T09:05:33 Clarify why we're skipping Game Controller framework supported devices in hid.c
Patrick Hogan 28da6c5d 2021-05-27T14:42:03 Have HIDAPI skip MFI supported HID devices on macOS to avoid duplicate devices.
Sam Lantinga 1133ea03 2021-03-22T19:18:57 Fixed crash on macOS when AirPods are connected
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 98ce0e50 2019-12-30T11:09:03 Removed unnecessary setlocale() on Mac https://github.com/signal11/hidapi/commit/240bad3b669ad4874c8aa2d68e18e82232d63e35
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
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
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 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