[SeaBIOS] [PATCH 04/16] usb-msc: support commands without payload

Kevin O'Connor kevin at koconnor.net
Thu Nov 17 06:22:52 CET 2011


On Wed, Nov 16, 2011 at 01:02:45PM +0100, Paolo Bonzini wrote:
> This lets the usb-msc driver send TEST UNIT READY commands.
> 
> Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
> ---
>  src/usb-msc.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/usb-msc.c b/src/usb-msc.c
> index 13ef93e..f74b8ec 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;
> +    }

Later on in this function there's:

  op->count -= csw.dCSWDataResidue / blocksize;

Doesn't it also need to check for blocksize != 0 in order to support
TEST UNIT READY?

-Kevin



More information about the SeaBIOS mailing list