nokia: include port type hints

Ported commit 44194ac to the new codebase.
This commit is contained in:
Aleksander Morgado
2012-01-13 15:59:39 +01:00
parent 0d5c237428
commit 983f081f30

View File

@@ -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;