usb patch queue for 0.15
Hi,
Here comes the updated usb patch queue for 0.15. It is rebased to latest master, gained one more bugfix and usb network redirection support, so it is now four patches instead of two.
Adding usb network redirection support doesn't fall into bugfixing, but as it just adds a new driver and thus can hardly cause regressions I think it is fine to merge for 0.15 nevertheless.
please pull,
Gerd
The following changes since commit d1afc48b7cfdb4490f322d5d82a2aae6d545ec06:
SPARC64: implement addtional MMU faults related to nonfaulting load (2011-07-21 20:02:22 +0000)
are available in the git repository at:
git://git.kraxel.org/qemu usb.21
Gerd Hoffmann (3):
usb-hid: fixup changed tracking.
usb-uhci: fix irq handling on error.
usb-ehci: trace: rename "next" to "nxt".
Hans de Goede (1):
USB: add usb network redirection support
Makefile.objs | 1 + configure | 28 ++ hw/usb-hid.c | 9 +- hw/usb-uhci.c | 6 + trace-events | 6 +- usb-redir.c | 1218 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 1260 insertions(+), 8 deletions(-) create mode 100644 usb-redir.c
PATCH 1/4 usb-hid: fixup changed tracking.
Remove leftover calls to usb_hid_changed().
Take care to update the changed flag after delivering a event via GET_REPORT like we do when sending events via interrupt endpoint.
--- hw/usb-hid.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
hw/usb-hid.c +4 -5
@@ -531,18 +531,15 @@ static void usb_keyboard_process_keycode(USBHIDState *hs)case 0xe0 :if (s->modifiers & (1 <<9 )) { s->modifiers ^=3 <<8 ; -usb_hid_changed (hs);return ; } case 0xe1 ... 0xe7:if (keycode & (1 <<7 )) { s->modifiers &= ~(1 << (hid_code &0x0f )); -usb_hid_changed (hs);return ; } case 0xe8 ... 0xef: s->modifiers |=1 << (hid_code &0x0f ); -usb_hid_changed (hs);return ; }
@@ -769,10 +766,12 @@ static int usb_hid_handle_control(USBDevice *dev, USBPacket *p, }break ;case GET_REPORT : -if (s->kind ==USB_MOUSE || s->kind ==USB_TABLET ) +if (s->kind ==USB_MOUSE || s->kind ==USB_TABLET ) { ret =usb_pointer_poll (s, data, length); -else if (s->kind ==USB_KEYBOARD ) + }else if (s->kind ==USB_KEYBOARD ) { ret =usb_keyboard_poll (s, data, length); + } + s->changed = s->n >0 ;break ;case SET_REPORT :if (s->kind ==USB_KEYBOARD )
Signature · 1 line
1.7.1
PATCH 2/4 usb-uhci: fix irq handling on error.
In reply to Gerd HoffmannSpec on UHCI_STS_USBERR: "If the TD on which the error interrupt occurred also had its IOC bit set, both this bit and Bit 0 are set."
Make UHCI emulation do that.
--- hw/usb-uhci.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
hw/usb-uhci.c +6 -0
@@ -730,6 +730,9 @@ out: td->ctrl |=TD_CTRL_STALL ; td->ctrl &= ~TD_CTRL_ACTIVE ; s->status |=UHCI_STS_USBERR ; +if (td->ctrl &TD_CTRL_IOC ) { + *int_mask |=0x01 ; + }uhci_update_irq (s);return 1 ;
@@ -737,6 +740,9 @@ out: td->ctrl |=TD_CTRL_BABBLE |TD_CTRL_STALL ; td->ctrl &= ~TD_CTRL_ACTIVE ; s->status |=UHCI_STS_USBERR ; +if (td->ctrl &TD_CTRL_IOC ) { + *int_mask |=0x01 ; + }uhci_update_irq (s);/* frame interrupted */ return -1 ;
Signature · 1 line
1.7.1
PATCH 3/4 usb-ehci: trace: rename "next" to "nxt".
In reply to Gerd Hoffmann"next" is reserved in systemtap thus using this as a trace parameter name causes trouble when trying to trace with systemtap.
--- trace-events | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
trace-events +3 -3
@@ -216,13 +216,13 @@ disable usb_ehci_mmio_writel(uint32_t addr, const char *str, uint32_t val) "wr m disable usb_ehci_mmio_change(uint32_t addr, const char *str, uint32_t new, uint32_t old) "ch mmio %04x [%s] = %x (old: %x)" disable usb_ehci_usbsts(const char *sts, int state) "usbsts %s %d" disable usb_ehci_state(const char *schedule, const char *state) "%s schedule %s" -disable usb_ehci_qh_ptrs(void *q, uint32_t addr, uint32_t next, uint32_t c_qtd, uint32_t n_qtd, uint32_t a_qtd) "q %p - QH @ %08x: next %08x qtds %08x,%08x,%08x" +disable usb_ehci_qh_ptrs(void *q, uint32_t addr, uint32_t nxt, uint32_t c_qtd, uint32_t n_qtd, uint32_t a_qtd) "q %p - QH @ %08x: next %08x qtds %08x,%08x,%08x" disable usb_ehci_qh_fields(uint32_t addr, int rl, int mplen, int eps, int ep, int devaddr) "QH @ %08x - rl %d, mplen %d, eps %d, ep %d, dev %d" disable usb_ehci_qh_bits(uint32_t addr, int c, int h, int dtc, int i) "QH @ %08x - c %d, h %d, dtc %d, i %d" -disable usb_ehci_qtd_ptrs(void *q, uint32_t addr, uint32_t next, uint32_t altnext) "q %p - QTD @ %08x: next %08x altnext %08x" +disable usb_ehci_qtd_ptrs(void *q, uint32_t addr, uint32_t nxt, uint32_t altnext) "q %p - QTD @ %08x: next %08x altnext %08x" disable usb_ehci_qtd_fields(uint32_t addr, int tbytes, int cpage, int cerr, int pid) "QTD @ %08x - tbytes %d, cpage %d, cerr %d, pid %d" disable usb_ehci_qtd_bits(uint32_t addr, int ioc, int active, int halt, int babble, int xacterr) "QTD @ %08x - ioc %d, active %d, halt %d, babble %d, xacterr %d" -disable usb_ehci_itd(uint32_t addr, uint32_t next, uint32_t mplen, uint32_t mult, uint32_t ep, uint32_t devaddr) "ITD @ %08x: next %08x - mplen %d, mult %d, ep %d, dev %d" +disable usb_ehci_itd(uint32_t addr, uint32_t nxt, uint32_t mplen, uint32_t mult, uint32_t ep, uint32_t devaddr) "ITD @ %08x: next %08x - mplen %d, mult %d, ep %d, dev %d" disable usb_ehci_port_attach(uint32_t port, const char *device) "attach port #%d - %s" disable usb_ehci_port_detach(uint32_t port) "detach port #%d" disable usb_ehci_port_reset(uint32_t port, int enable) "reset port #%d - %d"
Signature · 1 line
1.7.1
PATCH 4/4 USB: add usb network redirection support
In reply to Gerd HoffmannFrom: Hans de Goede <[email protected]>
This patch adds support for a usb-redir device, which takes a chardev as a communication channel to an actual usbdevice using the usbredir protocol.
Compiling the usb-redir device requires usbredir-0.3 to be installed for the usbredir protocol parser, usbredir-0.3 also contains a server for redirecting usb traffic from an actual usb device. You can get the 0.3 release of usbredir here:
http://people.fedoraproject.org/~jwrdegoede/usbredir-0.3.tar.bz2
(getting a more formal site for it is a WIP)
Example usage:
1) Start usbredirserver for a usb device:
sudo usbredirserver 045e:0772
2) Start qemu with usb2 support + a chardev talking to usbredirserver + a usb-redir device using this chardev:
qemu ... \
-readconfig docs/ich9-ehci-uhci.cfg \
-chardev socket,id=usbredirchardev,host=localhost,port=4000 \
-device usb-redir,chardev=usbredirchardev,id=usbredirdev
--- Makefile.objs | 1 + configure | 28 ++ usb-redir.c | 1218 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1247 insertions(+), 0 deletions(-) create mode 100644 usb-redir.c
Makefile.objs +1 -0
@@ -205,6 +205,7 @@ hw-obj-$(CONFIG_HPET) += hpet.o hw-obj-$(CONFIG_APPLESMC) += applesmc.o hw-obj-$(CONFIG_SMARTCARD) += usb-ccid.o ccid-card-passthru.o hw-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o +hw-obj-$(CONFIG_USB_REDIR) += usb-redir.o # PPC devices hw-obj-$(CONFIG_OPENPIC) += openpic.o
configure +28 -0
@@ -177,6 +177,7 @@ spice="" rbd="" smartcard="" smartcard_nss="" +usb_redir="" opengl="" # parse CC options first
@@ -743,6 +744,10 @@ for opt do ;; --enable-smartcard-nss) smartcard_nss="yes" ;; + --disable-usb-redir) usb_redir="no" + ;; + --enable-usb-redir) usb_redir="yes" + ;; *) echo "ERROR: unknown option $opt"; show_help="yes" ;; esac
@@ -1018,6 +1023,8 @@ echo " --disable-smartcard disable smartcard support" echo " --enable-smartcard enable smartcard support" echo " --disable-smartcard-nss disable smartcard nss support" echo " --enable-smartcard-nss enable smartcard nss support" +echo " --disable-usb-redir disable usb network redirection support" +echo " --enable-usb-redir enable usb network redirection support" echo "" echo "NOTE: The object files are built at the place where configure is launched" exit 1
@@ -2371,6 +2378,22 @@ if test "$smartcard" = "no" ; then smartcard_nss="no" fi +# check for usbredirparser for usb network redirection support +if test "$usb_redir" != "no" ; then + if $pkg_config libusbredirparser >/dev/null 2>&1 ; then + usb_redir="yes" + usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null) + usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null) + QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags" + LIBS="$LIBS $usb_redir_libs" + else + if test "$usb_redir" = "yes"; then + feature_not_found "usb-redir" + fi + usb_redir="no" + fi +fi + ########################################## ##########################################
@@ -2617,6 +2640,7 @@ echo "spice support $spice" echo "rbd support $rbd" echo "xfsctl support $xfs" echo "nss used $smartcard_nss" +echo "usb net redir $usb_redir" echo "OpenGL support $opengl" if test $sdl_too_old = "yes"; then
@@ -2910,6 +2934,10 @@ if test "$smartcard_nss" = "yes" ; then echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak fi +if test "$usb_redir" = "yes" ; then + echo "CONFIG_USB_REDIR=y" >> $config_host_mak +fi + if test "$opengl" = "yes" ; then echo "CONFIG_OPENGL=y" >> $config_host_mak fi
usb-redir.c new file +1218 -0
1,218 lines not on this page · raw message
Signature · 1 line
1.7.1