Last active
August 29, 2015 13:59
-
-
Save jnelson/10923035 to your computer and use it in GitHub Desktop.
Revisions
-
jnelson revised this gist
Apr 16, 2014 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,8 +6,7 @@ candidates=`ls /dev | grep ttyUSB` for targetDevice in $candidates do majMinDevNums=`cat /sys/class/tty/$targetDevice/dev` infoLink=`ls -l /sys/dev/char/$majMinDevNums | awk '{print $NF}' | grep -oP '../../\K.*'` infoDir=`echo /sys/$infoLink | perl -pe "s|(.*)/[\d-:.]+/$targetDevice/.*|\1|"` busnum=`cat $infoDir/busnum` || continue -
jnelson created this gist
Apr 16, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #!/bin/bash # Reminder: don't use this. candidates=`ls /dev | grep ttyUSB` for targetDevice in $candidates do majMinDevNums=`cat /sys/class/tty/$targetDevice/dev` infoLink=`ls -l /sys/dev/char/$majMinDevNums | awk '{print $NF}'` infoLink=`echo $infoLink | grep -oP '../../\K.*'` infoDir=`echo /sys/$infoLink | perl -pe "s|(.*)/[\d-:.]+/$targetDevice/.*|\1|"` busnum=`cat $infoDir/busnum` || continue devnum=`cat $infoDir/devnum` || continue echo $targetDevice $majMinDevNums `lsusb -s $busnum:$devnum` done