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,23 +209,29 @@ 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)) {
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; gint usbif;
usbif = g_udev_device_get_property_as_int (mm_port_probe_peek_port (MM_PORT_PROBE (l->data)), "ID_USB_INTERFACE_NUM"); usbif = g_udev_device_get_property_as_int (mm_port_probe_peek_port (probe), "ID_USB_INTERFACE_NUM");
if (usbif == fi_ctx->first_usbif) { if (usbif == fi_ctx->first_usbif) {
g_warn_if_reached (); /* This is the one we just probed, which wasn't yet removed, so just skip it */
} else if (usbif > fi_ctx->first_usbif && } else if (usbif > fi_ctx->first_usbif &&
usbif < closest) { usbif < closest) {
closest = usbif; closest = usbif;
} }
} }
if (closest == G_MAXINT) {
/* Retry with interface 0... */
closest = 0;
} }
if (closest == G_MAXINT) {
/* 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; fi_ctx->first_usbif = closest;
} }