libpayload: More compliant error recovery in USB MSC
If an endpoint gets stalled by an MSC device, after successful transmission of a command (CBW), we should still ask for the status (CSW). Otherwise, the driver and the device get desynchronized on the command tags. Change-Id: I53167f22c43b3a237cb4539b3affe37799378b93 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/1900 Reviewed-by: Patrick Georgi <patrick@georgi-clan.de> Tested-by: build bot (Jenkins)
This commit is contained in:
parent
86c686a76e
commit
ef88e102bb
|
@ -227,16 +227,12 @@ execute_command (usbdev_t *dev, cbw_direction dir, const u8 *cb, int cblen,
|
||||||
if (buflen > 0) {
|
if (buflen > 0) {
|
||||||
if (dir == cbw_direction_data_in) {
|
if (dir == cbw_direction_data_in) {
|
||||||
if (dev->controller->
|
if (dev->controller->
|
||||||
bulk (MSC_INST (dev)->bulk_in, buflen, buf, 0)) {
|
bulk (MSC_INST (dev)->bulk_in, buflen, buf, 0))
|
||||||
clear_stall (MSC_INST (dev)->bulk_in);
|
clear_stall (MSC_INST (dev)->bulk_in);
|
||||||
return MSC_COMMAND_FAIL;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (dev->controller->
|
if (dev->controller->
|
||||||
bulk (MSC_INST (dev)->bulk_out, buflen, buf, 0)) {
|
bulk (MSC_INST (dev)->bulk_out, buflen, buf, 0))
|
||||||
clear_stall (MSC_INST (dev)->bulk_out);
|
clear_stall (MSC_INST (dev)->bulk_out);
|
||||||
return MSC_COMMAND_FAIL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int ret = get_csw (MSC_INST (dev)->bulk_in, &csw);
|
int ret = get_csw (MSC_INST (dev)->bulk_in, &csw);
|
||||||
|
|
Loading…
Reference in New Issue