diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-04-24 23:25:53 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-04-25 10:34:19 +0200 |
commit | cebe828f7fb62585614b756efb80799286f35261 (patch) | |
tree | 43b6c64754c437009c67b2bf81e1a59723eaf834 | |
parent | 99a8dcce2ca04dccfe7a71bfd78394e710aa1ab1 (diff) | |
download | ModemManager-cebe828f7fb62585614b756efb80799286f35261.tar.gz |
huawei: only expect custom inits to be run on tty ports
-rw-r--r-- | plugins/huawei/mm-plugin-huawei.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/plugins/huawei/mm-plugin-huawei.c b/plugins/huawei/mm-plugin-huawei.c index 130f88da2..fb13fe778 100644 --- a/plugins/huawei/mm-plugin-huawei.c +++ b/plugins/huawei/mm-plugin-huawei.c @@ -209,24 +209,30 @@ try_next_usbif (MMDevice *device) * and enable that one as being first */ closest = G_MAXINT; for (l = mm_device_peek_port_probe_list (device); l; l = g_list_next (l)) { - gint usbif; - - usbif = g_udev_device_get_property_as_int (mm_port_probe_peek_port (MM_PORT_PROBE (l->data)), "ID_USB_INTERFACE_NUM"); - if (usbif == fi_ctx->first_usbif) { - g_warn_if_reached (); - } else if (usbif > fi_ctx->first_usbif && - usbif < closest) { - closest = usbif; + MMPortProbe *probe = MM_PORT_PROBE (l->data); + + /* Only expect ttys for next probing attempt */ + if (g_str_equal (mm_port_probe_get_port_subsys (probe), "tty")) { + gint usbif; + + usbif = g_udev_device_get_property_as_int (mm_port_probe_peek_port (probe), "ID_USB_INTERFACE_NUM"); + if (usbif == fi_ctx->first_usbif) { + /* This is the one we just probed, which wasn't yet removed, so just skip it */ + } else if (usbif > fi_ctx->first_usbif && + usbif < closest) { + closest = usbif; + } } } if (closest == G_MAXINT) { - /* Retry with interface 0... */ + /* No more ttys to try! Just return something */ closest = 0; + mm_dbg ("(Huawei) No more ports to run initial probing"); + } else { + mm_dbg ("(Huawei) Will try initial probing with interface '%d' instead", closest); } - mm_dbg ("(Huawei) Will try initial probing with interface '%d' instead", closest); - fi_ctx->first_usbif = closest; } |