#!/bin/bash
echo `date`" Attached $1 $2" >> /tmp/usb_hid.log
#env >>/tmp/usb_hid.log
export PATH=/bin:/usr/bin:/sbin

if ps auxw | egrep 'X :0|Xorg' | grep -qv grep ;
then
  cd /opt/euro-beta
  USB_VENDOR_PRODUCT="$ID_VENDOR_ID:$ID_MODEL_ID"
  echo " vendor product: $USB_VENDOR_PRODUCT" >>/tmp/usb_hid.log
  egrep -q "^$USB_VENDOR_PRODUCT" input_filter.conf || exit 0
  echo "going to reinit input filter" >>/tmp/usb_hid.log
  echo "sleep 3; DISPLAY=:0 systools/set_hid_filter >> /tmp/usb_hid.log 2>&1" | at now
fi
