usb: fixes for mtp, hub and ohci.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJbsejEAAoJEEy22O7T6HE4PMkP+wSKv+1IXRAQUJOzGaptirnM saRNuglceC5Y4WXqKtoMe0J55J1d5HUrKoxuBULyLxXZmJB8lkiFUyzkgIwcNJEX MNsKeympva74EX4/JGz6CnbqcBleeuHT8pZfTwE7KlN3yyPRC2lQ0HmR1VMz9S/e kEALeQWGF9fcF0SIcoNSJgmF02JsElTi67YlK+1GIecdvsfUvEY1X9KyVEFk45RX fWLoUmz2hZlVzVVNq3+ZWbb53a9dMpPUXZgLWb5BRV12f8wh4tdH2s5i3QE5xYY8 wgfnVkGsVMCks4qBKRsMysNpJkbm6YTxH3P8I07SselQi0rl2n7y0QU21Jeeoi5p 7Bv7U0ECa66vi+/hjJ15FfvLfgPwNEkAUqyO66hKgQXlr+huGgYnpc9GEbpYYH6N 9fyljOk/RJ5erjk/vFVmnSuhP9cv2vFqti0jOXRyHxvfL1oSTx/EZ2pXYWApa4UJ qngS/P5EtJS7qKdD36VAt/eo53toypxole8ULgSdgUwa8bk6E+RCPENMRg2XInqs i+ia0IktOlfV3DTAhMLwEs6heqi3b29/rxTcWmrfxmhrUnV/LpcAK8KenvTj+AsD MhRi5kFLaC5k5bwTFz/lG2UaO7dbhqW5/7XZKzNkhfAfdiTIrboj2jTE6IHz4ekH dWTQvZtNtuBkrnA5XEx5 =hIG+ -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/usb-20181001-pull-request' into staging usb: fixes for mtp, hub and ohci. # gpg: Signature made Mon 01 Oct 2018 10:28:36 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/usb-20181001-pull-request: ohci: set effectively usb frame rate to 1kHz usb-hub: clear suspend on detach usb-mtp: reset ObjectInfo dataset size on cleanup doc: replace x-root with rootdir for usb-mtp usb-mtp: fix error conditions for write operation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
24c3833717
@ -191,6 +191,10 @@ static void usb_hub_detach(USBPort *port1)
|
||||
port->wPortStatus &= ~PORT_STAT_ENABLE;
|
||||
port->wPortChange |= PORT_STAT_C_ENABLE;
|
||||
}
|
||||
if (port->wPortStatus & PORT_STAT_SUSPEND) {
|
||||
port->wPortStatus &= ~PORT_STAT_SUSPEND;
|
||||
port->wPortChange |= PORT_STAT_C_SUSPEND;
|
||||
}
|
||||
usb_wakeup(s->intr, 0);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
@ -1665,13 +1666,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;
|
||||
@ -1692,6 +1694,7 @@ done:
|
||||
}
|
||||
free:
|
||||
g_free(s->dataset.filename);
|
||||
s->dataset.size = 0;
|
||||
g_free(path);
|
||||
s->write_pending = false;
|
||||
}
|
||||
|
@ -1253,12 +1253,12 @@ static int ohci_service_ed_list(OHCIState *ohci, uint32_t head, int completion)
|
||||
/* set a timer for EOF */
|
||||
static void ohci_eof_timer(OHCIState *ohci)
|
||||
{
|
||||
ohci->sof_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
timer_mod(ohci->eof_timer, ohci->sof_time + usb_frame_time);
|
||||
}
|
||||
/* Set a timer for EOF and generate a SOF event */
|
||||
static void ohci_sof(OHCIState *ohci)
|
||||
{
|
||||
ohci->sof_time += usb_frame_time;
|
||||
ohci_eof_timer(ohci);
|
||||
ohci_set_interrupt(ohci, OHCI_INTR_SF);
|
||||
}
|
||||
@ -1362,6 +1362,7 @@ static int ohci_bus_start(OHCIState *ohci)
|
||||
* can meet some race conditions
|
||||
*/
|
||||
|
||||
ohci->sof_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
ohci_eof_timer(ohci);
|
||||
|
||||
return 1;
|
||||
@ -1476,6 +1477,9 @@ static uint32_t ohci_get_frame_remaining(OHCIState *ohci)
|
||||
* set already.
|
||||
*/
|
||||
tks = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ohci->sof_time;
|
||||
if (tks < 0) {
|
||||
tks = 0;
|
||||
}
|
||||
|
||||
/* avoid muldiv if possible */
|
||||
if (tks >= usb_frame_time)
|
||||
|
@ -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}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user