Obviously, the best solution here is support from upstream gpsd. But I
have a couple of suggestions which may help you work-around that lack of
support.

On Wed, 07 Jun 2017 08:58:14 +0200 Benoit Panizzon <paniz...@woody.ch>
wrote:
> Unfortunately the modem resets itself when the serial device is closed. So 
> you cannot use minicom or a
> script to put the modem in GPS Mode and then start gpsd.

What if your script forks and sleeps for a while, such that gpsd has
opened the serial port before your script quits?

Something like this, in the sysvinit style:
script_to_initialize_modem &
sleep LONG_ENOUGH_FOR_INITIALIZATION
start-stop-daemon ... gpsd ...

script_to_initialize_modem does this:
  open the serial port
  send the data
  sleep LONG_ENOUGH_FOR_GPSD_TO_START

With systemd, you'd probably want to do something like:
1) A separate service for the initialize script, which is
WantedBy=gpsd.service
2) To stall gpsd's startup long enough for your script to have
initialized the device, create a drop-in like
/etc/systemd/system/gpsd.service.d/delay.conf with this:
    ExecStartPre=/bin/sleep N

> Also when gpsd would close the connection
> because no client is connected, this would reset the modem.

Try passing the -n flag to gpsd by adding it to GPSD_OPTIONS in
/etc/default/gpsd. This should cause gpsd to keep the serial port open
even with no clients.

-- 
Richard

Reply via email to