signal11 / hidapi

A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac, and Windows.
http://www.signal11.us/oss/hidapi/
Other
2.46k stars 901 forks source link

Unplugging USB device in the middle of hid_write #461

Closed tzjb closed 4 years ago

tzjb commented 4 years ago

My application crashes when USB device is unplugged (suddenly, not gracefully) from computer when writing data to the device (hid_write). So far I cannot conclude it is hid_write() causes this crash, but the call trace shows crash is consistently around hid_write(), so this is more of a question rather than an issue: if hid_write is in process, what is the behavior if USB device is unplugged? What is the proper way for the caller of hid_write to handle this situation, i.e., USB device is suddenly removed, so no crash occurs? Thanks!

tzjb commented 4 years ago

I found that it is not the issue of hid_write, hence close this issue.