core: grab probed QCDM ports for plugins where they are useful
This commit is contained in:
+23
-3
@@ -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,
|
||||
|
||||
+11
-2
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
+7
-3
@@ -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,
|
||||
|
||||
@@ -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++;
|
||||
|
||||
+2
-1
@@ -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 ())
|
||||
|
||||
Reference in New Issue
Block a user