summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-10-18 08:55:09 +0200
committerAleksander Morgado <aleksander@lanedo.com>2013-10-31 17:12:24 +0100
commitdeaeeec3678f0996a58fae8be1e365e463ee9400 (patch)
tree9f5a083504ccf89734ead3bba2474eb59141d108
parentfcc2b1be2c36f4d866cd8a13b39df1c8931c067a (diff)
downloadModemManager-deaeeec3678f0996a58fae8be1e365e463ee9400.tar.gz
x22x: handle QMI modems
With some bits and pieces developed by Dan Williams <dcbw@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=710439
-rw-r--r--plugins/x22x/mm-plugin-x22x.c58
1 files changed, 38 insertions, 20 deletions
diff --git a/plugins/x22x/mm-plugin-x22x.c b/plugins/x22x/mm-plugin-x22x.c
index 9b36048b6..72b8f2e2f 100644
--- a/plugins/x22x/mm-plugin-x22x.c
+++ b/plugins/x22x/mm-plugin-x22x.c
@@ -26,6 +26,10 @@
#include "mm-plugin-x22x.h"
#include "mm-broadband-modem-x22x.h"
+#if defined WITH_QMI
+#include "mm-broadband-modem-qmi.h"
+#endif
+
G_DEFINE_TYPE (MMPluginX22x, mm_plugin_x22x, MM_TYPE_PLUGIN)
int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION;
@@ -185,6 +189,17 @@ create_modem (MMPlugin *self,
GList *probes,
GError **error)
{
+#if defined WITH_QMI
+ if (mm_port_probe_list_has_qmi_port (probes)) {
+ mm_dbg ("QMI-powered X22X modem found...");
+ return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
+ drivers,
+ mm_plugin_get_name (self),
+ vendor,
+ product));
+ }
+#endif
+
return MM_BASE_MODEM (mm_broadband_modem_x22x_new (sysfs_path,
drivers,
mm_plugin_get_name (self),
@@ -205,26 +220,28 @@ grab_port (MMPlugin *self,
port = mm_port_probe_peek_port (probe);
ptype = mm_port_probe_get_port_type (probe);
- /* Look for port type hints; just probing can't distinguish which port should
- * be the data/primary port on these devices. We have to tag them based on
- * what the Windows .INF files say the port layout should be.
- */
- if (g_udev_device_get_property_as_boolean (port, "ID_MM_X22X_PORT_TYPE_MODEM")) {
- mm_dbg ("x22x: AT port '%s/%s' flagged as primary",
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe));
- pflags = MM_AT_PORT_FLAG_PRIMARY;
- } else if (g_udev_device_get_property_as_boolean (port, "ID_MM_X22X_PORT_TYPE_AUX")) {
- mm_dbg ("x22x: AT port '%s/%s' flagged as secondary",
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe));
- pflags = MM_AT_PORT_FLAG_SECONDARY;
- } else {
- /* If the port was tagged by the udev rules but isn't a primary or secondary,
- * then ignore it to guard against race conditions if a device just happens
- * to show up with more than two AT-capable ports.
+ if (ptype == MM_PORT_TYPE_AT) {
+ /* Look for port type hints; just probing can't distinguish which port should
+ * be the data/primary port on these devices. We have to tag them based on
+ * what the Windows .INF files say the port layout should be.
*/
- ptype = MM_PORT_TYPE_IGNORED;
+ if (g_udev_device_get_property_as_boolean (port, "ID_MM_X22X_PORT_TYPE_MODEM")) {
+ mm_dbg ("x22x: AT port '%s/%s' flagged as primary",
+ mm_port_probe_get_port_subsys (probe),
+ mm_port_probe_get_port_name (probe));
+ pflags = MM_AT_PORT_FLAG_PRIMARY;
+ } else if (g_udev_device_get_property_as_boolean (port, "ID_MM_X22X_PORT_TYPE_AUX")) {
+ mm_dbg ("x22x: AT port '%s/%s' flagged as secondary",
+ mm_port_probe_get_port_subsys (probe),
+ mm_port_probe_get_port_name (probe));
+ pflags = MM_AT_PORT_FLAG_SECONDARY;
+ } else {
+ /* If the port was tagged by the udev rules but isn't a primary or secondary,
+ * then ignore it to guard against race conditions if a device just happens
+ * to show up with more than two AT-capable ports.
+ */
+ ptype = MM_PORT_TYPE_IGNORED;
+ }
}
return mm_base_modem_grab_port (modem,
@@ -240,7 +257,7 @@ grab_port (MMPlugin *self,
G_MODULE_EXPORT MMPlugin *
mm_plugin_create (void)
{
- static const gchar *subsystems[] = { "tty", NULL };
+ static const gchar *subsystems[] = { "tty", "net", "usb", NULL };
/* Vendors: TAMobile and Olivetti */
static const guint16 vendor_ids[] = { 0x1bbb, 0x0b3c, 0 };
/* Only handle X22X tagged devices here. */
@@ -259,6 +276,7 @@ mm_plugin_create (void)
MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems,
MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids,
MM_PLUGIN_ALLOWED_AT, TRUE,
+ MM_PLUGIN_ALLOWED_QMI, TRUE,
MM_PLUGIN_ALLOWED_UDEV_TAGS, udev_tags,
MM_PLUGIN_CUSTOM_INIT, &custom_init,
NULL));