Created
April 7, 2023 00:49
-
-
Save dansteingart/c9cd6da2e26c9a3507cbddf7693b7d73 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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/"* ]] && exit | |
eval "$(udevadm info -q property --export -p $syspath)" | |
[[ -z "$ID_SERIAL" ]] && exit | |
echo "$ID_SERIAL:/dev/$devname" | |
) | |
done | |
echo $OUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment