Karl Relton
2010-12-23 09:46:25 UTC
Dear friends
I've done some digging, and worked out that the device querying code in
udev-synce-serial is only necessary for trying to handle two-port
devices. I think this can be better handled in the udev rules, from
which we can launch udev-synce-serial only when required (i.e. on the
2nd port of a two port device), and thus remove all that logic from
udev-synce-serial itself.
That means udev-synce-serial no longer has to call udevadm or use a
library to interrogate the udev database, cutting a chunk of code.
The patch below does just that.
Regards
Karl
diff -Naur scripts.orig/85-synce.rules.in scripts/85-synce.rules.in
--- scripts.orig/85-synce.rules.in 2010-07-19 18:24:17.000000000 +0100
+++ scripts/85-synce.rules.in 2010-12-23 09:24:35.267741000 +0000
@@ -8,4 +8,18 @@
SUBSYSTEM=="net", DRIVERS=="rndis_host", ATTRS{bInterfaceClass}=="ef", ATTRS{bInterfaceSubClass}=="01", ATTRS{bInterfaceProtocol}=="01", ENV{pocketpc}="env-synce", RUN+="@UDEVDIR@/synce-udev-rndis"
# capabilities = serial, parent driver = ipaq
-SUBSYSTEM=="tty", DRIVERS=="ipaq", ENV{pocketpc}="env-synce", RUN+="@UDEVDIR@/synce-udev-serial"
+# If the device has more than one port, then we need to only use the last
+# one.
+#
I've done some digging, and worked out that the device querying code in
udev-synce-serial is only necessary for trying to handle two-port
devices. I think this can be better handled in the udev rules, from
which we can launch udev-synce-serial only when required (i.e. on the
2nd port of a two port device), and thus remove all that logic from
udev-synce-serial itself.
That means udev-synce-serial no longer has to call udevadm or use a
library to interrogate the udev database, cutting a chunk of code.
The patch below does just that.
Regards
Karl
diff -Naur scripts.orig/85-synce.rules.in scripts/85-synce.rules.in
--- scripts.orig/85-synce.rules.in 2010-07-19 18:24:17.000000000 +0100
+++ scripts/85-synce.rules.in 2010-12-23 09:24:35.267741000 +0000
@@ -8,4 +8,18 @@
SUBSYSTEM=="net", DRIVERS=="rndis_host", ATTRS{bInterfaceClass}=="ef", ATTRS{bInterfaceSubClass}=="01", ATTRS{bInterfaceProtocol}=="01", ENV{pocketpc}="env-synce", RUN+="@UDEVDIR@/synce-udev-rndis"
# capabilities = serial, parent driver = ipaq
-SUBSYSTEM=="tty", DRIVERS=="ipaq", ENV{pocketpc}="env-synce", RUN+="@UDEVDIR@/synce-udev-serial"
+# If the device has more than one port, then we need to only use the last
+# one.
+#