Skip to content

Can't access blink device via hidraw if it's been opened with libusb #28

Description

@normanr

I thought that the 2.1.0 release can't find mk1 devices:

$ blink1-tool-v2.1.0 --list
no blink(1) devices found

The 2.0.5 release shows it fine:

$ blink1-tool-v2.0.5 --list
blink(1) list: 
id:0 - serialnum:<omitted> (mk1) fw version:100

but if I re-plug the device then the 2.1.0 release works fine:

$ ./blink1-tool-v2.1.0 --list
blink(1) list: 
id:0 - serialnum:<omitted> (mk1) fw version:100

The device appears as:

$ dmesg
usb 1-3.3.1: New USB device found, idVendor=27b8, idProduct=01ed, bcdDevice= 1.00
usb 1-3.3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-3.3.1: Product: blink(1)
usb 1-3.3.1: Manufacturer: ThingM
usb 1-3.3.1: SerialNumber: <omitted>
hid-led 0003:27B8:01ED.01A8: hidraw4: USB HID v1.01 Device [ThingM blink(1)] on usb-0000:00:14.0-3.3.1/input0
hid-led 0003:27B8:01ED.01A8: ThingM blink(1) v1 initialized
$ ls /dev/hidraw4
crw-rw---- 1 root plugdev 248, 4 Jun  5 16:50 /dev/hidraw4
$ ls /sys/class/leds/thingm*
'/sys/class/leds/thingm4:blue':
brightness  device  max_brightness  power  subsystem  trigger  uevent

'/sys/class/leds/thingm4:green':
brightness  device  max_brightness  power  subsystem  trigger  uevent

'/sys/class/leds/thingm4:red':
brightness  device  max_brightness  power  subsystem  trigger  uevent

but after running the v2.0.5 binary (nothing extra appears in dmesg):

$ ls /dev/hidraw4
ls: cannot access '/dev/hidraw4': No such file or directory
$ ls /sys/class/leds/thingm*
ls: cannot access '/sys/class/leds/thingm*': No such file or directory

Re-plugging the device is fine if you have one or two of them, not if you have many. Luckily it looks like the device can be re-bound to re-create the hidraw devices:

$ echo -n "1-3.3.1:1.0" | sudo tee /sys/bus/usb/drivers/usbhid/bind > /dev/null

I assume there's not much the blink1-tool could do about this (particularly if running as a non-root user), but the documentation could call this out, and maybe the no blink(1) devices found error message could be updated to suggest running the above command (the hard part is figuring out the device id to rebind)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions