usb: misc fixes

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJXMxUBAAoJEEy22O7T6HE4R+sQALnPiINyxgh0TccX0PXlj8SB
 Tou19B1F+Jyxu7UEUpvxxaTnc15xLCvp1b1aHTGkbzdoFBElVEnEYBIlpRZeGggg
 bmyJLvKZ5tFt29e+Vqd/laCt0VmICBaq6gyytInJw8JyhK7TWY6RnZAnrT+Q/wbG
 lQ1a4WN+VeVkNB+U7Kq1bhxUWlt4ljRW6gD/8J2itO+OENx1eOcUsqYTd8EcVIV3
 LNWo12NFoXID5QTgdWWZVOjY+umB1OmJlIlIkttELgi1p1u8q+Fti0BydI0f/CHk
 ncfJ+mx5AFcbBSam3EnzlY9/N5oDNQLBKX5aKgMYtI9P+fbHad7mAVKk/cAuxM4U
 2kcTvI7faIKwdiNC9afk08CFkaZwMTfysWPMji1fVT0qyMxClp30eYxEffgxTY6o
 9zUfKvLlYydqypTaotpDkst3PoPi5GZvuVysxpFIAgVUryXRFgNUXZidM8k3nQGj
 E/yjMyOcF/mqno7Qgj2kUfLVRGCT+/v1ehOTWpo2fuzwJX4FPINGNOb3TdnJZ+5g
 zRRPM6jPPrJbO5IMWBZvF4wpKdcyNul+vpmEYkP4AKqPX9KdSE12cDNYdw04uNT7
 oWc5wPkozhgHzQxzeAG5ce9dHm+akcY4M6O7SK1UaF4R9N1mJRmrGvDpoS7MwDAe
 698ui4T1hGJXWzu3WrGd
 =KS11
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20160511-1' into staging

usb: misc fixes

# gpg: Signature made Wed 11 May 2016 12:18:25 BST using RSA key ID D3E87138
# 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>"

* remotes/kraxel/tags/pull-usb-20160511-1:
  usb: Support compilation without poll.h
  usb-mtp: fix usb_mtp_get_device_info so that libmtp on the guest doesn't complain
  usb:xhci: no DMA on HC reset

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2016-05-12 14:34:35 +01:00
commit f83b70f701
3 changed files with 18 additions and 4 deletions

View File

@ -788,8 +788,8 @@ static MTPData *usb_mtp_get_device_info(MTPState *s, MTPControl *c)
trace_usb_mtp_op_get_device_info(s->dev.addr);
usb_mtp_add_u16(d, 100);
usb_mtp_add_u32(d, 0xffffffff);
usb_mtp_add_u16(d, 0x0101);
usb_mtp_add_u32(d, 0x00000006);
usb_mtp_add_u16(d, 0x0064);
usb_mtp_add_wstr(d, L"");
usb_mtp_add_u16(d, 0x0000);

View File

@ -1531,7 +1531,10 @@ static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid,
usb_packet_cleanup(&epctx->transfers[i].packet);
}
xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED);
/* only touch guest RAM if we're not resetting the HC */
if (xhci->dcbaap_low || xhci->dcbaap_high) {
xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED);
}
timer_free(epctx->kick_timer);
g_free(epctx);

View File

@ -34,7 +34,9 @@
*/
#include "qemu/osdep.h"
#ifndef CONFIG_WIN32
#include <poll.h>
#endif
#include <libusb.h>
#include "qapi/error.h"
@ -204,6 +206,8 @@ static const char *err_names[] = {
static libusb_context *ctx;
static uint32_t loglevel;
#ifndef CONFIG_WIN32
static void usb_host_handle_fd(void *opaque)
{
struct timeval tv = { 0, 0 };
@ -223,9 +227,13 @@ static void usb_host_del_fd(int fd, void *user_data)
qemu_set_fd_handler(fd, NULL, NULL, NULL);
}
#endif /* !CONFIG_WIN32 */
static int usb_host_init(void)
{
#ifndef CONFIG_WIN32
const struct libusb_pollfd **poll;
#endif
int i, rc;
if (ctx) {
@ -236,7 +244,9 @@ static int usb_host_init(void)
return -1;
}
libusb_set_debug(ctx, loglevel);
#ifdef CONFIG_WIN32
/* FIXME: add support for Windows. */
#else
libusb_set_pollfd_notifiers(ctx, usb_host_add_fd,
usb_host_del_fd,
ctx);
@ -247,6 +257,7 @@ static int usb_host_init(void)
}
}
free(poll);
#endif
return 0;
}