USB Debug
Check USB Role
Use the following command to check the current role of
USB:
cat /sys/devices/platform/soc/10210000.usbdrd/of_node/dr_modeDebug USB Host
Follow the procedure below to debug USB host mode:
- Replace the current USB device with other USB devices, to ensure the USB device itself is not a faulty device.
- Replace the current USB cable with other USB cables, to ensure the USB cable itself is not faulty.
- Try the same connection on other PC hosts.
- If your device has multiple USB ports, try out on other ports.
- Connect the USB-Hub device with an independent power supply, and then connect a USB device to the USB-Hub to confirm if the host function works properly.
- Confirm if the host driver is loaded successfully. Use the following command to verify.
cat /sys/devices/platform/soc/10210000.usbdrd/of_node/dr_mode hostNote: If the folder 10210000.usbdrd does not exist, it means that the host driver is not installed. - Make sure you already have the latest code or patch.
- Under the same condition, compare the registers of the failed board against the ones which are working properly.
Debug USB Device
Follow the procedure below to debug USB device mode.
- Replace the current PC USB port with other USB port, to ensure the USB port itself is not a faulty device.
- Replace the current USB cable with other USB cables, to ensure the USB cable itself is not faulty.
- Try the same connection on other PC.
- If your device has multiple USB devices ports, try out on other ports.
- Run the following command to verify if the host driver is loaded
successfully.
cat /sys/devices/platform/soc/10210000.usbdrd/of_node/dr_mode peripheralNote: If the folder 10210000.usbdrd does not exist, it means that the host driver is not installed. - Make sure you already have the latest code or patch.
- Under the same condition, compare the registers of the failed board against the ones which are working properly.
Get USB Information using debugfs
You can use
debugfs to get the information of the USB hubs and
devices.# Mount debugfs (kernel debug virtual FS)
mount -t debugfs none /sys/kernel/debug
# Enter USB debug dir
cd /sys/kernel/debug/usb
# Print full USB topology + device descriptors
cat devicesOutput example for the USB 2.0 root
hub:
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 1
B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0002 Rev= 5.15
S: Manufacturer=Linux 5.15.79-dirty xhci-hcd
S: Product=xHCI Host Controller
S: SerialNumber=xhci-hcd.1.auto
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256msOutput example for USB attached
devices:
T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 5 Spd=5000 MxCh= 0
D: Ver= 3.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1
P: Vendor=174c ProdID=55aa Rev= 1.00
S: Manufacturer=asmedia
S: Product=ASM1153E
S: SerialNumber=00000000000000000000
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=uas
E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:* If#= 0 Alt= 1 #EPs= 4 Cls=08(stor.) Sub=06 Prot=62 Driver=uas
E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms