diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-02-13 22:19:28 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:15:05 +0100 |
commit | 8b7b614105c784b391f818a2eb6462accd844a4e (patch) | |
tree | 7d517f9a322d7f9306a26dd7689f2734e208af3d /plugins/mm-plugin-nokia.c | |
parent | 0b39bf91ecde4d19d231e495bc9573a67869c3f2 (diff) |
core: rework port grabbing and organization
Make port roles more flexible. We have modems that do PPP
on interfaces other than the primary interface, and that
wasn't possible with the old code. So clean up all that
logic and move the port organization code into the core
so we can reduce code in the plugins.
In the new world order, the plugins say whether the port
is a QCDM port, an AT port, or ignored. If it's an AT
port the plugins get to tag it as primary, secondary, or
PPP, or any combination of the 3. This allows for modems
where PPP should really be done on the secondary port
(Huawei E220, Sierra devices) so that the primary port
stays open for command and status.
After all ports are grabbed by the generic classes, they get
"organized", which assigns various ports to the roles of
PRIMARY, SECONDARY, DATA, and QCDM based on specific rules
and hints that the plugin provided (which are expressed as
MMAtPortFlags).
The plugin code is responsible for determining the port
hints (ie MMAtPortFlags) at probe time, instead of having
a combination of the plugin and the modem class do the
job. This simplifies things greatly for the plugins at
the expense of more complicated logic in the core.
This is the port of commit 96505d42ed62327101dcee7c2bf31177b0bb1c9f
to the 06-api branch.
Diffstat (limited to 'plugins/mm-plugin-nokia.c')
-rw-r--r-- | plugins/mm-plugin-nokia.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/mm-plugin-nokia.c b/plugins/mm-plugin-nokia.c index 5bde6444..343921a3 100644 --- a/plugins/mm-plugin-nokia.c +++ b/plugins/mm-plugin-nokia.c @@ -87,7 +87,7 @@ grab_port (MMPluginBase *base, GUdevDevice *port; const gchar *name, *subsys, *driver; guint16 vendor = 0, product = 0; - MMPortType ptype = MM_PORT_TYPE_UNKNOWN; + MMAtPortFlag pflags = MM_AT_PORT_FLAG_NONE; /* The Nokia plugin cannot do anything with non-AT ports */ if (!mm_port_probe_is_at (probe)) { @@ -113,9 +113,9 @@ grab_port (MMPluginBase *base, /* 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; + pflags = MM_AT_PORT_FLAG_PRIMARY; else if (g_udev_device_get_property_as_boolean (port, "ID_MM_NOKIA_PORT_TYPE_AUX")) - ptype = MM_PORT_TYPE_SECONDARY; + pflags = MM_AT_PORT_FLAG_SECONDARY; /* If this is the first port being grabbed, create a new modem object */ if (!existing) @@ -128,7 +128,9 @@ grab_port (MMPluginBase *base, if (!mm_base_modem_grab_port (existing ? existing : modem, subsys, name, - ptype)) { + MM_PORT_TYPE_AT, /* we only allow AT ports here */ + pflags, + error)) { if (modem) g_object_unref (modem); return NULL; |