From 52da9990eef279bbc349685a7558d26cf4b7893b Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 2 Jul 2009 13:48:30 -0400 Subject: plugins: allow plugins to more easily suggest port types ZTE modems need to use udev rules to assign port type hints, so generalize that and port all the plugins over to suggested port types in the MMModem interface's grab_port() function. --- plugins/mm-plugin-zte.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'plugins/mm-plugin-zte.c') diff --git a/plugins/mm-plugin-zte.c b/plugins/mm-plugin-zte.c index e830823f..08493dca 100644 --- a/plugins/mm-plugin-zte.c +++ b/plugins/mm-plugin-zte.c @@ -109,10 +109,17 @@ grab_port (MMPluginBase *base, MMModem *modem = NULL; const char *name, *subsys, *sysfs_path; guint32 caps; + MMPortType ptype = MM_PORT_TYPE_UNKNOWN; port = mm_plugin_base_supports_task_get_port (task); g_assert (port); + /* Look for port type hints */ + if (g_udev_device_get_property_as_boolean (port, "ID_MM_ZTE_PORT_TYPE_MODEM")) + ptype = MM_PORT_TYPE_PRIMARY; + else if (g_udev_device_get_property_as_boolean (port, "ID_MM_ZTE_PORT_TYPE_AUX")) + ptype = MM_PORT_TYPE_SECONDARY; + physdev = mm_plugin_base_supports_task_get_physdev (task); g_assert (physdev); sysfs_path = g_udev_device_get_sysfs_path (physdev); @@ -137,7 +144,7 @@ grab_port (MMPluginBase *base, } if (modem) { - if (!mm_modem_grab_port (modem, subsys, name, NULL, error)) { + if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error)) { g_object_unref (modem); return NULL; } @@ -145,7 +152,7 @@ grab_port (MMPluginBase *base, } else { if (caps & (MM_PLUGIN_BASE_PORT_CAP_GSM | CAP_CDMA)) { modem = existing; - if (!mm_modem_grab_port (modem, subsys, name, NULL, error)) + if (!mm_modem_grab_port (modem, subsys, name, ptype, NULL, error)) return NULL; } } -- cgit v1.2.3-70-g09d2