Created
October 18, 2022 16:00
-
-
Save dansteingart/a99d87d95c81fef15070cc4683ee50d0 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