[SeaBIOS] [PATCH v2 04/16] usb-msc: support commands without payload
Paolo Bonzini
pbonzini at redhat.com
Thu Nov 17 10:23:01 CET 2011
This lets the usb-msc driver send TEST UNIT READY commands.
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
The new hunk was present in the previous submission but
was in patch 06/16. It didn't break bisectability, but
was not nice.
src/usb-msc.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/usb-msc.c b/src/usb-msc.c
index 13ef93e..357e638 100644
--- a/src/usb-msc.c
+++ b/src/usb-msc.c
@@ -79,9 +79,11 @@ usb_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize)
goto fail;
// Transfer data from device.
- ret = usb_send_bulk(bulkin, USB_DIR_IN, op->buf_fl, bytes);
- if (ret)
- goto fail;
+ if (bytes) {
+ ret = usb_send_bulk(bulkin, USB_DIR_IN, op->buf_fl, bytes);
+ if (ret)
+ goto fail;
+ }
// Transfer csw info.
struct csw_s csw;
@@ -95,7 +97,8 @@ usb_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize)
if (csw.bCSWStatus == 2)
goto fail;
- op->count -= csw.dCSWDataResidue / blocksize;
+ if (csw.dCSWDataResidue)
+ op->count -= csw.dCSWDataResidue / blocksize;
return DISK_RET_EBADTRACK;
fail:
--
1.7.7.1
More information about the SeaBIOS
mailing list