The udev rules provided with sci-geosciences/gpsd-2.37 propagate device add events for USB GPS receivers to gpsd, but fail to propagate device remove events. This can cause reconnection failures on a system with a single GPS receiver that is occasionally removed and re-attached. If the receiver was initially allocated ttyUSB0, is unplugged, and then replugged before ttyUSB0 becomes available again, the receiver will be attached to ttyUSB1 instead. The hotplug script will then request gpsd to open ttyUSB1 as a second GPS receiver and gpsd will be configured to monitor two devices -- one of which it will never be able to open. This prevents gpsd from reattaching listening clients. Worse, since ttyUSB1 was added more recently, gpsd will favor it for new clients, and if the GPS receiver is subsequently reattached to ttyUSB0, new clients will be unable to use the GPS at all. I'm not sure what causes ttyUSBX devices to become reusable, but the skew from ttyUSB0 to ttyUSB1 is very easy to reproduce. Reproducible: Always These are my replacement udev rules that seem to work: SUBSYSTEM=="tty", ACTION=="add", KERNEL=="ttyUSB[0-9]*", SYMLINK="gps%n", RUN+="/etc/hotplug/usb/gpsd.hotplug add $root/%k" SUBSYSTEM=="tty", ACTION=="remove", KERNEL=="ttyUSB[0-9]*", RUN+="/etc/hotplug/usb/gpsd.hotplug remove $root/%k"
Thanks for the proposed fix, assigning to maintainer (hi nerdboy :) )
Yeah, the "remove" rules are a good idea. I integrated them with the current rules, and added the known device IDs. It works fine with my cheap USB device, but it also does the same thing with (non-GPS) usb-serial converter. Oh well... Thanks; now updated and time to see if there's a new version out...