diff options
author | Maciej S. Szmigiero <mail@maciej.szmigiero.name> | 2024-04-06 20:43:26 +0200 |
---|---|---|
committer | Dan Williams <dan@bigw.org> | 2024-04-09 15:00:52 +0000 |
commit | d3a2aebf16ac4a5cd3c57ee6077e68d1f9e552bd (patch) | |
tree | 56c715aad10e43b7f72a4293f0fbb00a11bfbf83 /src | |
parent | 19da7559c0ea888a8f1b9ad0eb1b77e3f358808f (diff) |
mbm: don't stop GPS interface on reinitialization if it should be running
Since commit 63dd4ad2 it is possible that the GPS interface is in use at
the time of modem reinitialization so it should not be stopped in such
case.
Otherwise "mmcli --location-status" will still say that GPS is enabled but
no GPS traces are going to be coming.
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/mbm/mm-broadband-modem-mbm.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/plugins/mbm/mm-broadband-modem-mbm.c b/src/plugins/mbm/mm-broadband-modem-mbm.c index 0c362a70..cdc2b255 100644 --- a/src/plugins/mbm/mm-broadband-modem-mbm.c +++ b/src/plugins/mbm/mm-broadband-modem-mbm.c @@ -1429,15 +1429,20 @@ setup_ports (MMBroadbandModem *_self) /* NMEA GPS monitoring */ gps_data_port = mm_base_modem_peek_port_gps (MM_BASE_MODEM (self)); if (gps_data_port) { - /* make sure GPS is stopped incase it was left enabled */ - mm_base_modem_at_command_full (MM_BASE_MODEM (self), - mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)), - "AT*E2GPSCTL=0", - 3, FALSE, FALSE, NULL, NULL, NULL); - /* Add handler for the NMEA traces */ - mm_port_serial_gps_add_trace_handler (gps_data_port, - (MMPortSerialGpsTraceFn)gps_trace_received, - self, NULL); + /* make sure GPS is stopped if it should be in case it was left enabled */ + if (!(self->priv->enabled_sources & (MM_MODEM_LOCATION_SOURCE_GPS_NMEA | + MM_MODEM_LOCATION_SOURCE_GPS_RAW | + MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED))) { + mm_base_modem_at_command_full (MM_BASE_MODEM (self), + mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)), + "AT*E2GPSCTL=0", + 3, FALSE, FALSE, NULL, NULL, NULL); + + /* Add handler for the NMEA traces */ + mm_port_serial_gps_add_trace_handler (gps_data_port, + (MMPortSerialGpsTraceFn)gps_trace_received, + self, NULL); + } } } |