* [Qemu-devel] [PATCH v2 0/3] Misc usb-mtp fixes
@ 2018-09-07 22:08 Bandan Das
2018-09-07 22:08 ` [Qemu-devel] [PATCH v2 1/3] usb-mtp: fix error conditions for write operation Bandan Das
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Bandan Das @ 2018-09-07 22:08 UTC (permalink / raw)
To: qemu-devel; +Cc: kraxel
v2:
Same as v1 but with another minor cleanup
patch. The write buffer breakup is still WIP.
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
Bandan Das (1):
usb-mtp: reset ObjectInfo dataset size on cleanup
hw/usb/dev-mtp.c | 9 ++++++---
qemu-doc.texi | 2 +-
scripts/device-crash-test | 2 +-
3 files changed, 8 insertions(+), 5 deletions(-)
--
2.14.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH v2 1/3] usb-mtp: fix error conditions for write operation
2018-09-07 22:08 [Qemu-devel] [PATCH v2 0/3] Misc usb-mtp fixes Bandan Das
@ 2018-09-07 22:08 ` Bandan Das
2018-09-07 22:08 ` [Qemu-devel] [PATCH v2 2/3] doc: replace x-root with rootdir for usb-mtp Bandan Das
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Bandan Das @ 2018-09-07 22:08 UTC (permalink / raw)
To: qemu-devel; +Cc: kraxel
From: Bandan <bsd@redhat.com>
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.14.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH v2 2/3] doc: replace x-root with rootdir for usb-mtp
2018-09-07 22:08 [Qemu-devel] [PATCH v2 0/3] Misc usb-mtp fixes Bandan Das
2018-09-07 22:08 ` [Qemu-devel] [PATCH v2 1/3] usb-mtp: fix error conditions for write operation Bandan Das
@ 2018-09-07 22:08 ` Bandan Das
2018-09-07 22:08 ` [Qemu-devel] [PATCH v2 3/3] usb-mtp: reset ObjectInfo dataset size on cleanup Bandan Das
2018-09-13 11:54 ` [Qemu-devel] [PATCH v2 0/3] Misc usb-mtp fixes Gerd Hoffmann
3 siblings, 0 replies; 5+ messages in thread
From: Bandan Das @ 2018-09-07 22:08 UTC (permalink / raw)
To: qemu-devel; +Cc: kraxel
From: Bandan <bsd@redhat.com>
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 f74542a0e9..cc7d81181c 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.14.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH v2 3/3] usb-mtp: reset ObjectInfo dataset size on cleanup
2018-09-07 22:08 [Qemu-devel] [PATCH v2 0/3] Misc usb-mtp fixes Bandan Das
2018-09-07 22:08 ` [Qemu-devel] [PATCH v2 1/3] usb-mtp: fix error conditions for write operation Bandan Das
2018-09-07 22:08 ` [Qemu-devel] [PATCH v2 2/3] doc: replace x-root with rootdir for usb-mtp Bandan Das
@ 2018-09-07 22:08 ` Bandan Das
2018-09-13 11:54 ` [Qemu-devel] [PATCH v2 0/3] Misc usb-mtp fixes Gerd Hoffmann
3 siblings, 0 replies; 5+ messages in thread
From: Bandan Das @ 2018-09-07 22:08 UTC (permalink / raw)
To: qemu-devel; +Cc: kraxel
Stale values in this field may result in qemu
expecting more data on the next operation
Signed-off-by: Bandan Das <bsd@redhat.com>
---
hw/usb/dev-mtp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 15edf3bb82..00a3691bae 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -1568,6 +1568,7 @@ static void usb_mtp_handle_control(USBDevice *dev, USBPacket *p,
if (s->write_pending) {
g_free(s->dataset.filename);
s->write_pending = false;
+ s->dataset.size = 0;
}
usb_mtp_data_free(s->data_out);
s->data_out = NULL;
@@ -1693,6 +1694,7 @@ done:
}
free:
g_free(s->dataset.filename);
+ s->dataset.size = 0;
g_free(path);
s->write_pending = false;
}
--
2.14.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/3] Misc usb-mtp fixes
2018-09-07 22:08 [Qemu-devel] [PATCH v2 0/3] Misc usb-mtp fixes Bandan Das
` (2 preceding siblings ...)
2018-09-07 22:08 ` [Qemu-devel] [PATCH v2 3/3] usb-mtp: reset ObjectInfo dataset size on cleanup Bandan Das
@ 2018-09-13 11:54 ` Gerd Hoffmann
3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2018-09-13 11:54 UTC (permalink / raw)
To: Bandan Das; +Cc: qemu-devel
On Fri, Sep 07, 2018 at 06:08:48PM -0400, Bandan Das wrote:
> v2:
> Same as v1 but with another minor cleanup
> patch. The write buffer breakup is still WIP.
>
> A documentation fix and changes to return the
> right error code on write failures.
Added to usb queue.
thanks,
Gerd
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-09-13 11:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-07 22:08 [Qemu-devel] [PATCH v2 0/3] Misc usb-mtp fixes Bandan Das
2018-09-07 22:08 ` [Qemu-devel] [PATCH v2 1/3] usb-mtp: fix error conditions for write operation Bandan Das
2018-09-07 22:08 ` [Qemu-devel] [PATCH v2 2/3] doc: replace x-root with rootdir for usb-mtp Bandan Das
2018-09-07 22:08 ` [Qemu-devel] [PATCH v2 3/3] usb-mtp: reset ObjectInfo dataset size on cleanup Bandan Das
2018-09-13 11:54 ` [Qemu-devel] [PATCH v2 0/3] Misc usb-mtp fixes Gerd Hoffmann
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).