[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 28/30] usb storage: handle long responses
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 28/30] usb storage: handle long responses |
Date: |
Fri, 17 Dec 2010 12:26:44 +0100 |
The scsi layer may return us more data than the guests wants to have.
Handle this by just ignoring the extra bytes and calling the
{read,write}_data callback to finish the request.
Seen happening in real life with some extended inquiry command.
With this patch applied the linux kernel stops reseting the device
once at boot.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb-msd.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 28c12dd..729d96c 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -187,7 +187,7 @@ static void usb_msd_copy_data(MSDState *s)
s->usb_buf += len;
s->scsi_buf += len;
s->data_len -= len;
- if (s->scsi_len == 0) {
+ if (s->scsi_len == 0 || s->data_len == 0) {
if (s->mode == USB_MSDM_DATAIN) {
s->scsi_dev->info->read_data(s->scsi_dev, s->tag);
} else if (s->mode == USB_MSDM_DATAOUT) {
@@ -434,7 +434,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
break;
case USB_MSDM_DATAIN:
- DPRINTF("Data in %d/%d\n", len, s->data_len);
+ DPRINTF("Data in %d/%d, scsi_len %d\n", len, s->data_len,
s->scsi_len);
if (len > s->data_len)
len = s->data_len;
s->usb_buf = data;
--
1.7.1
- [Qemu-devel] [PATCH 07/30] usb bluetooth: use new descriptor infrastructure., (continued)
- [Qemu-devel] [PATCH 07/30] usb bluetooth: use new descriptor infrastructure., Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 17/30] usb: add usb_wakeup() + wakeup callback to port ops, Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 14/30] usb: move remote wakeup handling to common code, Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 13/30] usb: move USB_REQ_{GET, SET}_CONFIGURATION handling to common code, Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 19/30] usb: hub: remote wakeup support., Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 15/30] usb: create USBPortOps, move attach there., Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 11/30] usb network: use new descriptor infrastructure., Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 20/30] usb: hid: remote wakeup support., Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 21/30] usb: hid: change serial number to "42"., Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 27/30] usb storage: fix status reporting, Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 28/30] usb storage: handle long responses,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 24/30] usb: add usb_desc_attach, Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 16/30] usb: rework attach/detach workflow, Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 22/30] usb: add speed mask to ports, Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 26/30] usb storage: high speed support, Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 23/30] usb: add attach callback, Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 25/30] usb: add device qualifier support, Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 18/30] usb: uhci: remote wakeup support., Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 29/30] usb: keep track of physical port address., Gerd Hoffmann, 2010/12/17
- [Qemu-devel] [PATCH 30/30] usb: add port property., Gerd Hoffmann, 2010/12/17