Add function to list usb devices in english, remove replay
This commit is contained in:
parent
bbc3c5f0a6
commit
b398bab13b
@ -78,14 +78,16 @@ ff() { #find file
|
|||||||
# Search for a file by its name and edit it
|
# Search for a file by its name and edit it
|
||||||
# Usage: vf <filename> (optional) <max depth>
|
# Usage: vf <filename> (optional) <max depth>
|
||||||
vf() { vim "$(ff "$@" | fzf)"; }
|
vf() { vim "$(ff "$@" | fzf)"; }
|
||||||
# Usage: replay <number of commands> to repeat. Blank for 1
|
#https://unix.stackexchange.com/questions/144029/command-to-determine-ports-of-a-device-like-dev-ttyusb0
|
||||||
replay() {
|
function list_usb() {
|
||||||
from="${1:-2}"
|
for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
|
||||||
to="${2:-1}"
|
(
|
||||||
if [ "$from" -ne "$to" ]; then
|
syspath="${sysdevpath%/dev}"
|
||||||
for i in `seq "$from" -1 "$(($to + 1))"`; do
|
devname="$(udevadm info -q name -p $syspath)"
|
||||||
printf "$(fc -ln -${i} -${i}) && "
|
[[ "$devname" == "bus/"* ]] && exit
|
||||||
|
eval "$(udevadm info -q property --export -p $syspath)"
|
||||||
|
[[ -z "$ID_SERIAL" ]] && exit
|
||||||
|
echo "$ID_SERIAL" | tr '_' ' '
|
||||||
|
)
|
||||||
done
|
done
|
||||||
fi
|
|
||||||
$(fc -ln -${to} -${to})
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user