On Sat, 2005-11-12 at 12:22 +0100, Marco d'Itri wrote:
> Package: gpsd
> Version: 2.28-2
> Severity: important
>
> Your package installs files in the /etc/hotplug/usb/ directory, but
> does not provide an udev rules file. The /etc/hotplug/usb/ interface has
> been obsolete for a long time and is not supported by udev.
Hi Marco,
thanks for your report. I finally get round to prepare a new upload with
udev support.
> For more information about this you can look at the debian-devel@
> threads of last october.
> The libgphoto2 package is a good example of how to provide udev support,
> please let me know if you have any doubts.
> I will also be happy to review your changes before they are uploaded, if
> you want.
I'd be glad if you could have a look at my changes. All changes related
to udev are attached as a diff; the package itself is at
<http://www.subnetz.org/~til/gpsd-preview/>.
> I also noticed that the script installed by your package uses python.
> Please remember that udev RUN rules are run at the very beginning of the
> boot process, where /usr may not be available.
> You probably need to use a wrapper shell script which waits for /usr to
> appear, /lib/udev/hotplug.functions provides a wait_for_file function
> you could use for this.
I assume /lib/udev/hotplug.functions is not guarenteed to be around on
other distributions? I want to pass my changes upstream, so I don't
source /lib/udev/hotplug.functions, but duplicate the wait_for_file
function.
Cheers, Til
Index: debian/gpsd.postinst
===================================================================
--- debian/gpsd.postinst (revision 436)
+++ debian/gpsd.postinst (working copy)
@@ -7,6 +7,13 @@
if [ "$1" = "configure" ] ; then
+ # udev: install symlink to gpsd.rules
+ # udev handling got introduced in 2.32-2 - only create symlink once
+ # on new package install or when upgrading from an older version
+ if dpkg --compare-versions "$2" lt "2.32-2" ; then
+ ln -sf ../gpsd.rules /etc/udev/rules.d/025_gpsd.rules
+ fi
+
# generate /etc/default/gpsd
db_get gpsd/device
DEVICES=$RET
Index: debian/control
===================================================================
--- debian/control (revision 435)
+++ debian/control (working copy)
@@ -9,7 +9,7 @@
Architecture: any
Depends: netbase, ${shlibs:Depends}, ${misc:Depends}
Recommends: gpsd-clients, python (>= 2.3)
-Suggests: hotplug
+Suggests: udev
Description: GPS (Global Positioning System) service daemon
gpsd is a userland daemon acting as a liaison between a GPS or
Loran-C receiver and clients. The receiver is expected to generate
Index: debian/gpsd.postrm
===================================================================
--- debian/gpsd.postrm (revision 435)
+++ debian/gpsd.postrm (working copy)
@@ -14,6 +14,7 @@
purge)
[ -f /etc/default/gpsd ] && rm /etc/default/gpsd
+ [ -f /etc/udev/rules.d/025_gpsd.rules ] && rm /etc/udev/rules.d/025_gpsd.rules
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
Index: debian/gpsd.rules
===================================================================
--- debian/gpsd.rules (revision 0)
+++ debian/gpsd.rules (revision 0)
@@ -0,0 +1,18 @@
+# udev rules for gpsd
+#
+# GPSes don't have their own USB device class. They're serial-over-USB
+# devices, so what you see is actually the ID of the serial-over-USB chip.
+# Fortunately, just two of these account for over 80% of consumer-grade
+# GPS sensors. The gpsdplug script will tell a running gpsd that it should
+# look at the device that just went active, because it might be a GPS.
+
+# Prolific Technology, Inc. PL2303 Serial Port
+SUBSYSTEM=="tty", SYSFS{idVendor}=="067b", SYSFS{idProduct}=="2303", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper"
+# ATEN International Co., Ltd UC-232A Serial Port [pl2303]
+SUBSYSTEM=="tty", SYSFS{idVendor}=="0557", SYSFS{idProduct}=="2008", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper"
+# FTDI 8U232AM
+SUBSYSTEM=="tty", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6001", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper"
+# Cypress M8/CY7C64013 (DeLorme uses these)
+SUBSYSTEM=="tty", SYSFS{idVendor}=="1163", SYSFS{idProduct}=="0100", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper"
+# PS-360 OEM (Microsoft GPS sold with Street and Trips 2005)
+SUBSYSTEM=="tty", SYSFS{idVendor}=="067b", SYSFS{idProduct}=="aaa0", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper"
Index: debian/changelog
===================================================================
--- debian/changelog (revision 436)
+++ debian/changelog (working copy)
@@ -1,5 +1,7 @@
gpsd (2.32-2) unstable; urgency=low
+ * switch from obsolete hotplug to udev interface, thanks to Marco d'Itri
+ (closes #338745)
* debian/patches/:
- add 17_gpsd_manpage_section.dpatch
* debian/gpsd.postinst:
Index: debian/patches/18_gpsd.hotplug_location.dpatch
===================================================================
--- debian/patches/18_gpsd.hotplug_location.dpatch (revision 0)
+++ debian/patches/18_gpsd.hotplug_location.dpatch (revision 0)
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 18_gpsd.hotplug_location.dpatch by Tilman Koschnick <[EMAIL PROTECTED]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Adjust WHEREAMI variable in gpsd.hotplug.
+
[EMAIL PROTECTED]@
+diff -urNad gpsd~/gpsd.hotplug gpsd/gpsd.hotplug
+--- gpsd~/gpsd.hotplug 2006-04-16 17:53:15.000000000 +0200
++++ gpsd/gpsd.hotplug 2006-04-30 14:34:19.340091662 +0200
+@@ -6,7 +6,7 @@
+ import sys, time, os, syslog, glob, socket, stat
+
+ CONTROL_SOCKET = "/var/run/gpsd.sock"
+-WHEREAMI = "/etc/hotplug/usb/gpsd.hotplug"
++WHEREAMI = "/lib/udev/gpsd.hotplug"
+
+ def gpsd_control_connect():
+ "Acquire a connection to the GPSD control socket."
Property changes on: debian/patches/18_gpsd.hotplug_location.dpatch
___________________________________________________________________
Name: svn:executable
+ *
Index: debian/patches/00list
===================================================================
--- debian/patches/00list (revision 435)
+++ debian/patches/00list (working copy)
@@ -2,3 +2,4 @@
08_default_units
16_fix_manpages
17_gpsd_manpage_section
+18_gpsd.hotplug_location
Index: debian/rules
===================================================================
--- debian/rules (revision 435)
+++ debian/rules (working copy)
@@ -75,8 +75,10 @@
mv debian/gpsd/usr/sbin/gpsd debian/gpsd/usr/bin/
rmdir debian/gpsd/usr/sbin
- # install hotplug stuff
- dh_install gpsd.hotplug gpsd.usermap etc/hotplug/usb/
+ # install udev stuff
+ dh_install debian/gpsd.rules etc/udev/
+ dh_install debian/gpsd.hotplug.wrapper lib/udev/
+ dh_install gpsd.hotplug lib/udev/
# install python stuff
dh_install debian/gpsd.pth usr/lib/python2.3/site-packages/
Index: debian/gpsd.hotplug.wrapper
===================================================================
--- debian/gpsd.hotplug.wrapper (revision 0)
+++ debian/gpsd.hotplug.wrapper (revision 0)
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+wait_for_python() {
+ local count=300
+ while [ $count != 0 ]; do
+ [ -e /usr/bin/python ] && return 0
+ sleep 1
+ count=$(($count - 1))
+ done
+}
+
+wait_for_python && /lib/udev/gpsd.hotplug "$ACTION" "$DEVNAME"
Property changes on: debian/gpsd.hotplug.wrapper
___________________________________________________________________
Name: svn:executable
+ *
Index: debian/gpsd.README.Debian
===================================================================
--- debian/gpsd.README.Debian (revision 435)
+++ debian/gpsd.README.Debian (working copy)
@@ -9,9 +9,9 @@
binary is located in /usr/sbin and is most likely not in the search PATH of
normal users.
-- through the hotplug interface
+- through the udev interface
- This works with some USB GPS devices, listed in /etc/hotplug/usb/gpsd.usermap.
+ This works with some USB GPS devices, listed in /etc/udev/gpsd.rules.
- as a service