1234567891011121314151617181920212223242526 |
- #!/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 ''
|