todbot / blink1-tool

Command-line tools and C library for blink(1) USB RGB LED
https://blink1.thingm.com/
Other
84 stars 15 forks source link

Document the `hiddata.c` differences of `blink1-mini-tool` #26

Open todbot opened 4 years ago

todbot commented 4 years ago

Both blink1-tool and blink1-mini-tool have a hiddata.c. This is an alternate, simpler and, for Linux, a libusb-0.1-based way of talking to USB HID devices. The normal preferred way is to use hidapi.

The hiddata.c in blink1-mini-tool attempts to detach the (Linux) kernel driver if it has claimed it for the device and then reattach it when done. Some Linux kernel configurations can be zealous about what USB devices it decides to own. At you may expect, detach/reattach can be a dangerous thing to do. So it's relegated to blink1-mini-tool, which is sort of a last-ditch attempt to talk to blink(1) on minimal embedded Linux systems like WRT routers.

This should be documented somewhere. I need to figure out where.