lomoco-1.0-updated-udev.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. $1 ~ /0xc[a-f0-9][a-f0-9][a-f0-9]/ {
  22. print "# " substr($3, index($3, "\"")) ", " $2
  23. - print "SYSFS{idProduct}==\"" substr($1, index($1, "x")+1) \
  24. + print "ATTRS{idVendor}==\"046d\", ATTRS{idProduct}==\"" substr($1, index($1, "x")+1) \
  25. "\", RUN=\"lomoco\""
  26. }
  27. diff --git a/udev/udev.lomoco b/udev/udev.lomoco
  28. index 9e55511..da896d9 100755
  29. --- a/udev/udev.lomoco
  30. +++ b/udev/udev.lomoco
  31. @@ -1,26 +1,36 @@
  32. -#!/bin/bash
  33. -
  34. -case "$DEVPATH" in
  35. - *usbdev*.*)
  36. - dev=${DEVPATH##*usbdev}
  37. - bus=$(printf %03d ${dev%.*})
  38. - dev=$(printf %03d ${dev#*.})
  39. -
  40. - . /etc/sysconfig/logitech_mouse
  41. -
  42. - options=
  43. -
  44. - if [ -n "$LOGITECH_MOUSE_RESOLUTION" ]; then
  45. - options="--$LOGITECH_MOUSE_RESOLUTION"
  46. - fi
  47. -
  48. - if [ -z "$LOGITECH_MOUSE_DISABLE_CC" -o "$LOGITECH_MOUSE_DISABLE_CC" = yes ]; then
  49. - options="$options --no-sms"
  50. - fi
  51. -
  52. - if [ -n "$options" ]; then
  53. - /usr/bin/lomoco -b $bus -d $dev $options
  54. - fi
  55. - ;;
  56. -esac 2>&1 | /bin/logger -t lomoco
  57. -
  58. +#!/bin/sh
  59. +#
  60. +# udev helper script for the locomo utility
  61. +#
  62. +
  63. +test -x /usr/bin/lomoco || exit 0
  64. +test -r /etc/lomoco.conf || exit 0
  65. +
  66. +options=
  67. +. /etc/lomoco.conf
  68. +
  69. +if [ -n "$LOGITECH_MOUSE_RESOLUTION" ]; then
  70. + options="--$LOGITECH_MOUSE_RESOLUTION"
  71. +fi
  72. +
  73. +if [ -z "$LOGITECH_MOUSE_DISABLE_CC" -o "$LOGITECH_MOUSE_DISABLE_CC" = yes ]; then
  74. + options="$options --no-sms"
  75. +fi
  76. +
  77. +if [ -n "$BUSNUM" ]; then
  78. + options="$options -b $BUSNUM"
  79. +fi
  80. +
  81. +if [ -n "$DEVNUM" ]; then
  82. + options="$options -d $DEVNUM"
  83. +fi
  84. +
  85. +if [ -n "$MODEL_ID" ]; then
  86. + options="$options -p $MODEL_ID"
  87. +fi
  88. +
  89. +if [ -n "$options" ]; then
  90. + /usr/bin/lomoco $options 2>&1 | \
  91. + sed -e 's/^[[:blank:]]\+//' -e 's/ \+$//' -e '/^$/ d' | \
  92. + logger -t lomoco -p daemon.info
  93. +fi