Skip to content

Stable path for multiple USB devices (on LInux)? #405

Open
@derekatkins

Description

@derekatkins

I've got multiple devices that I'm trying to access in a stable manner. They do not provide a serial number or other uniquifying data that I can see. I tried to use the HID path but it looks like that's not a stable number -- each time I remove and re-insert the device (into the same USB port) the HID path changes. Is there some way to access the underlying USB path (which DOES appear to be stable)? E.g.:

[2332915.679529] hid-generic 0003:0416:5020.0005: input,hidraw0: USB HID v1.10 Device [Nuvoton HID Transfer] on usb-0000:00:14.0-4/input0
[2333625.965356] hid-generic 0003:0416:5020.0006: input,hidraw0: USB HID v1.10 Device [Nuvoton HID Transfer] on usb-0000:00:14.0-4/input0
[2336516.928041] hid-generic 0003:0416:5020.0007: input,hidraw0: USB HID v1.10 Device [Nuvoton HID Transfer] on usb-0000:00:14.0-4/input0
[2337168.447530] hid-generic 0003:0416:5020.0008: input,hidraw0: USB HID v1.10 Device [Nuvoton HID Transfer] on usb-0000:00:14.0-1/input0

I had the first device on usb-0000:00:14.0-4 which I removed and reinserted, and then I removed/reinserted the second device on usb-0000:00:14.0-1. Unfortunately I don't see any way to access this information from hidapi. Worse, the hid path changes on every insert (see the 0005, 0006, 0007, 0008? That gets reflected in an increasing hid path).

So without a serial number, what's the path (pun intended) to a stable reference to a HID device? The full dmesg for an insertion looks like:

[2336516.733051] usb 1-4: new full-speed USB device number 16 using xhci_hcd
[2336516.919895] usb 1-4: New USB device found, idVendor=0416, idProduct=5020
[2336516.919896] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[2336516.919897] usb 1-4: Product: HID Transfer
[2336516.919898] usb 1-4: Manufacturer: Nuvoton
[2336516.927801] input: Nuvoton HID Transfer as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0416:5020.0007/input/input24

Thanks.

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