Created
April 5, 2016 20:20
-
-
Save etcwilde/1277133506bcb961f9f475670662fe0c to your computer and use it in GitHub Desktop.
Lookup serial devices connected to the serial port
This file contains 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/"* ]] && continue | |
eval "$(udevadm info -q property --export -p $syspath)" | |
[[ -z "$ID_SERIAL" ]] && continue | |
echo "/dev/$devname - $ID_SERIAL" | |
) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment