core: grab probed QCDM ports for plugins where they are useful
This commit is contained in:
@@ -42,9 +42,11 @@ mm_plugin_create (void)
|
||||
static guint32
|
||||
get_level_for_capabilities (guint32 capabilities)
|
||||
{
|
||||
/* Only CDMA for now */
|
||||
/* Only CDMA and QCDM for now */
|
||||
if (capabilities & CAP_CDMA)
|
||||
return 10;
|
||||
if (capabilities & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
return 10;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -150,12 +152,15 @@ grab_port (MMPluginBase *base,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (caps & CAP_CDMA) {
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, MM_PORT_TYPE_UNKNOWN, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
} else if (get_level_for_capabilities (caps)) {
|
||||
MMPortType ptype = MM_PORT_TYPE_UNKNOWN;
|
||||
|
||||
if (caps & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
ptype = MM_PORT_TYPE_QCDM;
|
||||
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return modem;
|
||||
|
||||
@@ -59,6 +59,8 @@ get_level_for_capabilities (guint32 capabilities)
|
||||
return 5;
|
||||
if (capabilities & CAP_CDMA)
|
||||
return 5;
|
||||
if (capabilities & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
return 5;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -159,12 +161,15 @@ grab_port (MMPluginBase *base,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (caps & (MM_PLUGIN_BASE_PORT_CAP_GSM | CAP_CDMA)) {
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, MM_PORT_TYPE_UNKNOWN, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
} else if (get_level_for_capabilities (caps)) {
|
||||
MMPortType ptype = MM_PORT_TYPE_UNKNOWN;
|
||||
|
||||
if (caps & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
ptype = MM_PORT_TYPE_QCDM;
|
||||
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return modem;
|
||||
|
||||
@@ -141,12 +141,10 @@ grab_port (MMPluginBase *base,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (caps & (MM_PLUGIN_BASE_PORT_CAP_GSM | CAP_CDMA)) {
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, MM_PORT_TYPE_UNKNOWN, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
} else if (get_level_for_capabilities (caps)) {
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, MM_PORT_TYPE_UNKNOWN, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return modem;
|
||||
|
||||
@@ -55,6 +55,8 @@ get_level_for_capabilities (guint32 capabilities)
|
||||
return 10;
|
||||
if (capabilities & CAP_CDMA)
|
||||
return 10;
|
||||
if (capabilities & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
return 10;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -308,6 +310,8 @@ grab_port (MMPluginBase *base,
|
||||
info = g_object_get_data (G_OBJECT (task), TAG_SUPPORTS_INFO);
|
||||
if (info && info->secondary)
|
||||
ptype = MM_PORT_TYPE_SECONDARY;
|
||||
else if (caps & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
ptype = MM_PORT_TYPE_QCDM;
|
||||
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error))
|
||||
|
||||
@@ -47,6 +47,8 @@ get_level_for_capabilities (guint32 capabilities)
|
||||
return 10;
|
||||
if (capabilities & CAP_CDMA)
|
||||
return 10;
|
||||
if (capabilities & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
return 10;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -162,12 +164,13 @@ grab_port (MMPluginBase *base,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (caps & (MM_PLUGIN_BASE_PORT_CAP_GSM | CAP_CDMA)) {
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
} else if (get_level_for_capabilities (caps)) {
|
||||
if (caps & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
ptype = MM_PORT_TYPE_QCDM;
|
||||
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return modem;
|
||||
|
||||
@@ -37,18 +37,21 @@ mm_plugin_create (void)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static guint32
|
||||
get_level_for_capabilities (guint32 capabilities)
|
||||
{
|
||||
if (capabilities & MM_PLUGIN_BASE_PORT_CAP_GSM)
|
||||
return 10;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
probe_result (MMPluginBase *base,
|
||||
MMPluginBaseSupportsTask *task,
|
||||
guint32 capabilities,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint32 level = 0;
|
||||
|
||||
if (capabilities & MM_PLUGIN_BASE_PORT_CAP_GSM)
|
||||
level = 10;
|
||||
|
||||
mm_plugin_base_supports_task_complete (task, level);
|
||||
mm_plugin_base_supports_task_complete (task, get_level_for_capabilities (capabilities));
|
||||
}
|
||||
|
||||
static MMPluginSupportsResult
|
||||
@@ -58,7 +61,7 @@ supports_port (MMPluginBase *base,
|
||||
{
|
||||
GUdevDevice *port;
|
||||
const char *tmp;
|
||||
guint32 cached = 0;
|
||||
guint32 cached = 0, level;
|
||||
|
||||
/* Can't do anything with non-serial ports */
|
||||
port = mm_plugin_base_supports_task_get_port (task);
|
||||
@@ -78,7 +81,8 @@ supports_port (MMPluginBase *base,
|
||||
return MM_PLUGIN_SUPPORTS_PORT_UNSUPPORTED;
|
||||
|
||||
if (mm_plugin_base_get_cached_port_capabilities (base, port, &cached)) {
|
||||
if (cached & MM_PLUGIN_BASE_PORT_CAP_GSM) {
|
||||
level = get_level_for_capabilities (cached);
|
||||
if (level) {
|
||||
mm_plugin_base_supports_task_complete (task, 10);
|
||||
return MM_PLUGIN_SUPPORTS_PORT_IN_PROGRESS;
|
||||
}
|
||||
|
||||
@@ -150,12 +150,10 @@ grab_port (MMPluginBase *base,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (caps & (MM_PLUGIN_BASE_PORT_CAP_GSM | CAP_CDMA)) {
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, MM_PORT_TYPE_UNKNOWN, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
} else if (get_level_for_capabilities (caps)) {
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, MM_PORT_TYPE_UNKNOWN, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return modem;
|
||||
|
||||
@@ -47,6 +47,8 @@ get_level_for_capabilities (guint32 capabilities)
|
||||
return 10;
|
||||
if (capabilities & CAP_CDMA)
|
||||
return 10;
|
||||
if (capabilities & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
return 10;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -154,12 +156,15 @@ grab_port (MMPluginBase *base,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (caps & (MM_PLUGIN_BASE_PORT_CAP_GSM | CAP_CDMA)) {
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, MM_PORT_TYPE_UNKNOWN, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
} else if (get_level_for_capabilities (caps)) {
|
||||
MMPortType ptype = MM_PORT_TYPE_UNKNOWN;
|
||||
|
||||
if (caps & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
ptype = MM_PORT_TYPE_QCDM;
|
||||
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return modem;
|
||||
|
||||
@@ -151,12 +151,13 @@ grab_port (MMPluginBase *base,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (caps & MM_PLUGIN_BASE_PORT_CAP_GSM) {
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
} else if (get_level_for_capabilities (caps)) {
|
||||
if (caps & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
ptype = MM_PORT_TYPE_QCDM;
|
||||
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return modem;
|
||||
|
||||
@@ -173,13 +173,10 @@ grab_port (MMPluginBase *base,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( (caps & (MM_PLUGIN_BASE_PORT_CAP_GSM | CAP_CDMA))
|
||||
|| (ptype != MM_PORT_TYPE_UNKNOWN)) {
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
} else if (get_level_for_capabilities (caps) || (ptype != MM_PORT_TYPE_UNKNOWN)) {
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return modem;
|
||||
|
||||
+10
-7
@@ -47,6 +47,8 @@ get_level_for_capabilities (guint32 capabilities)
|
||||
return 10;
|
||||
if (capabilities & CAP_CDMA)
|
||||
return 10;
|
||||
if (capabilities & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
return 10;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -100,7 +102,7 @@ supports_port (MMPluginBase *base,
|
||||
* 1235f71b20c92cded4abd976ccc5010649aae1a0 and
|
||||
* f38ad328acfdc6ce29dd1380602c546b064161ae for more details.
|
||||
*/
|
||||
mm_plugin_base_supports_task_set_custom_init_command (task, "ATE0+CPMS?", 3, 4, TRUE);
|
||||
mm_plugin_base_supports_task_set_custom_init_command (task, "ATE0+CPMS?", 3, 4, FALSE);
|
||||
|
||||
if (mm_plugin_base_probe_port (base, task, NULL))
|
||||
return MM_PLUGIN_SUPPORTS_PORT_IN_PROGRESS;
|
||||
@@ -160,12 +162,13 @@ grab_port (MMPluginBase *base,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (caps & (MM_PLUGIN_BASE_PORT_CAP_GSM | CAP_CDMA)) {
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
} else if (get_level_for_capabilities (caps)) {
|
||||
if (caps & MM_PLUGIN_BASE_PORT_CAP_QCDM)
|
||||
ptype = MM_PORT_TYPE_QCDM;
|
||||
|
||||
modem = existing;
|
||||
if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return modem;
|
||||
|
||||
Reference in New Issue
Block a user