huawei: only expect custom inits to be run on tty ports

This commit is contained in:
Aleksander Morgado
2013-04-24 23:25:53 +02:00
parent 99a8dcce2c
commit cebe828f7f

View File

@@ -209,24 +209,30 @@ try_next_usbif (MMDevice *device)
* and enable that one as being first */ * and enable that one as being first */
closest = G_MAXINT; closest = G_MAXINT;
for (l = mm_device_peek_port_probe_list (device); l; l = g_list_next (l)) { for (l = mm_device_peek_port_probe_list (device); l; l = g_list_next (l)) {
gint usbif; MMPortProbe *probe = MM_PORT_PROBE (l->data);
usbif = g_udev_device_get_property_as_int (mm_port_probe_peek_port (MM_PORT_PROBE (l->data)), "ID_USB_INTERFACE_NUM"); /* Only expect ttys for next probing attempt */
if (usbif == fi_ctx->first_usbif) { if (g_str_equal (mm_port_probe_get_port_subsys (probe), "tty")) {
g_warn_if_reached (); gint usbif;
} else if (usbif > fi_ctx->first_usbif &&
usbif < closest) { usbif = g_udev_device_get_property_as_int (mm_port_probe_peek_port (probe), "ID_USB_INTERFACE_NUM");
closest = usbif; 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) { if (closest == G_MAXINT) {
/* Retry with interface 0... */ /* No more ttys to try! Just return something */
closest = 0; 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; fi_ctx->first_usbif = closest;
} }