Skip to content

Instantly share code, notes, and snippets.

@kamawanu
Created April 7, 2017 01:45
Show Gist options
  • Save kamawanu/cf3ebb85ebf1bdfdaa593a3c9ac00652 to your computer and use it in GitHub Desktop.
Save kamawanu/cf3ebb85ebf1bdfdaa593a3c9ac00652 to your computer and use it in GitHub Desktop.
#!/bin/bash -x
BYPATH=$( fgrep $1 /sys/bus/usb/devices/*/serial | cut -d: -f1 )
DEVPATH=$( echo $BYPATH | cut -d/ -f6 | cut -d- -f2 )
##ls -1 /dev/disk/by-path/pci-*
cd /dev/disk/by-path/
realpath $( readlink pci-*:*:*-usb-*:$DEVPATH:* )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment