How can you identify individual USB devices to unbind and bind them? Specifically, devices like mice, keyboard, dongles, etc. which are not storage.
For example, on Debian (Raspbian GNU/Linux v8.0 in this case), I have a few devices listed in /sys/bus/usb/drivers/usbhid/:
ls /sys/bus/usb/drivers/usbhid/ shows USB devices:
1-1.2:1.0 1-1.2:1.1 1-1.2:1.2 1-1.3:1.0 1-1.3:1.1 1-1.4:2.2
lsusb shows:
Bus 001 Device 006: ID 1410:9020 Novatel Wireless
Bus 001 Device 009: ID 045e:00db Microsoft Corp. Natural Ergonomic Keyboard 4000 V1.0
Bus 001 Device 008: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
lsusb -t shows:
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
|__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
|__ Port 2: Dev 8, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 2: Dev 8, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 2: Dev 8, If 2, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 3: Dev 9, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 3: Dev 9, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 4: Dev 6, If 0, Class=Communications, Driver=cdc_ether, 480M
|__ Port 4: Dev 6, If 1, Class=CDC Data, Driver=cdc_ether, 480M
|__ Port 4: Dev 6, If 2, Class=Human Interface Device, Driver=usbhid, 480M
I know that the Novatel Wireless is 1-1.4:2.2 from guessing.
I can then reset it by running echo -n '1-1.4:2.2' > /sys/bus/usb/drivers/usbhid/unbind and echo -n '1-1.4:2.2' > /sys/bus/usb/drivers/usbhid/bind
It would be great if there was an obvious way to identify it and reset it in a bash script. Also, how can a device be identified and reset if there are more than one of the same hardware on different ports?