Closed
Description
Hallo.
When disconnecting my USB joystick I get this as dmesg output:
[Sat Aug 13 10:01:03 2016] usb 1-3: USB disconnect, device number 20
[Sat Aug 13 10:01:05 2016] bodnar_USB_gene[6318]: segfault at 4 ip 00007fa98241d4d0 sp 00007fffcab38c78 error 4 in libhidapi-hidraw.so.0.0.0[7fa98241b000+3000]
Trying then to
hid_close(handle);
hid_exit();
hid_init();
handle = hid_open(0x16c0, 0x05ba, serialNumberW);
does not bring anything after reconnecting the joystick.
I tried it out also with libusb:
[Fri Aug 12 02:59:55 2016] usb 1-3: USB disconnect, device number 11
[Fri Aug 12 02:59:56 2016] bodnar_USB_gene[3113]: segfault at 24 ip 00007f021770a310 sp 00007fff739c5988 error 4 in libhidapi-libusb.so.0.0.0[7f0217706000+6000]
Metadata
Metadata
Assignees
Labels
No labels
Activity
signal11 commentedon Aug 13, 2016
Can you debug into it? Can you try with the latest version from github (git clone ...) ?
sirop commentedon Aug 13, 2016
I seem to have the latest github version:
Maybe my xenomai kernel is to blame?
I do not get any core dump if you meant that with debugging.
Does it matter if not only XHCI but also EHCI is enabled in BIOS?
sirop commentedon Aug 13, 2016
But I could do
gdb -p:So seems that the device handle is set to
NULLon disconnect?But then these lines https://github.com/signal11/hidapi/blob/master/linux/hid.c#L699-L703
are a bit misleading as one get down there only with some luck.
signal11 commentedon Aug 13, 2016
Then you are setting the device handle to NULL somehow. The library doesn't magically alter your pointers for you. You are passing NULL into hid_read() (see dev=0x0)
signal11 commentedon Aug 13, 2016
If you want to break out the big hammer, put a data breakpoint on your handle, and you'll see when it changes, but I think you can probably find it with static analysis.
sirop commentedon Aug 13, 2016
My code is rather simple:
It means that you are right:
handle = hid_open(0x16c0, 0x05ba, serialNumberW)called in the loop returnsNULLwhich is passed tohid_readin the next iteration.