summaryrefslogtreecommitdiff
path: root/hw/usb
AgeCommit message (Collapse)AuthorFilesLines
2014-03-19unifying: rename input queue, fix error queuePeter Wu2-14/+40
Fix error queue name, rename input queue for clarity. Split input and output queue for further work and NAK when there is no interrupt data available.
2014-03-18unifying: WIP for HID++ supportPeter Wu4-14/+326
Error queue is implemented, possible receiver and device properties are filled in (in the header). Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-17unifying: move definitions to headerPeter Wu2-19/+47
Prepare for adding DJ support, which I expect to be huge and unrelated to the HID code. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-17usbdump: fix endpoint lookupPeter Wu1-5/+9
bNumEndpoints specify the number of endpoints in the endpoint descriptor. When the mouse endpoint was tried (EP2), it triggered this assertion because there is only one endpoint for the interface. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-17unifying: support HID Get_Report and Set_ReportPeter Wu1-8/+13
Copied from dev-hid.c (order changed to match interfaces order). Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-17unifying: implement basic HID processingPeter Wu1-22/+143
For now, the receiver has always a mouse and keyboard paired. Set_Idle, Get_Idle, Get_Protocol and Set_Protocol support interface-specific devices. Interrupt data for the HID mode are also implemented. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-17usbdump: do not hard-code bus number, use nr from USBBusPeter Wu1-1/+3
Instead of changing bus.c (next_usb_bus) and possibly breaking configurations relying on this number, just add one in the dump code for cosmetic purposes. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16usbdump: fix start time offset of capturePeter Wu1-3/+2
There is still a discrepancy (seen 300 ms and 600 ms), but it is better than completely a difference equal to the uptime. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16usb-hid: usbdump example for control and interrupt INPeter Wu1-0/+17
This is verified to reproduce the same capture as done inside the VM. The differences are in time, bInterval, URB length, URB ID and the Copy of transfer flags. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16usbdump: comments updatePeter Wu2-3/+28
And I was wondering why the interrupt packets in dev-hid.c had a reversed type marking...
2014-03-16usbdump: fix IN marking for non-control packetsPeter Wu1-2/+8
Non-control transfers have a meaningless setup buffer. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16usbdump: constantify variablesPeter Wu2-17/+17
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16usbdump: fix reversal of URB length and captured lengthPeter Wu1-4/+11
The "length" field stores the expected size of data. "len_cap" stores the real length of the data in the current packet (the "captured" data). Also try to set a slightly more sane length value depending on submission type, but this is much braindead. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16usbdump: fix interval retrieval for endpointPeter Wu1-2/+4
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16usbdump: initial API extension for handle_dataPeter Wu2-1/+83
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16usbdump: fail early if dump file is not availablePeter Wu3-8/+15
This allows for less less checking by the consumer and avoids unnecessary work if the capture cannot be written anyway. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16unifying: remove unused leftover from dev-wacomPeter Wu1-186/+7
To make a tidy ship, remove unused parts that were taken from dev-wacom. Also enable a handle_data callback (currently empty), handle_reset (currently sets the device mode to HID instead of DJ). This is incomplete, the handle_data callback must contain something. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16usbdump: get interval from descriptorPeter Wu1-2/+21
It looks very ugly, perhaps a helper function should moved to desc.c? Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16unifying: hook up usbdump with handle_controlPeter Wu1-6/+30
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16Initial usbdump helperPeter Wu3-0/+430
USB packets are captured in the pcap format using the Linux usbmon link-layer type. Right now, this only works with handle_ctrl. Data packets (isochronous, bulk and interrupt) are not (fully) implemented yet. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-03-16unifying: WIP for Logitech Unifying Receiver emulationPeter Wu2-0/+669
Based on hw/usb/dev-wacom.c
2014-03-09Add a 'name' parameter to qemu_thread_createDr. David Alan Gilbert1-4/+4
If enabled, set the thread name at creation (on GNU systems with pthread_set_np) Fix up all the callers with a thread name Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2014-02-20Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-3' into stagingPeter Maydell13-70/+72
- xhci improvements and fixes. - uhci bugfix. - cleanups. # gpg: Signature made Tue 18 Feb 2014 15:48:10 GMT 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-3: xhci: use DPRINTF() instead of fprintf(stderr, ...) xhci: switch debug printf to tracepoint xhci iso: allow for some latency xhci iso: fix time calculation uhci: invalidate queue on device address changes xhci: fix overflow in usb_xhci_post_load usb: Remove magic constants from device bmAttributes Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-02-20Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' ↵Peter Maydell1-2/+2
into staging QOM infrastructure fixes and device conversions * QTest cleanups and test cases for PCI NICs * NAND fix for "info qtree" * Cleanup and extension of QOM machine tests * IndustryPack test cases and conversion to QOM realize * I2C cleanups * Cleanups of legacy qdev properties # gpg: Signature made Mon 17 Feb 2014 22:15:37 GMT using RSA key ID 3E7E013F # gpg: Good signature from "Andreas Färber <afaerber@suse.de>" # gpg: aka "Andreas Färber <afaerber@suse.com>" * remotes/afaerber/tags/qom-devices-for-peter: (49 commits) qtest: Include system headers before user headers qapi: Refine human printing of sizes qdev: Use QAPI type names for properties qdev: Add enum property types to QAPI schema block: Handle "rechs" and "large" translation options qdev: Remove hex8/32/64 property types qdev: Remove most legacy printers qdev: Use human mode in "info qtree" qapi: Add human mode to StringOutputVisitor qdev: Inline qdev_prop_parse() qdev: Legacy properties are just strings qdev: Legacy properties are now read-only qdev: Remove legacy parsers for hex8/32/64 qdev: Sizes are now parsed by StringInputVisitor qapi: Add size parser to StringInputVisitor qtest: Don't segfault with invalid -qtest option ipack: Move IndustryPack out of hw/char/ ipoctal232: QOM parent field cleanup ipack: QOM parent field cleanup for IPackDevice ipack: QOM parent field cleanup for IPackBus ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-02-18xhci: use DPRINTF() instead of fprintf(stderr, ...)Gerd Hoffmann1-45/+45
So we don't spam stderr with (guest-triggerable) messages by default. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-18xhci: switch debug printf to tracepointGerd Hoffmann1-3/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-18xhci iso: allow for some latencyGerd Hoffmann1-1/+1
Allow the scheduled transfer time be a bit behind, to compensate for latencies. Without this xhci will wait way to often for the mfindex wraparound, assuming the scheduled time is in the future just because qemu is a bit behind in processing the iso transfer requests. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-18xhci iso: fix time calculationGerd Hoffmann1-2/+2
Frameid specifies frames not microframes, so we need to shift it to get the microframe index. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-18uhci: invalidate queue on device address changesGerd Hoffmann1-0/+2
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-18xhci: fix overflow in usb_xhci_post_loadGerd Hoffmann1-1/+1
Found by Coverity. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-18usb: Remove magic constants from device bmAttributesPantelis Koukousoulas11-18/+20
Replace magic constants in device bmAttributes with symbolic ones from Linux kernel ch9.h Signed-off-by: Pantelis Koukousoulas <pktoss@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-17Use error_is_set() only when necessaryMarkus Armbruster1-1/+1
error_is_set(&var) is the same as var != NULL, but it takes whole-program analysis to figure that out. Unnecessarily hard for optimizers, static checkers, and human readers. Dumb it down to obvious. Gets rid of several dozen Coverity false positives. Note that the obvious form is already used in many places. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-02-14qdev: Remove hex8/32/64 property typesPaolo Bonzini1-2/+2
Replace them with uint8/32/64. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-02-10qdev:pci: refactor PCIDevice to use generic "hotpluggable" propertyIgor Mammedov4-4/+4
Get rid of PCIDevice specific PCIDeviceClass.no_hotplug and use generic DeviceClass.hotpluggable field instead. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-01-16usb-hid: add microsoft os descriptor supportGerd Hoffmann1-0/+8
Set SelectiveSuspendEnabled registy entry to one. This makes Windows use remote suspend by default, without manual registry fiddeling. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-01-16usb: add support for microsoft os descriptorsGerd Hoffmann5-6/+280
This patch adds support for special usb descriptors used by microsoft windows. They allow more fine-grained control over driver binding and adding entries to the registry for configuration. As this is a guest-visible change the "msos-desc" compat property has been added to turn this off for 1.7 + older Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-12-06Merge remote-tracking branch 'kraxel/tags/pull-usb-1' into stagingAnthony Liguori8-87/+290
Improvements for usb3 bulk stream (usb core, xhci). Bugfixes for uas emulation. Add remote wakeup support for ehci. Add suspend support for xhci. Misc minor tweaks and fixes. # gpg: Signature made Thu 28 Nov 2013 11:44:49 PM PST using RSA key ID D3E87138 # gpg: Can't check signature: public key not found # By Hans de Goede (11) and others # Via Gerd Hoffmann * kraxel/tags/pull-usb-1: usb: move usb_{hi,lo} helpers to header file. usb: add vendor request defines trace-events: Clean up after removal of old usb-host code Revert "usb-tablet: Don't claim wakeup capability for USB-2 version" ehci: implement port wakeup xhci: Call usb_device_alloc/free_streams usb: Add usb_device_alloc/free_streams usb: Add max_streams attribute to endpoint info uas: s/ui/iu/ uas: Fix response iu struct definition uas: Bounds check tags when using streams uas: Streams are numbered 1-y, rather then 0-x uas: Fix / cleanup usb_uas_task error handling uas: Only use report iu-s for task_mgmt status reporting scsi: Add 2 new sense codes needed by uas xhci: add support for suspend/resume xhci: Add a few missing checks for disconnected devices Message-id: 1385712381-30918-1-git-send-email-kraxel@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-12-02trace: Remove trace.h from hw/usb/hcd-ehci.h (less dependencies)Stefan Weil2-1/+1
This reduces the dependencies on trace.h. Only one source file which needs hcd-ehci.h also needs trace.h. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-11-28usb: move usb_{hi,lo} helpers to header file.Gerd Hoffmann2-10/+11
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-28Revert "usb-tablet: Don't claim wakeup capability for USB-2 version"Gerd Hoffmann1-1/+1
This reverts commit aa1c9e971e80d25b92908dce3dec7c38b49480ea. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-28ehci: implement port wakeupGerd Hoffmann1-2/+16
Update portsc register and raise irq in case a suspended port is woken up, so remote wakeup works on our ehci ports. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-26xhci: Call usb_device_alloc/free_streamsHans de Goede1-0/+117
Note this code is not as KISS as I would like, the reason for this is that the Linux kernel interface wants streams on eps belonging to one interface to be allocated in one call. Things will also work if we do this one ep at a time (as long as all eps support the same amount of streams), but lets stick to the kernel API. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-26usb: Add usb_device_alloc/free_streamsHans de Goede1-0/+18
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-26usb: Add max_streams attribute to endpoint infoHans de Goede2-0/+24
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-26uas: s/ui/iu/Hans de Goede1-38/+38
The various uas data structures are called IU-s, which is short for Information Unit, rather then UI-s. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-26uas: Fix response iu struct definitionHans de Goede1-10/+8
This patch mirrors a patch to the Linux uas kernel driver which I've just submitted. It looks like the qemu uas struct definitions were taken from the Linux kernel driver, and have inherited the same mistake. Besides fixing the response iu struct, the patch also drops the add_info parameter from the usb_uas_queue_response() function, it is always 0 anyways, and expressing 3 zero-bytes as a function argument is a bit hard. Below is the long explanation for this change taken from the kernel commit: The response iu struct before this patch has a size of 7 bytes, which is weird since all other iu-s are explictly padded to a multiple of 4 bytes. Submitting a 7 byte bulk transfer to the status endpoint of a real uasp device when expecting a response iu results in an USB babble error, as the device actually sends 8 bytes. Up on closer reading of the UAS spec: http://www.t10.org/cgi-bin/ac.pl?t=f&f=uas2r00.pdf The reason for this becomes clear, the 2 entries in "Table 17 — RESPONSE IU" are numbered 4 and 6, looking at other iu definitions in the spec, esp. multi-byte fields, this indicates that the ADDITIONAL RESPONSE INFORMATION field is not a 2 byte field as one might assume at a first look, but is a multi-byte field containing 3 bytes. This also aligns with the SCSI Architecture Model 4 spec, which UAS is based on which states in paragraph "7.1 Task management function procedure calls" that the "Additional Response Information" output argument for a Task management function procedure call is 3 bytes. Last but not least I've verified this by sending a logical unit reset task management call with an invalid lun to an actual uasp device, and received back a response-iu with byte 6 being 0, and byte 7 being 9, which is the responce code for an invalid iu, which confirms that the response code is being reported in byte 7 of the response iu rather then in byte 6. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-26uas: Bounds check tags when using streamsHans de Goede1-0/+14
Disallow the guest to cause us to address the data3 and status3 arrays out of bounds. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-26uas: Streams are numbered 1-y, rather then 0-xHans de Goede1-3/+3
It is easier to simply make the arrays one larger, rather then substracting one everywhere. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-26uas: Fix / cleanup usb_uas_task error handlingHans de Goede1-17/+3
-The correct error if we cannot find the dev is INCORRECT_LUN rather then INVALID_INFO_UNIT -Move the device not found check to the top so we only need to do it once -Remove the dev->lun != lun checks, dev is returned by scsi_device_find which searches by lun, so this will never trigger Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-26uas: Only use report iu-s for task_mgmt status reportingHans de Goede1-8/+22
Regular scsi cmds should always report their status using a sense-iu, using the sense code to report any errors. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>