summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2006-08-14 06:40:01 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2006-08-14 06:40:01 +0000
commitfed00126cfcbb0330a20f4d073034cfe52352a61 (patch)
treed60e4beb6a1c3b1409ae8aa94a448337933019f9 /sci-geosciences/gpsd
parentAdded ~ppc (diff)
downloadgentoo-2-fed00126cfcbb0330a20f4d073034cfe52352a61.tar.gz
gentoo-2-fed00126cfcbb0330a20f4d073034cfe52352a61.tar.bz2
gentoo-2-fed00126cfcbb0330a20f4d073034cfe52352a61.zip
Fix bug #132288 and also two other hotplug issues that I personally ran into. The patches have been submitted upstream.
(Portage version: 2.1.1_pre4-r3)
Diffstat (limited to 'sci-geosciences/gpsd')
-rw-r--r--sci-geosciences/gpsd/ChangeLog10
-rw-r--r--sci-geosciences/gpsd/files/digest-gpsd-2.33-r13
-rw-r--r--sci-geosciences/gpsd/files/gpsd-2.33-duplicate-device-add-hang.patch26
-rw-r--r--sci-geosciences/gpsd/files/gpsd-2.33-hotplug-background-fix.patch54
-rw-r--r--sci-geosciences/gpsd/gpsd-2.33-r1.ebuild135
5 files changed, 227 insertions, 1 deletions
diff --git a/sci-geosciences/gpsd/ChangeLog b/sci-geosciences/gpsd/ChangeLog
index 26e9b1c45d09..1cc34254f561 100644
--- a/sci-geosciences/gpsd/ChangeLog
+++ b/sci-geosciences/gpsd/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for sci-geosciences/gpsd
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sci-geosciences/gpsd/ChangeLog,v 1.18 2006/07/18 06:09:06 nerdboy Exp $
+# $Header: /var/cvsroot/gentoo-x86/sci-geosciences/gpsd/ChangeLog,v 1.19 2006/08/14 06:40:01 robbat2 Exp $
+
+*gpsd-2.33-r1 (14 Aug 2006)
+
+ 14 Aug 2006; Robin H. Johnson <robbat2@gentoo.org>
+ +files/gpsd-2.33-duplicate-device-add-hang.patch,
+ +files/gpsd-2.33-hotplug-background-fix.patch, +gpsd-2.33-r1.ebuild:
+ Fix bug #132288 and also two other hotplug issues that I personally ran
+ into. The patches have been submitted upstream.
18 Jul 2006; Steve Arnold <nerdboy@gentoo.org> -gpsd-2.31.ebuild,
gpsd-2.32.ebuild:
diff --git a/sci-geosciences/gpsd/files/digest-gpsd-2.33-r1 b/sci-geosciences/gpsd/files/digest-gpsd-2.33-r1
new file mode 100644
index 000000000000..3ebb820ad471
--- /dev/null
+++ b/sci-geosciences/gpsd/files/digest-gpsd-2.33-r1
@@ -0,0 +1,3 @@
+MD5 03b57754091e4a34e27c78e1dc35c55e gpsd-2.33.tar.gz 639348
+RMD160 175b90cb8dda1d85964078a4f14cec84b0cc4885 gpsd-2.33.tar.gz 639348
+SHA256 e6a055689ad05f6adba7dbb9490891a18a240d1a30e34424b3a034f4152f2c28 gpsd-2.33.tar.gz 639348
diff --git a/sci-geosciences/gpsd/files/gpsd-2.33-duplicate-device-add-hang.patch b/sci-geosciences/gpsd/files/gpsd-2.33-duplicate-device-add-hang.patch
new file mode 100644
index 000000000000..5e3d957a478a
--- /dev/null
+++ b/sci-geosciences/gpsd/files/gpsd-2.33-duplicate-device-add-hang.patch
@@ -0,0 +1,26 @@
+If you try to add the same device twice with the hotplug script, gpsd does not
+send any error back to the script, leading to it waiting forever on recv(), and
+blocking gpsd from progressing in it's select loop.
+
+This patch makes the daemon write back an error to the control socket (in
+addition the the normal debug output), so that the hotplug script does not
+block for the socket, and everything proceeds much better.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar --exclude '*~' gpsd-2.33.orig/gpsd.c gpsd-2.33/gpsd.c
+--- gpsd-2.33.orig/gpsd.c 2006-06-09 05:34:09.000000000 -0700
++++ gpsd-2.33/gpsd.c 2006-08-13 15:42:25.152204904 -0700
+@@ -1048,9 +1048,10 @@
+ (void)write(sfd, "ERROR\n", 6);
+ } else if (buf[0] == '+') {
+ p = snarfline(buf+1, &stash);
+- if (find_device(stash))
++ if (find_device(stash)) {
+ gpsd_report(1,"<= control(%d): %s already active \n", sfd, stash);
+- else {
++ (void)write(sfd, "ERROR\n", 6);
++ } else {
+ gpsd_report(1,"<= control(%d): adding %s \n", sfd, stash);
+ if (open_device(stash))
+ (void)write(sfd, "OK\n", 3);
diff --git a/sci-geosciences/gpsd/files/gpsd-2.33-hotplug-background-fix.patch b/sci-geosciences/gpsd/files/gpsd-2.33-hotplug-background-fix.patch
new file mode 100644
index 000000000000..03963ed6e5b8
--- /dev/null
+++ b/sci-geosciences/gpsd/files/gpsd-2.33-hotplug-background-fix.patch
@@ -0,0 +1,54 @@
+In recent versions of udev, the gpsd script runs in series with the task that
+creates the real /dev/ttyUSB0 device node. Unfortuntely, the gpsd script runs
+BEFORE the creation of the node, and the node is not created until after you
+kill the gpsd script, because the gpsd script waits forever for the node to
+appear.
+
+This is a race condition, and is best fixed by running the actual wait/hotplug
+portion in the background.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar --exclude '*~' gpsd-2.33.orig/gpsd.hotplug gpsd-2.33/gpsd.hotplug
+--- gpsd-2.33.orig/gpsd.hotplug 2005-06-27 11:53:00.000000000 -0700
++++ gpsd-2.33/gpsd.hotplug 2006-08-13 18:35:03.382383884 -0700
+@@ -56,7 +56,7 @@
+ return action
+
+ def hotplug(action, devpath):
+- #syslog.syslog("ACTION=%s" % action)
++ #syslog.syslog("ACTION=%s DEVPATH=%s" % (action,devpath))
+ if not devpath:
+ syslog.syslog("No device")
+ else:
+@@ -88,16 +88,18 @@
+ return
+
+ if __name__ == '__main__':
+- syslog.openlog('gpsd.hotplug', 0, syslog.LOG_DAEMON)
+- try:
+- if len(sys.argv) == 1: # Called as hotplug script
+- hotplug(os.getenv("ACTION"), os.getenv("DEVPATH"))
+- else: # Called by hand for testing
+- gpsd_control(sys.argv[1], sys.argv[2])
+- except:
+- (exc_type, exc_value, exc_traceback) = sys.exc_info()
+- syslog.syslog("gpsd.hotplug: exception %s yields %s" % (exc_type, exc_value))
+- raise exc_type, exc_value, exc_traceback
+- #syslog.syslog("gpsd.hotplug ends")
+- syslog.closelog()
++ pid = os.fork()
++ if not pid:
++ syslog.openlog('gpsd.hotplug', 0, syslog.LOG_DAEMON)
++ try:
++ if len(sys.argv) == 1: # Called as hotplug script
++ hotplug(os.getenv("ACTION"), os.getenv("DEVPATH"))
++ else: # Called by hand for testing
++ gpsd_control(sys.argv[1], sys.argv[2])
++ except:
++ (exc_type, exc_value, exc_traceback) = sys.exc_info()
++ syslog.syslog("gpsd.hotplug: exception %s yields %s" % (exc_type, exc_value))
++ raise exc_type, exc_value, exc_traceback
++ #syslog.syslog("gpsd.hotplug ends")
++ syslog.closelog()
+
diff --git a/sci-geosciences/gpsd/gpsd-2.33-r1.ebuild b/sci-geosciences/gpsd/gpsd-2.33-r1.ebuild
new file mode 100644
index 000000000000..89de2c29b0fe
--- /dev/null
+++ b/sci-geosciences/gpsd/gpsd-2.33-r1.ebuild
@@ -0,0 +1,135 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sci-geosciences/gpsd/gpsd-2.33-r1.ebuild,v 1.1 2006/08/14 06:40:01 robbat2 Exp $
+
+inherit eutils libtool distutils
+
+DESCRIPTION="GPS daemon and library to support USB/serial GPS devices and various GPS/mapping clients."
+HOMEPAGE="http://gpsd.berlios.de/"
+SRC_URI="http://download.berlios.de/gpsd/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~ppc ~ppc64 ~sparc ~x86"
+
+IUSE="dbus ntp static usb X"
+
+RDEPEND="X? ( || (
+ ( x11-libs/libXmu
+ x11-libs/libXext
+ x11-libs/libXp
+ x11-libs/libX11
+ x11-libs/libXt
+ x11-libs/libSM
+ x11-libs/libICE
+ x11-libs/libXpm
+ x11-libs/libXaw )
+ || (
+ x11-libs/openmotif
+ x11-libs/lesstif
+ )
+ ( virtual/motif
+ virtual/x11 )
+ )
+ )
+ dev-lang/python
+ app-text/xmlto
+ dbus? ( >=sys-apps/dbus-0.6 )
+ ntp? ( net-misc/ntp )
+ usb? ( sys-apps/hotplug )"
+
+DEPEND="${RDEPEND}
+ X? ( || (
+ ( x11-proto/xproto x11-proto/xextproto )
+ virtual/x11
+ )
+ )"
+
+RESTRICT="test"
+
+src_unpack() {
+ unpack ${A}
+ epatch ${FILESDIR}/${P}-duplicate-device-add-hang.patch
+ epatch ${FILESDIR}/${P}-hotplug-background-fix.patch
+ cd ${S}
+ elibtoolize
+}
+
+src_compile() {
+ distutils_python_version
+
+ local my_conf="--enable-shared"
+
+ if ! use static; then
+ my_conf="${my_conf} --with-pic --disable-static"
+ else
+ my_conf="${my_conf} --enable-static"
+ fi
+
+ if ! use ntp; then
+ my_conf="${my_conf} --disable-ntpshm"
+ fi
+
+ econf ${my_conf} $(use_with X x) $(use_enable dbus) \
+ || die "econf failed"
+
+ emake LDFLAGS="${LDFLAGS} -lm" || die "emake failed"
+}
+
+src_install() {
+ cd ${S}
+ make DESTDIR=${D} install
+
+ if use usb ; then
+ sed -i -e "s/gpsd.hotplug/gpsd/g" gpsd.hotplug gpsd.usermap
+ insinto /etc/hotplug/usb
+ doins gpsd.usermap
+ exeinto /etc/hotplug/usb
+ newexe gpsd.hotplug gpsd
+ keepdir /var/run/usb # needed for REMOVER
+ else
+ newconfd ${FILESDIR}/gpsd.conf gpsd
+ newinitd ${FILESDIR}/gpsd.init gpsd
+ fi
+ if use X ; then
+ insinto /etc/X11/app-defaults
+ newins xgps.ad Xgps
+ newins xgpsspeed.ad Xgpsspeed
+ fi
+ dobin logextract
+ diropts "-m0644"
+ exeinto /usr/$(get_libdir)/python${PYVER}/site-packages
+ doexe gps.py gpsfake.py
+ dodoc AUTHORS HACKING INSTALL README TODO ${FILESDIR}/40-usb-serial.rules
+}
+
+pkg_postinst() {
+ einfo "To use hotplugging (USB devices) your kernel has to be compiled"
+ einfo "with CONFIG_HOTPLUG enabled and sys-apps/hotplug must be emerged"
+ einfo "(both usb and dbus support are optional)."
+ einfo
+ einfo "Different GPS devices require the corresponding kernel options"
+ einfo "to be enabled, such as USB_SERIAL_GARMIN, or a USB serial driver"
+ einfo "for an adapter such as those that come with Deluo GPS units (eg,"
+ einfo "USB_SERIAL_PL2303). Straight serial devices should always work,"
+ einfo "even without hotplug support."
+ ewarn
+ ewarn "If your client connection shows no data when gpsd is started via"
+ ewarn "the normal hotplug action, then kill the existing gpsd process"
+ ewarn "and try starting it directly via something like:"
+ ewarn "sudo /usr/sbin/gpsd -p /dev/ttyUSB0"
+ ewarn "or whatever your device is. This will verify whether your device"
+ ewarn "is working or not."
+ ewarn
+ einfo "Read the INSTALL doc for more information on supported hardware,"
+ einfo "and make sure udev has the right group permissions set on the tty"
+ einfo "devices if using USB (it should Do The Right Thing (TM))..."
+ einfo
+ einfo "Finally, the default gpsd setup looks for /dev/ttyUSB0, in the"
+ einfo "case of the USB-serial adapter mentioned above. Depending on"
+ einfo "your default device scheme (ie, udev, devfs, static), you may"
+ einfo "need to create a device alias if the default name is different."
+ einfo "A udev rule file has been provided with an example rule in the"
+ einfo "docs directory. If the device names are correct, gpsd will"
+ einfo "start automatically when the GPS device is plugged in."
+}