diff options
author | Brian Cully <bjc@kublai.com> | 2019-08-11 19:01:34 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2019-08-11 19:01:34 -0400 |
commit | 7fdc6a2c1b5799221f5d89d5f935cfe7dad4ccd2 (patch) | |
tree | 3ac13da04997361ddb688d2f666298d075aa14e2 /usb/find-serial-port | |
parent | cceebb087a7a8afc41e0523f6e98be2301ff3af1 (diff) | |
download | bleusb-7fdc6a2c1b5799221f5d89d5f935cfe7dad4ccd2.tar.gz bleusb-7fdc6a2c1b5799221f5d89d5f935cfe7dad4ccd2.zip |
Move usb controller stuff to usb directory.
Diffstat (limited to 'usb/find-serial-port')
-rwxr-xr-x | usb/find-serial-port | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/usb/find-serial-port b/usb/find-serial-port new file mode 100755 index 0000000..62e2c0c --- /dev/null +++ b/usb/find-serial-port @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ $# -ne 2 ]; then + echo "Usage: $0 vid pid" >&2 + exit 1 +fi + +prefix=/dev/serial/by-id + +for dev in `ls $prefix`; do + if [ `udevadm info -q property --name $prefix/$dev | egrep -i "ID_VENDOR_ID=($1)|ID_MODEL_ID=($2)" | wc -l` -eq 2 ]; then + echo `readlink -f $prefix/$dev` + exit 0 + fi +done +exit 2 |