gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-users] gpsd and cold plugging


From: Bjørn Forsman
Subject: Re: [gpsd-users] gpsd and cold plugging
Date: Thu, 24 Apr 2014 22:43:38 +0200

On 22 April 2014 11:27, Miroslav Lichvar <address@hidden> wrote:
> On Tue, Mar 18, 2014 at 10:30:39PM +0100, Bjørn Forsman wrote:
>> When the system starts after power-on, the hot (cold?) plug event for
>> the GPS arrives before systemd has started listening on the gpsd
>> sockets. That means gpsdctl (invoked by the gpsd udev rules) thinks it
>> needs to spawn a gpsd instance. But according to systemd / udev
>> documentation[udev], spawning long-running daemons from udev RUN+=
>> directives is not OK:
>
> I guess you already found an answer elsewhere, but I thought I'd post
> what I did in the Fedora package to fix this problem.

No, I didn't find an answer elsewhere, because I stopped looking after
I sent this message. Thanks for replying!

> The only
> solution I found that works reliably with both cold and hot plug was
> to create a service template for gpsdctl and modify the udev rules to
> set ENV{SYSTEMD_WANTS}="address@hidden" instead of running gpsdctl
> directly from udev.
>
> Here is the gpsdctl service:
> http://pkgs.fedoraproject.org/cgit/gpsd.git/plain/gpsdctl.service

Interesting. I'm not that familiar with systemd unit templates, but
it's good to know you found a way.

Hm, could you post your solution/patch to the mailing list, and
possibly make it a part of the next release?

>> I was thinking that the solution to this race between cold plug events
>> and systemd socket listening must simply be to let gpsd do an initial
>> scan of GPSs itself, when it starts. And stop gpsdctl from ever
>> spawning gpsd, because systemd already has that covered (socket based
>> activation).
>
> How would gpsd know which serial devices it should try to open? It
> would have to have some configuration file with a list of IDS, which
> are now in the udev file.

I didn't think of this before, but yes, a config file with a list of
supported VID/PIDs would be needed. And with that config file in
place, the udev rule file wouldn't need VID/PID filters anymore; all
GPS / serial devices could be added/forwarded directly to gpsd, which
in turn would only start monitoring devices that are listed in the
config file.

>> Having gpsd do the scan itself would also make restarting
>> it Just Work, unlike the current situation where I have to re-plug my
>> GPS after restarting gpsd.
>
> Yeah, that would be nice. You can trigger an udev event manually with
> "udevadm trigger --sysname-match=ttyUSB0 --action add", but something
> that would add automatically all devices controlled by the previous
> gpsd instance would be a nice improvement.

Thanks, I didn't know that.

I guess this means I'll have to write some patches for gpsd, to get
proper coldplug support and make gpsd handle already plugged in
devices. Unless someone beats me to it :-D

Best regards,
Bjørn Forsman



reply via email to

[Prev in Thread] Current Thread [Next in Thread]