qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] Misc usb-mtp fixes
@ 2018-08-31 19:16 Bandan
  2018-08-31 19:16 ` [Qemu-devel] [PATCH 1/2] usb-mtp: fix error conditions for write operation Bandan
  2018-08-31 19:16 ` [Qemu-devel] [PATCH 2/2] doc: replace x-root with rootdir for usb-mtp Bandan
  0 siblings, 2 replies; 3+ messages in thread
From: Bandan @ 2018-08-31 19:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

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(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH 1/2] usb-mtp: fix error conditions for write operation
  2018-08-31 19:16 [Qemu-devel] [PATCH 0/2] Misc usb-mtp fixes Bandan
@ 2018-08-31 19:16 ` Bandan
  2018-08-31 19:16 ` [Qemu-devel] [PATCH 2/2] doc: replace x-root with rootdir for usb-mtp Bandan
  1 sibling, 0 replies; 3+ messages in thread
From: Bandan @ 2018-08-31 19:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

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 <bsd@redhat.com>
---
 hw/usb/dev-mtp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 3fdc4b0da1..15edf3bb82 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -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;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH 2/2] doc: replace x-root with rootdir for usb-mtp
  2018-08-31 19:16 [Qemu-devel] [PATCH 0/2] Misc usb-mtp fixes Bandan
  2018-08-31 19:16 ` [Qemu-devel] [PATCH 1/2] usb-mtp: fix error conditions for write operation Bandan
@ 2018-08-31 19:16 ` Bandan
  1 sibling, 0 replies; 3+ messages in thread
From: Bandan @ 2018-08-31 19:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

Signed-off-by: Bandan <bsd@redhat.com>
---
 qemu-doc.texi             | 2 +-
 scripts/device-crash-test | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/qemu-doc.texi b/qemu-doc.texi
index 7bd449f398..f7ad1dfe4b 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -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}
diff --git a/scripts/device-crash-test b/scripts/device-crash-test
index e6c233e9bf..7045594bd4 100755
--- a/scripts/device-crash-test
+++ b/scripts/device-crash-test
@@ -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
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-31 19:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-31 19:16 [Qemu-devel] [PATCH 0/2] Misc usb-mtp fixes Bandan
2018-08-31 19:16 ` [Qemu-devel] [PATCH 1/2] usb-mtp: fix error conditions for write operation Bandan
2018-08-31 19:16 ` [Qemu-devel] [PATCH 2/2] doc: replace x-root with rootdir for usb-mtp Bandan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).