X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=recipes-navigation%2Fgpsd%2Fgpsd%2Fsw-device-hook;fp=recipes-navigation%2Fgpsd%2Fgpsd%2Fsw-device-hook;h=e1e6f7a41a403e3e814efde768f8309ecffa93de;hb=41591d4f8c586aa801220fac0924556f406c58bd;hp=0000000000000000000000000000000000000000;hpb=4830bcef14e7f49cdc851c646a69c9bb9bd92e82;p=AGL%2Fmeta-agl-demo.git diff --git a/recipes-navigation/gpsd/gpsd/sw-device-hook b/recipes-navigation/gpsd/gpsd/sw-device-hook new file mode 100644 index 000000000..e1e6f7a41 --- /dev/null +++ b/recipes-navigation/gpsd/gpsd/sw-device-hook @@ -0,0 +1,23 @@ +#!/bin/sh + +# Figure out the parent usb device +USBDEV=`ls -l "$1" |sed -ne 's!^c[^ ]* [0-9]* [^ ]* [^ ]* \([0-9]*\), \([0-9]*\) .*!/sys/dev/char/\1:\2/device/../..!p'` + +# Silently ignore any non-USB ports +if [ ! -r "$USBDEV/idVendor" ] || [ ! -r "$USBDEV/idProduct" ]; then + exit 0 +fi + +VID=`cat "$USBDEV/idVendor"` +PID=`cat "$USBDEV/idProduct"` +case "$2" in + ACTIVATE) CMD=START ;; + *) CMD=STOP ;; +esac + +case "$VID:$PID" in + "1199:9071"|"1199:9079") echo \$GPS_$CMD >"$1" ;; + *) ;; +esac + +exit 0