-
Notifications
You must be signed in to change notification settings - Fork 901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mac: HID Manager segfaults after registering, then unregistering input report callback #116
Comments
Hey, this is great news! I guess the trick now is to find the spot where this unregistration should happen. I remember from before that if you don't unregister and then close the device, it will crash. |
From looking at the current 10.7 and 10.8 HID Manager code, I don't believe there is any safe time to unregister the input report callback. We should do more testing to see if the callbacks really need to be unregistered on 10.5/10.6, I think 10.7/10.8 don't need it. (These bugs/changes started in 10.7 when they added support for registering multiple removal/input report/input value callbacks) |
That's starting to sound familiar. Thanks Apple, for repeatedly breaking userspace :( |
Hi mrpippy, any updates on this? |
I never submitted any bugs to Apple for this--I don't think there's any point unless I can reproduce on a Mavericks beta, and I don't currently have access to betas. |
BTW, a little off topic, but it looks like the Infiniti Q50 is using hidapi in its iPod interface code :P http://www.globaldenso.com/en/opensource/ivi/nissan/ |
This is a bug in the underlying OS X HID Manager, not hidapi itself
When an input report callback is registered (using
IOHIDDeviceRegisterInputReportCallback()
) and then unregistered (by passingNULL
as the callback to the same function), the HID Manager will segfault when the next input report is received.This can easily be reproduced with the following change to hidapi's mac/hid.c:
And the backtrace from the segfault:
I don't believe this is causing any crashes for hidapi, aside from a possible race condition if an input report is received during
hid_close()
(between the call toIOHIDDeviceRegisterInputReportCallback()
to unregister the callback and the call toIOHIDDeviceClose()
)I've tracked down the cause of this bug in the HID Manager code, and I'll add rdar links, etc. once I get those submitted.
The text was updated successfully, but these errors were encountered: