diff options
author | Dan Williams <dcbw@redhat.com> | 2009-07-02 13:48:30 -0400 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2009-07-02 13:48:30 -0400 |
commit | 52da9990eef279bbc349685a7558d26cf4b7893b (patch) | |
tree | f84433872729aafef296eebae46ace57eb9c8d82 /plugins/mm-plugin-zte.c | |
parent | 4e7548e496d580f26a763bcdaeca7e7af75d5141 (diff) |
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.
Diffstat (limited to 'plugins/mm-plugin-zte.c')
-rw-r--r-- | plugins/mm-plugin-zte.c | 11 |
1 files changed, 9 insertions, 2 deletions
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; } } |