Persisting connected USB devices

The following external hardware is connected to hangdevice

#sudo mknod /dev/ttyUSB0 c 188 0
#sudo mknod /dev/ttyUSB1 c 188 1

lsusb -t #list the devices as tree
lsusb -v | grep 'idVendor\|idProduct\|iProduct\|iSerial' #get some more info

Useful tips:

(warning) Problem: Vendor ID and Product IDs are the same for each Smart Stepper. So they cannnot be assigned by Serial ID. The solution is to use devpath instead of Product ID and Vendor ID. The following USB port mapping was found for my Raspberr Pi 3B (browsing on the web this seems to be indivually different for each Raspberry Pi). You also can change the IDs by re-flashing the Smart Steppers. See Smart Stepper - flashing the firmware for details.

sudo vim /etc/udev/rules.d/99-usb-serial.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="60ec", SYMLINK+="ttyUSB-DUET2ETHERNET"
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="082d", ATTRS{serial}=="EF9B0F4F", SYMLINK+="ttyUSB-LOGITECH-C920"
SUBSYSTEM=="tty", ATTRS{idVendor}=="05e3", ATTRS{idProduct}=="0608", SYMLINK+="ttyUSB-MINI-4PORT-HUB" #this will disappear if all Smart Steppers are disconnected because the hub itself has no tty. It gets one when at least one device is attached to the hub
#ATTRS{devpath}=="3.1" -> 1 is the Port at Raspberry Pi, 1 is the Port of the connected Mini USB Hub
SUBSYSTEM=="tty", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="8087", ATTRS{devpath}=="1.4.1", SYMLINK+="ttyUSB-SMART-A-AXIS"
SUBSYSTEM=="tty", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="8087", ATTRS{devpath}=="1.4.2", SYMLINK+="ttyUSB-SMART-B-AXIS"
SUBSYSTEM=="tty", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="8087", ATTRS{devpath}=="1.4.3", SYMLINK+="ttyUSB-SMART-C-AXIS"
SUBSYSTEM=="tty", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="8087", ATTRS{devpath}=="1.4.4", SYMLINK+="ttyUSB-SMART-D-AXIS"
udevadm trigger #apply the rules
ls /dev

Overview of busses, ports, devices

USB ports are sometimes confusing.

#list USB by /sys/bus/usb/drivers/usb
cd /sys/bus/usb/drivers/usb
ls -alF

lrwxrwxrwx  1 root root    0 Apr 29 12:32 1-1 -> ../../../../devices/platform/soc/3f980000.usb/usb1/1-1/
lrwxrwxrwx  1 root root    0 Apr 29 12:32 1-1.1 -> ../../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/
lrwxrwxrwx  1 root root    0 Apr 29 12:32 1-1.2 -> ../../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/
lrwxrwxrwx  1 root root    0 Apr 29 12:32 1-1.3 -> ../../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/
lrwxrwxrwx  1 root root    0 Apr 29 12:32 1-1.4 -> ../../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/
lrwxrwxrwx  1 root root    0 Apr 29 12:32 1-1.4.1 -> ../../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4.1/
lrwxrwxrwx  1 root root    0 Apr 29 12:32 1-1.4.2 -> ../../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4.2/
lrwxrwxrwx  1 root root    0 Apr 29 12:32 1-1.4.3 -> ../../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4.3/
lrwxrwxrwx  1 root root    0 Apr 29 12:32 1-1.4.4 -> ../../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4.4/
lrwxrwxrwx  1 root root    0 Apr 29 12:32 1-1.5 -> ../../../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/
#list USB by lsusb -t
lsusb -t

/:  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 4, If 0, Class=Mass Storage, Driver=usb-storage, 480M
        |__ Port 3: Dev 5, If 0, Class=Communications, Driver=cdc_acm, 12M
        |__ Port 3: Dev 5, If 1, Class=CDC Data, Driver=cdc_acm, 12M
        |__ Port 4: Dev 6, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 1: Dev 8, If 0, Class=Communications, Driver=cdc_acm, 12M
            |__ Port 1: Dev 8, If 1, Class=CDC Data, Driver=cdc_acm, 12M		
            |__ Port 2: Dev 9, If 1, Class=CDC Data, Driver=cdc_acm, 12M
            |__ Port 2: Dev 9, If 0, Class=Communications, Driver=cdc_acm, 12M
            |__ Port 3: Dev 10, If 0, Class=Communications, Driver=cdc_acm, 12M
            |__ Port 3: Dev 10, If 1, Class=CDC Data, Driver=cdc_acm, 12M
            |__ Port 4: Dev 11, If 0, Class=Communications, Driver=cdc_acm, 12M
            |__ Port 4: Dev 11, If 1, Class=CDC Data, Driver=cdc_acm, 12M
        |__ Port 5: Dev 7, If 0, Class=Video, Driver=uvcvideo, 480M
        |__ Port 5: Dev 7, If 1, Class=Video, Driver=uvcvideo, 480M
        |__ Port 5: Dev 7, If 2, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 5: Dev 7, If 3, Class=Audio, Driver=snd-usb-audio, 480M

Mapping looks like this

1-1    Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
1-1    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
1-1.1     |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
1-1.2     |__ Port 2: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 480M
1-1.3     |__ Port 3: Dev 5, If 0, Class=Communications, Driver=cdc_acm, 12M
1-1.3     |__ Port 3: Dev 5, If 1, Class=CDC Data, Driver=cdc_acm, 12M
1-1.4     |__ Port 4: Dev 6, If 0, Class=Hub, Driver=hub/4p, 480M
1-1.4.1      |__ Port 1: Dev 8, If 0, Class=Communications, Driver=cdc_acm, 12M
1-1.4.1      |__ Port 1: Dev 8, If 1, Class=CDC Data, Driver=cdc_acm, 12M		
1-1.4.2      |__ Port 2: Dev 9, If 0, Class=Communications, Driver=cdc_acm, 12M
1-1.4.2      |__ Port 2: Dev 9, If 1, Class=CDC Data, Driver=cdc_acm, 12M
1-1.4.3         |__ Port 3: Dev 10, If 0, Class=Communications, Driver=cdc_acm, 12M
1-1.4.3         |__ Port 3: Dev 10, If 1, Class=CDC Data, Driver=cdc_acm, 12M
1-1.4.4         |__ Port 4: Dev 11, If 0, Class=Communications, Driver=cdc_acm, 12M
1-1.4.4         |__ Port 4: Dev 11, If 1, Class=CDC Data, Driver=cdc_acm, 12M
1-1.5     |__ Port 5: Dev 7, If 0, Class=Video, Driver=uvcvideo, 480M
1-1.5     |__ Port 5: Dev 7, If 1, Class=Video, Driver=uvcvideo, 480M
1-1.5     |__ Port 5: Dev 7, If 2, Class=Audio, Driver=snd-usb-audio, 480M
1-1.5     |__ Port 5: Dev 7, If 3, Class=Audio, Driver=snd-usb-audio, 480M

Troubleshooting USB errors

A lot of different USB errors can occure (like "device not accepting address"). Most times a reset of the USB hub helps. We can turn off, keep off some seconds and turn on again the hub to re-init the devices in case there are no powering issues. See https://paulphilippov.com/articles/how-to-fix-device-not-accepting-address-error. See Smart Stepper - USB, Soft and hard reset for some tested out handling methods (works for webcam too).

  • No labels
Write a comment…