summaryrefslogtreecommitdiff
path: root/test-cli/test/helpers/usb.sh
blob: 52ea4b2f48bcb0ea8622bbee62e8fdb12a9a0e23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
    (
        syspath="${sysdevpath%/dev}"
        devname="$(udevadm info -q name -p $syspath)"
        [[ "$devname" == "bus/"* ]] && continue
        eval "$(udevadm info -q property --export -p $syspath)"
        [[ -z "$ID_SERIAL" ]] && continue
        echo "/dev/$devname - $ID_SERIAL"
    )
done

exit 0