diff options
author | Brian Cully <bjc@kublai.com> | 2019-08-04 15:33:03 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2019-08-04 19:58:34 -0400 |
commit | e02128bd4d9d2716b55be5db3dccb18f92f01e9c (patch) | |
tree | 8f74b58be72a31a257f11022454fc186060193a3 /find-serial-port | |
download | atsamd-usb-host-e02128bd4d9d2716b55be5db3dccb18f92f01e9c.tar.gz atsamd-usb-host-e02128bd4d9d2716b55be5db3dccb18f92f01e9c.zip |
Initial commit
Diffstat (limited to 'find-serial-port')
-rwxr-xr-x | find-serial-port | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/find-serial-port b/find-serial-port new file mode 100755 index 0000000..62e2c0c --- /dev/null +++ b/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 |