diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2019-05-03 13:57:51 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2019-05-03 13:57:51 +0100 |
| commit | c58f3911b282e14991d540394e82a4be547466e5 (patch) | |
| tree | 5f3a89e9f84e2ac8b043e9d5e412f063b4da6aa5 /hw/usb/dev-mtp.c | |
| parent | 51138751827f49d94b30b52aeab4181ee19c838a (diff) | |
| parent | ccb799313a5926a6aa49018bbc67fe6165fad7f3 (diff) | |
| download | focaccia-qemu-c58f3911b282e14991d540394e82a4be547466e5.tar.gz focaccia-qemu-c58f3911b282e14991d540394e82a4be547466e5.zip | |
Merge remote-tracking branch 'remotes/kraxel/tags/usb-20190503-v2-pull-request' into staging
usb: bugfixes for mtp and xhci, split ohci-pci. # gpg: Signature made Fri 03 May 2019 07:59:39 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/usb-20190503-v2-pull-request: hw/usb: avoid format truncation warning when formatting port name hw/usb/hcd-ohci: Move PCI-related code into a separate file hw/usb/hcd-ohci: Do not use PCI functions with sysbus devices in ohci_die() usb/xhci: avoid trigger assertion if guest write wrong epid usb-mtp: change default to success for usb_mtp_update_object usb-mtp: fix alignment of access of ObjectInfo filename field usb-mtp: fix string length for filename when writing metadata Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/usb/dev-mtp.c')
| -rw-r--r-- | hw/usb/dev-mtp.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 99548b012d..d90b336d53 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -226,7 +226,7 @@ typedef struct { uint32_t assoc_desc; uint32_t seq_no; /*unused*/ uint8_t length; /*part of filename field*/ - uint16_t filename[0]; + uint8_t filename[0]; /* UTF-16 encoded */ char date_created[0]; /*unused*/ char date_modified[0]; /*unused*/ char keywords[0]; /*unused*/ @@ -1551,7 +1551,7 @@ static void usb_mtp_cancel_packet(USBDevice *dev, USBPacket *p) fprintf(stderr, "%s\n", __func__); } -static char *utf16_to_str(uint8_t len, uint16_t *arr) +static char *utf16_to_str(uint8_t len, uint8_t *str16) { wchar_t *wstr = g_new0(wchar_t, len + 1); int count, dlen; @@ -1559,7 +1559,7 @@ static char *utf16_to_str(uint8_t len, uint16_t *arr) for (count = 0; count < len; count++) { /* FIXME: not working for surrogate pairs */ - wstr[count] = (wchar_t)arr[count]; + wstr[count] = lduw_le_p(str16 + (count * 2)); } wstr[count] = 0; @@ -1587,7 +1587,7 @@ done: static int usb_mtp_update_object(MTPObject *parent, char *name) { - int ret = -1; + int ret = 0; MTPObject *o = usb_mtp_object_lookup_name(parent, name, strlen(name)); @@ -1721,7 +1721,7 @@ static void usb_mtp_write_metadata(MTPState *s, uint64_t dlen) return; } - o = usb_mtp_object_lookup_name(p, filename, dataset->length); + o = usb_mtp_object_lookup_name(p, filename, -1); if (o != NULL) { next_handle = o->handle; } |