Opened 5 years ago

#12460 new defect

gpsd hotplug.d bug

Reported by: anonymous Owned by: developers
Priority: low Milestone: Chaos Calmer 15.05
Component: packages Version: Trunk
Keywords: gpsd gps serial pl2303 com tty ttyusb usb hotplug Cc:


There's a gpsd script in "/etc/hotplug.d/usb/20-gpsd" which starts "gpsd" if a new usb-serial-device is detected.

This script contains the following line of code:

sleep 3 && /etc/init.d/gpsd start

Unfortunately the entire script halts at "sleep 3" and stops some other things which need to be done in order to properly set up /dev/ttyUSB0.
The result: gpsd starts and immediately dies because it cant find /dev/ttyUSB0. (Because it started before hotplug finished its work.)

When I change the line to this, everything works fine.

sleep 1 && /etc/init.d/gpsd start > /dev/null 2>&1 &

Probably just a "&" behind "start" is enough too, but I use this just to be sure.
(If I remember correctly: 2>&1 pipes stderr to stdout, which here is /dev/null.)

Shell runs that line, sees the & and immediately continues to set up ttyUSB0 instead of stopping to sleep for 3 seconds. Then it has 1 second (which seems to be more than enough) to do stuff, before gpsd finally starts - now without any error.

Attachments (0)

Change History (0)

Add Comment

Modify Ticket

as new .

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.