Misc usb-mtp fixes
cover Misc usb-mtp fixes
A documentation fix and changes to return the
right error code on write failures.
Bandan (2):
usb-mtp: fix error conditions for write operation
doc: replace x-root with rootdir for usb-mtp
hw/usb/dev-mtp.c | 7 ++++--- qemu-doc.texi | 2 +- scripts/device-crash-test | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/2 usb-mtp: fix error conditions for write operation
Return STORE_FULL if we can't write all the bytes but return incomplete transfer if data received is less then what was specified in the metadata. Also, use d->offset as the file size which is valid for all file sizes.
Signed-off-by Bandan <[email protected]>
--- hw/usb/dev-mtp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/usb/dev-mtp.c +4 -3
@@ -1665,13 +1665,14 @@ static void usb_mtp_write_data(MTPState *s) goto success; } - rc =write_retry (d->fd, d->data, s->dataset.size); -if (!rc) { + rc =write_retry (d->fd, d->data, d->offset); +if (rc != d->offset) {usb_mtp_queue_result (s,RES_STORE_FULL , d->trans,0 ,0 ,0 ,0 ); goto done; } -if (rc != s->dataset.size) { +/* Only for < 4G file sizes */ +if (s->dataset.size !=0xFFFFFFFF && rc != s->dataset.size) {usb_mtp_queue_result (s,RES_INCOMPLETE_TRANSFER , d->trans,0 ,0 ,0 ,0 ); goto done;
Signature · 1 line
2.11.0
PATCH 2/2 doc: replace x-root with rootdir for usb-mtp
In reply to BandanSigned-off-by Bandan <[email protected]>
--- qemu-doc.texi | 2 +- scripts/device-crash-test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
qemu-doc.texi +1 -1
@@ -943,7 +943,7 @@ for details Bulk-only transport storage device, see @url{https://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/usb-storage.txt,usb-storage.txt} for details here, too -@item usb-mtp,x-root=@var{dir} +@item usb-mtp,rootdir=@var{dir} Media transfer protocol device, using @var{dir} as root of the file tree that is presented to the guest. @item usb-host,hostbus=@var{bus},hostaddr=@var{addr}
scripts/device-crash-test +1 -1
@@ -125,7 +125,7 @@ ERROR_WHITELIST = [ {'device':'tpm-tis', 'expected':True}, # tpm_tis: backend driver with id (null) could not be found {'device':'unimplemented-device', 'expected':True}, # property 'size' not specified or zero {'device':'usb-braille', 'expected':True}, # Property chardev is required - {'device':'usb-mtp', 'expected':True}, # x-root property must be configured + {'device':'usb-mtp', 'expected':True}, # rootdir property must be configured {'device':'usb-redir', 'expected':True}, # Parameter 'chardev' is missing {'device':'usb-serial', 'expected':True}, # Property chardev is required {'device':'usb-storage', 'expected':True}, # drive property not set
Signature · 1 line
2.11.0