add support for input devices

This commit is contained in:
Martin Mueller
2008-06-27 20:02:07 +00:00
parent 618fb8779a
commit b9c04cad34
2 changed files with 33 additions and 0 deletions
@@ -12,3 +12,6 @@ BUS=="usb", SYSFS{idVendor}=="7070", GROUP="plugdev"
# FTDI 2232 parallel converter / Amontec JTAG-Tiny (access through libftdi)
BUS=="usb", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="cff8", GROUP="plugdev"
# make joysticks/gamepads readable on event interface (writeable for force feedback), see input_event.sh
KERNEL=="event*", IMPORT{program}="input_event.sh %p", NAME="input/%k", GROUP="plugdev", MODE="0640"
ENV{FF_DEVICE}=="1", MODE="0660"
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
# handle input/eventX devices for joystick devices
# copy it to /lib/udev/input_event.sh
# declarations from <linux/input>
EV_ABS=0x03
EV_FF=0x15
ABS_X=0x00
ABS_THROTTLE=0x06
ABS_WHEEL=0x08
ABS_ALL=$(( 1 << $ABS_X | 1 << $ABS_THROTTLE | 1 << $ABS_WHEEL))
# get capabilities from parent input device
parent=${1%%event*}
EV="0x$(< /sys${parent}capabilities/ev)"
ABS="0x$(< /sys${parent}capabilities/abs)"
if (( $EV & (1 << $EV_ABS) )) && (( $ABS & $ABS_ALL )); then
if (( $EV & (1 << $EV_FF) )); then
echo "FF_DEVICE=1";
else
echo "FF_DEVICE=0";
fi
exit 0
fi
# no joystick device
exit 1