From 983f081f309d28b391422aa53bb36da8b1b61fc0 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 13 Jan 2012 15:59:39 +0100 Subject: nokia: include port type hints Ported commit 44194ac to the new codebase. --- plugins/mm-plugin-nokia.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'plugins/mm-plugin-nokia.c') diff --git a/plugins/mm-plugin-nokia.c b/plugins/mm-plugin-nokia.c index 76fbf8e4..bdca8ff1 100644 --- a/plugins/mm-plugin-nokia.c +++ b/plugins/mm-plugin-nokia.c @@ -84,8 +84,10 @@ grab_port (MMPluginBase *base, GError **error) { MMBaseModem *modem = NULL; + GUdevDevice *port; const gchar *name, *subsys, *driver; guint16 vendor = 0, product = 0; + MMPortType ptype = MM_PORT_TYPE_UNKNOWN; /* The Nokia plugin cannot do anything with non-AT ports */ if (!mm_port_probe_is_at (probe)) { @@ -93,6 +95,7 @@ grab_port (MMPluginBase *base, return NULL; } + port = mm_port_probe_get_port (probe); /* transfer none */ subsys = mm_port_probe_get_port_subsys (probe); name = mm_port_probe_get_port_name (probe); driver = mm_port_probe_get_port_driver (probe); @@ -102,12 +105,11 @@ grab_port (MMPluginBase *base, return NULL; } - /* TODO: */ - /* /\* Look for port type hints *\/ */ - /* if (g_udev_device_get_property_as_boolean (port, "ID_MM_NOKIA_PORT_TYPE_MODEM")) */ - /* ptype = MM_PORT_TYPE_PRIMARY; */ - /* else if (g_udev_device_get_property_as_boolean (port, "ID_MM_NOKIA_PORT_TYPE_AUX")) */ - /* ptype = MM_PORT_TYPE_SECONDARY; */ + /* Look for port type hints */ + if (g_udev_device_get_property_as_boolean (port, "ID_MM_NOKIA_PORT_TYPE_MODEM")) + ptype = MM_PORT_TYPE_PRIMARY; + else if (g_udev_device_get_property_as_boolean (port, "ID_MM_NOKIA_PORT_TYPE_AUX")) + ptype = MM_PORT_TYPE_SECONDARY; /* If this is the first port being grabbed, create a new modem object */ if (!existing) @@ -120,7 +122,7 @@ grab_port (MMPluginBase *base, if (!mm_base_modem_grab_port (existing ? existing : modem, subsys, name, - MM_PORT_TYPE_UNKNOWN)) { + ptype)) { if (modem) g_object_unref (modem); return NULL; -- cgit v1.2.3-70-g09d2