Wie können Sie einzelne USB-Geräte identifizieren, um sie zu lösen und zu binden? Insbesondere Geräte wie Mäuse, Tastatur, Dongles usw., die kein Speicher sind.Ubuntu/Debian So identifizieren Sie den USB-Port des Geräts
Zum Beispiel auf Debian (Raspbian GNU/Linux v8.0 in diesem Fall), ich habe ein paar Geräte, die in/sys/bus/usb/drivers/usbhid /:
ls/sys/bus/usb/drivers/usbhid/ zeigt USB-Geräte:
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 zeigt:
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 zeigt:
/: 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
Ich weiß, dass die Novatel Wireless ist 1-1,4: 2.2 von erraten.
Ich kann es dann zurücksetzen, indem Lauf echo -n '1-1,4: 2.2'>/sys/bus/usb/drivers/usbhid/unbind und echo -n '1-1,4: 2.2'>/sys/bus/usb/drivers/usbhid/bind
Es wäre toll, wenn es eine offensichtliche Möglichkeit gäbe, es zu identifizieren und es in einem Bash-Skript zurückzusetzen. Wie kann ein Gerät identifiziert und zurückgesetzt werden, wenn sich mehrere Hardware an verschiedenen Ports befinden?