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-modem-nokia.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'plugins/mm-modem-nokia.c') diff --git a/plugins/mm-modem-nokia.c b/plugins/mm-modem-nokia.c index a37c1143..379fba09 100644 --- a/plugins/mm-modem-nokia.c +++ b/plugins/mm-modem-nokia.c @@ -43,6 +43,7 @@ static gboolean grab_port (MMModem *modem, const char *subsys, const char *name, + MMPortType suggested_type, gpointer user_data, GError **error) { @@ -50,10 +51,13 @@ grab_port (MMModem *modem, MMPortType ptype = MM_PORT_TYPE_IGNORED; MMPort *port = NULL; - if (!mm_generic_gsm_get_port (gsm, MM_PORT_TYPE_PRIMARY)) - ptype = MM_PORT_TYPE_PRIMARY; - else if (!mm_generic_gsm_get_port (gsm, MM_PORT_TYPE_SECONDARY)) - ptype = MM_PORT_TYPE_SECONDARY; + if (suggested_type == MM_PORT_TYPE_UNKNOWN) { + if (!mm_generic_gsm_get_port (gsm, MM_PORT_TYPE_PRIMARY)) + ptype = MM_PORT_TYPE_PRIMARY; + else if (!mm_generic_gsm_get_port (gsm, MM_PORT_TYPE_SECONDARY)) + ptype = MM_PORT_TYPE_SECONDARY; + } else + ptype = suggested_type; port = mm_generic_gsm_grab_port (gsm, subsys, name, ptype, error); if (port && MM_IS_SERIAL_PORT (port)) { -- cgit v1.2.3-70-g09d2