ref: 5be936a1926529abc8c9a0aa2cdca81d8e6583ec
dir: /sys/src/cmd/usb/probe/
#!/bin/rc # usb/probe [-h] - list all usb devices, including hubs rfork e test -e /dev/usb || bind -a '#u' /dev || { echo no '#u/usb' >[1=2] exit nousb } filter = cat if (~ $1 -h) filter = (grep -v ' (root)?hub ') awk 'BEGIN { ep = "" } $1 ~ /ep[0-9]+\.0/ && $2 == "enabled" && $NF ~ /busy|idle/ { ep=$1 next } { if(ep != ""){ printf "%s %s\n", ep, $0 ep = "" } } ' /dev/usb/ctl | $filter exit ''