[PATCH 4/7] fully prepare GPS unmanaged port
tomas.jura1 at gmail.com
tomas.jura1 at gmail.com
Tue Feb 2 14:30:22 UTC 2016
From: Tomas Jura <tomas_jura1 at gmail.com>
---
plugins/mbm/mm-broadband-modem-mbm.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/plugins/mbm/mm-broadband-modem-mbm.c b/plugins/mbm/mm-broadband-modem-mbm.c
index ec4563c..2f0a014 100644
--- a/plugins/mbm/mm-broadband-modem-mbm.c
+++ b/plugins/mbm/mm-broadband-modem-mbm.c
@@ -1348,6 +1348,16 @@ enable_location_gathering_finish (MMIfaceModemLocation *self,
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
}
+static void close_unmanaged_port ( MMPortSerialGps *self,
+ GAsyncResult *res,
+ LocationGatheringContext *ctx )
+{
+ mm_port_serial_close(MM_PORT_SERIAL(self));
+ g_simple_async_result_set_op_res_gboolean (G_SIMPLE_ASYNC_RESULT(res), TRUE);
+ location_gathering_context_complete_and_free (ctx);
+}
+
+
static void
gps_enabled_ready (MMBaseModem *self,
GAsyncResult *res,
@@ -1364,7 +1374,8 @@ gps_enabled_ready (MMBaseModem *self,
/* Only use the GPS port in NMEA/RAW setups */
if (ctx->source & (MM_MODEM_LOCATION_SOURCE_GPS_NMEA |
- MM_MODEM_LOCATION_SOURCE_GPS_RAW)) {
+ MM_MODEM_LOCATION_SOURCE_GPS_RAW |
+ MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED )) {
gps_port = mm_base_modem_peek_port_gps (self);
if (!gps_port ||
!mm_port_serial_open (MM_PORT_SERIAL (gps_port), &error)) {
@@ -1386,6 +1397,17 @@ gps_enabled_ready (MMBaseModem *self,
*/
buf = g_byte_array_new ();
g_byte_array_append (buf, (const guint8 *) command, strlen (command));
+ if (ctx->source & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED ) {
+ mm_port_serial_command (MM_PORT_SERIAL (gps_port),
+ buf,
+ 3,
+ FALSE,
+ NULL,
+ (GAsyncReadyCallback) close_unmanaged_port,
+ ctx );
+ g_byte_array_unref (buf);
+ return;
+ }
mm_port_serial_command (MM_PORT_SERIAL (gps_port),
buf,
3,
--
2.7.0
More information about the ModemManager-devel
mailing list