diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2014-04-25 12:37:49 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-05-05 12:58:02 +0200 |
commit | 8ebb87635790e7033e19e9a26e8c5eef22560bcc (patch) | |
tree | 1db9883a69260e24a7c257510a41ce9a6f803c4b /hw/usb | |
parent | afa82daf1627645d3ad3e05954b098fff001ab32 (diff) |
usb: mtp: reply INCOMPLETE_TRANSFER on read errors
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r-- | hw/usb/dev-mtp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 62428d8e7b..943f930404 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -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); } |