diff options
author | Dan Williams <dcbw@redhat.com> | 2010-03-23 01:36:00 -0700 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2010-03-23 01:36:00 -0700 |
commit | bcfb75d88de4679d1ca2dfc65395c49315534ec0 (patch) | |
tree | a3c09ad3ec6564b5aa2f1810679413d8bcaaacd5 /src | |
parent | c36aacee0a287f1d9b7365fd79a48555b92e1356 (diff) |
core: grab probed QCDM ports for plugins where they are useful
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-generic-cdma.c | 26 | ||||
-rw-r--r-- | src/mm-generic-gsm.c | 13 | ||||
-rw-r--r-- | src/mm-modem-base.c | 10 | ||||
-rw-r--r-- | src/mm-plugin-base.c | 4 | ||||
-rw-r--r-- | src/mm-port.h | 3 |
5 files changed, 45 insertions, 11 deletions
diff --git a/src/mm-generic-cdma.c b/src/mm-generic-cdma.c index b708882b..d2c030f4 100644 --- a/src/mm-generic-cdma.c +++ b/src/mm-generic-cdma.c @@ -24,6 +24,7 @@ #include "mm-modem-cdma.h" #include "mm-modem-simple.h" #include "mm-at-serial-port.h" +#include "mm-qcdm-serial-port.h" #include "mm-errors.h" #include "mm-callback-info.h" #include "mm-serial-parsers.h" @@ -74,6 +75,7 @@ typedef struct { MMAtSerialPort *primary; MMAtSerialPort *secondary; + MMQcdmSerialPort *qcdm; MMPort *data; } MMGenericCdmaPrivate; @@ -169,9 +171,11 @@ mm_generic_cdma_grab_port (MMGenericCdma *self, check_valid (self); } else if (ptype == MM_PORT_TYPE_SECONDARY) priv->secondary = MM_AT_SERIAL_PORT (port); + } else if (MM_IS_QCDM_SERIAL_PORT (port) && !priv->qcdm) { + priv->qcdm = MM_QCDM_SERIAL_PORT (port); } else { /* Net device (if any) is the preferred data port */ - if (!priv->data || MM_IS_SERIAL_PORT (priv->data)) { + if (!priv->data || MM_IS_AT_SERIAL_PORT (priv->data)) { priv->data = port; g_object_notify (G_OBJECT (self), MM_MODEM_DATA_DEVICE); check_valid (self); @@ -202,7 +206,7 @@ release_port (MMModem *modem, const char *subsys, const char *name) if (!port) return; - if (port == MM_PORT (priv->primary)) { + if (port == (MMPort *) priv->primary) { mm_modem_base_remove_port (MM_MODEM_BASE (modem), port); priv->primary = NULL; } @@ -212,11 +216,16 @@ release_port (MMModem *modem, const char *subsys, const char *name) g_object_notify (G_OBJECT (modem), MM_MODEM_DATA_DEVICE); } - if (port == MM_PORT (priv->secondary)) { + if (port == (MMPort *) priv->secondary) { mm_modem_base_remove_port (MM_MODEM_BASE (modem), port); priv->secondary = NULL; } + if (port == (MMPort *) priv->qcdm) { + mm_modem_base_remove_port (MM_MODEM_BASE (modem), port); + priv->qcdm = NULL; + } + check_valid (MM_GENERIC_CDMA (modem)); } @@ -432,6 +441,14 @@ enable_all_done (MMModem *modem, GError *error, gpointer user_data) } } + /* Open up the second port, if one exists */ + if (priv->qcdm) { + if (!mm_serial_port_open (MM_SERIAL_PORT (priv->qcdm), &info->error)) { + g_assert (info->error); + goto out; + } + } + update_enabled_state (self, FALSE, MM_MODEM_STATE_REASON_NONE); /* Grab device info right away */ @@ -618,8 +635,11 @@ disable (MMModem *modem, GUINT_TO_POINTER (state), NULL); + /* Close auxiliary serial ports */ if (priv->secondary) mm_serial_port_close (MM_SERIAL_PORT (priv->secondary)); + if (priv->qcdm) + mm_serial_port_close (MM_SERIAL_PORT (priv->qcdm)); mm_modem_set_state (MM_MODEM (info->modem), MM_MODEM_STATE_DISABLING, diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c index 3d226405..a595532c 100644 --- a/src/mm-generic-gsm.c +++ b/src/mm-generic-gsm.c @@ -28,6 +28,7 @@ #include "mm-errors.h" #include "mm-callback-info.h" #include "mm-at-serial-port.h" +#include "mm-qcdm-serial-port.h" #include "mm-serial-parsers.h" #include "mm-modem-helpers.h" #include "mm-options.h" @@ -92,6 +93,7 @@ typedef struct { MMAtSerialPort *primary; MMAtSerialPort *secondary; + MMQcdmSerialPort *qcdm; MMPort *data; } MMGenericGsmPrivate; @@ -430,6 +432,8 @@ mm_generic_gsm_grab_port (MMGenericGsm *self, } else if (ptype == MM_PORT_TYPE_SECONDARY) priv->secondary = MM_AT_SERIAL_PORT (port); + } else if (MM_IS_QCDM_SERIAL_PORT (port) && !priv->qcdm) { + priv->qcdm = MM_QCDM_SERIAL_PORT (port); } else { /* Net device (if any) is the preferred data port */ if (!priv->data || MM_IS_SERIAL_PORT (priv->data)) { @@ -484,7 +488,7 @@ release_port (MMModem *modem, const char *subsys, const char *name) if (!port) return; - if (port == MM_PORT (priv->primary)) { + if (port == (MMPort *) priv->primary) { mm_modem_base_remove_port (MM_MODEM_BASE (modem), port); priv->primary = NULL; } @@ -494,11 +498,16 @@ release_port (MMModem *modem, const char *subsys, const char *name) g_object_notify (G_OBJECT (modem), MM_MODEM_DATA_DEVICE); } - if (port == MM_PORT (priv->secondary)) { + if (port == (MMPort *) priv->secondary) { mm_modem_base_remove_port (MM_MODEM_BASE (modem), port); priv->secondary = NULL; } + if (port == (MMPort *) priv->qcdm) { + mm_modem_base_remove_port (MM_MODEM_BASE (modem), port); + priv->qcdm = NULL; + } + check_valid (MM_GENERIC_GSM (modem)); } diff --git a/src/mm-modem-base.c b/src/mm-modem-base.c index 389f5f04..697a26eb 100644 --- a/src/mm-modem-base.c +++ b/src/mm-modem-base.c @@ -22,6 +22,7 @@ #include "mm-modem-base.h" #include "mm-modem.h" #include "mm-at-serial-port.h" +#include "mm-qcdm-serial-port.h" #include "mm-errors.h" #include "mm-options.h" #include "mm-properties-changed-signal.h" @@ -120,9 +121,12 @@ mm_modem_base_add_port (MMModemBase *self, g_return_val_if_fail (port == NULL, FALSE); } - if (!strcmp (subsys, "tty")) - port = MM_PORT (mm_at_serial_port_new (name, ptype)); - else if (!strcmp (subsys, "net")) { + if (!strcmp (subsys, "tty")) { + if (ptype == MM_PORT_TYPE_QCDM) + port = MM_PORT (mm_qcdm_serial_port_new (name, ptype)); + else + port = MM_PORT (mm_at_serial_port_new (name, ptype)); + } else if (!strcmp (subsys, "net")) { port = MM_PORT (g_object_new (MM_TYPE_PORT, MM_PORT_DEVICE, name, MM_PORT_SUBSYS, MM_PORT_SUBSYS_NET, diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c index dcaa405b..9c1358a6 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -11,7 +11,7 @@ * GNU General Public License for more details: * * Copyright (C) 2008 - 2009 Novell, Inc. - * Copyright (C) 2009 Red Hat, Inc. + * Copyright (C) 2009 - 2010 Red Hat, Inc. */ #define _GNU_SOURCE /* for strcasestr */ @@ -575,7 +575,7 @@ real_handle_probe_response (MMPluginBase *self, ignore_error = TRUE; if (error && !ignore_error) { - if (error->code == MM_SERIAL_RESPONSE_TIMEOUT) { + if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_RESPONSE_TIMEOUT)) { /* Try GCAP again */ if (task_priv->probe_state < PROBE_STATE_GCAP_TRY3) { task_priv->probe_state++; diff --git a/src/mm-port.h b/src/mm-port.h index b5376180..30801455 100644 --- a/src/mm-port.h +++ b/src/mm-port.h @@ -33,8 +33,9 @@ typedef enum { MM_PORT_TYPE_PRIMARY, MM_PORT_TYPE_SECONDARY, MM_PORT_TYPE_IGNORED, + MM_PORT_TYPE_QCDM, - MM_PORT_TYPE_LAST = MM_PORT_TYPE_IGNORED + MM_PORT_TYPE_LAST = MM_PORT_TYPE_QCDM } MMPortType; #define MM_TYPE_PORT (mm_port_get_type ()) |