Skip to content

Instantly share code, notes, and snippets.

@Scottapotamas
Created April 25, 2019 11:05
Show Gist options
  • Save Scottapotamas/c07166ff3dc65331efee88629864078e to your computer and use it in GitHub Desktop.
Save Scottapotamas/c07166ff3dc65331efee88629864078e to your computer and use it in GitHub Desktop.
#!/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