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