diff options
-rw-r--r-- | plugins/option/mm-broadband-modem-hso.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/plugins/option/mm-broadband-modem-hso.c b/plugins/option/mm-broadband-modem-hso.c index 7a31cd84..a679acd4 100644 --- a/plugins/option/mm-broadband-modem-hso.c +++ b/plugins/option/mm-broadband-modem-hso.c @@ -483,9 +483,18 @@ enable_location_gathering (MMIfaceModemLocation *self, /* Setup ports (Broadband modem class) */ static void +trace_received (MMGpsSerialPort *port, + const gchar *trace, + MMIfaceModemLocation *self) +{ + mm_iface_modem_location_gps_update (self, trace); +} + +static void setup_ports (MMBroadbandModem *self) { MMAtSerialPort *gps_control_port; + MMGpsSerialPort *gps_data_port; /* Call parent's setup ports first always */ MM_BROADBAND_MODEM_CLASS (mm_broadband_modem_hso_parent_class)->setup_ports (self); @@ -503,15 +512,23 @@ setup_ports (MMBroadbandModem *self) MM_AT_SERIAL_PORT_REMOVE_ECHO, FALSE, NULL); - /* It may happen that the modem was started with GPS already enabled, or - * maybe ModemManager got rebooted and it was left enabled before. We'll make - * sure that it is disabled when we initialize the modem */ gps_control_port = mm_base_modem_peek_port_gps_control (MM_BASE_MODEM (self)); - if (gps_control_port) + gps_data_port = mm_base_modem_peek_port_gps (MM_BASE_MODEM (self)); + if (gps_control_port && gps_data_port) { + /* It may happen that the modem was started with GPS already enabled, or + * maybe ModemManager got rebooted and it was left enabled before. We'll make + * sure that it is disabled when we initialize the modem */ mm_base_modem_at_command_full (MM_BASE_MODEM (self), gps_control_port, "_OGPS=0", 3, FALSE, NULL, NULL, NULL); + + /* Add handler for the NMEA traces */ + mm_gps_serial_port_add_trace_handler (gps_data_port, + (MMGpsSerialTraceFn)trace_received, + self, + NULL); + } } /*****************************************************************************/ |