]> Git Repo - qemu.git/commitdiff
usb: mtp: reply INCOMPLETE_TRANSFER on read errors
authorGerd Hoffmann <[email protected]>
Fri, 25 Apr 2014 10:37:49 +0000 (12:37 +0200)
committerGerd Hoffmann <[email protected]>
Mon, 5 May 2014 10:58:02 +0000 (12:58 +0200)
Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Peter Wu <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
hw/usb/dev-mtp.c

index 62428d8e7b31dff428849d6e00e25d46797264c8..943f930404576c92e79b686439059e7c933dcd5e 100644 (file)
@@ -50,6 +50,7 @@ enum mtp_code {
     RES_INVALID_TRANSACTION_ID     = 0x2004,
     RES_OPERATION_NOT_SUPPORTED    = 0x2005,
     RES_PARAMETER_NOT_SUPPORTED    = 0x2006,
+    RES_INCOMPLETE_TRANSFER        = 0x2007,
     RES_INVALID_STORAGE_ID         = 0x2008,
     RES_INVALID_OBJECT_HANDLE      = 0x2009,
     RES_SPEC_BY_FORMAT_UNSUPPORTED = 0x2014,
@@ -946,7 +947,8 @@ static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p)
                 }
                 rc = read(d->fd, d->data, dlen);
                 if (rc != dlen) {
-                    fprintf(stderr, "%s: TODO: handle read error\n", __func__);
+                    memset(d->data, 0, dlen);
+                    s->result->code = RES_INCOMPLETE_TRANSFER;
                 }
                 usb_packet_copy(p, d->data, dlen);
             }
This page took 0.026929 seconds and 4 git commands to generate.