Make umodem more tolerant for devices which modem descriptors are misplaced.

Reported by:	Erick Wales
Submitted by:	Hans Petter Selasky
This commit is contained in:
Andrew Thompson 2010-02-14 19:59:19 +00:00
parent b60541a9ec
commit 3e889e246c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=203903

View File

@ -312,11 +312,16 @@ umodem_attach(device_t dev)
0 - 1, UDESCSUB_CDC_UNION, 0 - 1);
if ((cud == NULL) || (cud->bLength < sizeof(*cud))) {
device_printf(dev, "no CM or union descriptor\n");
goto detach;
device_printf(dev, "Missing descriptor. "
"Assuming data interface is next.\n");
if (sc->sc_ctrl_iface_no == 0xFF)
goto detach;
else
sc->sc_data_iface_no =
sc->sc_ctrl_iface_no + 1;
} else {
sc->sc_data_iface_no = cud->bSlaveInterface[0];
}
sc->sc_data_iface_no = cud->bSlaveInterface[0];
} else {
sc->sc_data_iface_no = cmd->bDataInterface;
}