| 1 |
diff --git a/udev/toudev.awk b/udev/toudev.awk
|
| 2 |
index 822421d..ada40e5 100644
|
| 3 |
--- a/udev/toudev.awk
|
| 4 |
+++ b/udev/toudev.awk
|
| 5 |
@@ -1,15 +1,20 @@
|
| 6 |
#!/bin/awk -f
|
| 7 |
BEGIN {
|
| 8 |
FS = ","
|
| 9 |
+ print "# udev.rules file for Logitech mouse control using lomoco"
|
| 10 |
+ print "#"
|
| 11 |
+ print ""
|
| 12 |
print "ACTION != \"add\", GOTO=\"lomoco_end\""
|
| 13 |
- print "SUBSYSTEM != \"usb\", GOTO=\"lomoco_end\""
|
| 14 |
- print "SYSFS{idVendor} != \"046d\", GOTO=\"lomoco_end\""
|
| 15 |
+ print "SUBSYSTEM == \"usb\", ENV{DEVTYPE}==\"usb_device\", GOTO=\"lomoco_start\""
|
| 16 |
+ print "SUBSYSTEM != \"usb_device\", GOTO=\"lomoco_end\""
|
| 17 |
+ print ""
|
| 18 |
+ print "LABEL=\"lomoco_start\""
|
| 19 |
print ""
|
| 20 |
}
|
| 21 |
|
| 22 |
$1 ~ /0xc[a-f0-9][a-f0-9][a-f0-9]/ {
|
| 23 |
print "# " substr($3, index($3, "\"")) ", " $2
|
| 24 |
- print "SYSFS{idProduct}==\"" substr($1, index($1, "x")+1) \
|
| 25 |
+ print "ATTRS{idVendor}==\"046d\", ATTRS{idProduct}==\"" substr($1, index($1, "x")+1) \
|
| 26 |
"\", RUN=\"lomoco\""
|
| 27 |
}
|
| 28 |
|
| 29 |
diff --git a/udev/udev.lomoco b/udev/udev.lomoco
|
| 30 |
index 9e55511..da896d9 100755
|
| 31 |
--- a/udev/udev.lomoco
|
| 32 |
+++ b/udev/udev.lomoco
|
| 33 |
@@ -1,26 +1,36 @@
|
| 34 |
-#!/bin/bash
|
| 35 |
-
|
| 36 |
-case "$DEVPATH" in
|
| 37 |
- *usbdev*.*)
|
| 38 |
- dev=${DEVPATH##*usbdev}
|
| 39 |
- bus=$(printf %03d ${dev%.*})
|
| 40 |
- dev=$(printf %03d ${dev#*.})
|
| 41 |
-
|
| 42 |
- . /etc/sysconfig/logitech_mouse
|
| 43 |
-
|
| 44 |
- options=
|
| 45 |
-
|
| 46 |
- if [ -n "$LOGITECH_MOUSE_RESOLUTION" ]; then
|
| 47 |
- options="--$LOGITECH_MOUSE_RESOLUTION"
|
| 48 |
- fi
|
| 49 |
-
|
| 50 |
- if [ -z "$LOGITECH_MOUSE_DISABLE_CC" -o "$LOGITECH_MOUSE_DISABLE_CC" = yes ]; then
|
| 51 |
- options="$options --no-sms"
|
| 52 |
- fi
|
| 53 |
-
|
| 54 |
- if [ -n "$options" ]; then
|
| 55 |
- /usr/bin/lomoco -b $bus -d $dev $options
|
| 56 |
- fi
|
| 57 |
- ;;
|
| 58 |
-esac 2>&1 | /bin/logger -t lomoco
|
| 59 |
-
|
| 60 |
+#!/bin/sh
|
| 61 |
+#
|
| 62 |
+# udev helper script for the locomo utility
|
| 63 |
+#
|
| 64 |
+
|
| 65 |
+test -x /usr/bin/lomoco || exit 0
|
| 66 |
+test -r /etc/lomoco.conf || exit 0
|
| 67 |
+
|
| 68 |
+options=
|
| 69 |
+. /etc/lomoco.conf
|
| 70 |
+
|
| 71 |
+if [ -n "$LOGITECH_MOUSE_RESOLUTION" ]; then
|
| 72 |
+ options="--$LOGITECH_MOUSE_RESOLUTION"
|
| 73 |
+fi
|
| 74 |
+
|
| 75 |
+if [ -z "$LOGITECH_MOUSE_DISABLE_CC" -o "$LOGITECH_MOUSE_DISABLE_CC" = yes ]; then
|
| 76 |
+ options="$options --no-sms"
|
| 77 |
+fi
|
| 78 |
+
|
| 79 |
+if [ -n "$BUSNUM" ]; then
|
| 80 |
+ options="$options -b $BUSNUM"
|
| 81 |
+fi
|
| 82 |
+
|
| 83 |
+if [ -n "$DEVNUM" ]; then
|
| 84 |
+ options="$options -d $DEVNUM"
|
| 85 |
+fi
|
| 86 |
+
|
| 87 |
+if [ -n "$MODEL_ID" ]; then
|
| 88 |
+ options="$options -p $MODEL_ID"
|
| 89 |
+fi
|
| 90 |
+
|
| 91 |
+if [ -n "$options" ]; then
|
| 92 |
+ /usr/bin/lomoco $options 2>&1 | \
|
| 93 |
+ sed -e 's/^[[:blank:]]\+//' -e 's/ \+$//' -e '/^$/ d' | \
|
| 94 |
+ logger -t lomoco -p daemon.info
|
| 95 |
+fi
|