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:
Nico Huber 2012-11-21 16:25:55 +01:00 committed by Patrick Georgi
parent 86c686a76e
commit ef88e102bb
1 changed files with 2 additions and 6 deletions

View File

@ -227,16 +227,12 @@ execute_command (usbdev_t *dev, cbw_direction dir, const u8 *cb, int cblen,
if (buflen > 0) {
if (dir == cbw_direction_data_in) {
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);
return MSC_COMMAND_FAIL;
}
} else {
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);
return MSC_COMMAND_FAIL;
}
}
}
int ret = get_csw (MSC_INST (dev)->bulk_in, &csw);