1. 07 9月, 2011 6 次提交
    • G
      usb-host: claim port · 9516bb47
      Gerd Hoffmann 提交于
      When configured to pass through a specific host port (using hostbus and
      hostport properties), try to claim the port if supported by the kernel.
      That will avoid any kernel drivers binding to devices plugged into that
      port.  It will not stop any userspace apps (such as usb_modeswitch)
      access the device via usbfs though.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      9516bb47
    • G
      usb-host: fix configuration tracking. · eb7700bb
      Gerd Hoffmann 提交于
      It is perfectly fine to leave the usb device in unconfigured state
      (USBHostDevice->configuration == 0).  Just do that and wait for the
      guest to explicitly set a configuration.  This is closer to what real
      hardware does and it also simplifies the device initialization.  There
      is no need to figure how the device is configured on the host.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      eb7700bb
    • G
      usb-host: limit open retries · 3ee886c5
      Gerd Hoffmann 提交于
      Limit the number of times qemu tries to open host devices to three.
      Reset error counter when the device goes away, after un-plugging and
      re-plugging the device qemu will try again three times.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      3ee886c5
    • G
      usb-host: fix halted endpoints · 9b87e19b
      Gerd Hoffmann 提交于
      Two fixes for the price of one ;)
      
      First, reinitialize the endpoint table after device reset.
      This is needed anyway as the reset might have switched interfaces.
      It also clears the endpoint halted state.
      
      Second the CLEAR_HALT ioctl wants a unsigned int passed in as
      argument, not uint8_t.
      
      This gets my usb sd card reader (sandisk micromate) going.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      9b87e19b
    • G
      usb-host: reapurb error report fix · 40197c35
      Gerd Hoffmann 提交于
      Don't report errors on devices which are in disconnected
      and closing state.
      40197c35
    • G
      usb-host: start tracing support · e6a2f500
      Gerd Hoffmann 提交于
      Add a bunch of trace points to usb-linux.c  Drop a bunch of DPRINTK's in
      favor of the trace points.  Also cleanup error reporting a bit while being
      at it.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      e6a2f500
  2. 21 8月, 2011 1 次提交
  3. 04 8月, 2011 2 次提交
    • G
      usb-host: iovec support · b621bab4
      Gerd Hoffmann 提交于
      Add full support for iovecs to usb-host.  The code can split large
      transfers into smaller ones already, we are using this to also split
      requests at iovec borders.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      b621bab4
    • G
      usb: use iovecs in USBPacket · 4f4321c1
      Gerd Hoffmann 提交于
      Zap data pointer from USBPacket, add a QEMUIOVector instead.
      Add a bunch of helper functions to manage USBPacket data.
      Switch over users to the new interface.
      
      Note that USBPacket->len was used for two purposes:  First to
      pass in the buffer size and second to return the number of
      transfered bytes or the status code on async transfers.  There
      is a new result variable for the latter.  A new status code
      was added to catch uninitialized result.
      
      Nobody creates iovecs with more than one element (yet).
      Some users are (temporarely) limited to iovecs with a single
      element to keep the patch size as small as possible.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      4f4321c1
  4. 24 7月, 2011 1 次提交
  5. 23 6月, 2011 6 次提交
  6. 14 6月, 2011 8 次提交
  7. 08 6月, 2011 1 次提交
  8. 26 5月, 2011 8 次提交
    • G
      usb: move cancel callback to USBDeviceInfo · eb5e680a
      Gerd Hoffmann 提交于
      Remove the cancel callback from the USBPacket struct, move it over
      to USBDeviceInfo.  Zap usb_defer_packet() which is obsolete now.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      eb5e680a
    • G
      usb-linux: fix max_packet_size for highspeed. · 6dfcdccb
      Gerd Hoffmann 提交于
      Calculate the max packet size correctly.  Only bits 0..11 specify the size,
      bits 11+12 specify the number of (highspeed) microframes the endpoint wants
      to use.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      6dfcdccb
    • G
      usb-linux: split large xfers · 71138531
      Gerd Hoffmann 提交于
      Add support for splitting large transfers into multiple smaller ones.
      This is needed for the upcoming EHCI emulation which allows guests
      to submit requests up to 20k in size.  The linux kernel allows 16k
      max size though.
      
      Based on a patch from David Ahern, see
      http://www.mail-archive.com/qemu-devel@nongnu.org/msg30337.html
      
      Cc: David Ahern <daahern@cisco.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      71138531
    • G
      usb-linux: walk async urb list in cancel · 227ebeb5
      Gerd Hoffmann 提交于
      Lookup async urbs which are to be canceled using the linked list
      instead of the direct opaque pointer.  There are two reasons we
      are doing that:  First, to avoid the opaque poiner to the callback,
      which is needed for upcoming cleanups.  Second, because we might
      need multiple urbs per request for highspeed support, so a single
      opaque pointer doesn't cut it any more anyway.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      227ebeb5
    • G
      usb-linux: track aurbs in list · 7a8fc83f
      Gerd Hoffmann 提交于
      This patch adds code to track all async urbs in a linked list,
      so we can find them without having to pass around a opaque
      pointer to them.  Prerequisite for the cleanups.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      7a8fc83f
    • G
      usb-linux: add hostport property · 9056a297
      Gerd Hoffmann 提交于
      This patch adds a hostport property which allows to specify the host usb
      devices to pass through by bus number and physical port.  This means you
      can basically hand over one (or more) of the usb plugs on your host to
      the guest and whatever device is plugged in there will show up in the
      guest.
      
      Usage:
      
        -device usb-host,hostbus=1,hostport=1
      
      You can figure the port numbers by plugging in some usb device, then
      find it in "info usbhost" and pick bus and port specified there.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      9056a297
    • G
      usb-linux: fix device path aka physical port handling · 5557d820
      Gerd Hoffmann 提交于
      The device path isn't just a number.  It specifies the physical port
      the device is connected to and in case the device is connected via
      usb hub you'll have two numbers there, like this: "5.1".  The first
      specifies the root port where the hub is plugged into, the second
      specifies the port number of the hub where the device is plugged in.
      With multiple hubs chained the string can become longer.
      
      This patch renames devpath to port and makes it a string.   It also
      adapts the sysfs parsing code accordingly.  The parser code is also more
      strict now and skips the root hubs (which can't be assigned anyway).
      
      The "info usbhost" monitor command now prints bus number, (os-assigned)
      device address and physical port for each device.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      5557d820
    • H
      usb-linux: use usb_generic_handle_packet() · 50b7963e
      Hans de Goede 提交于
      Make the linux usb host passthrough code use the usb_generic_handle_packet()
      function, rather then the curent DYI code. This removes 200 lines of almost
      identical code.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      50b7963e
  9. 09 5月, 2011 1 次提交
  10. 04 5月, 2011 6 次提交
    • G
      usb: move complete callback to port ops · 13a9a0d3
      Gerd Hoffmann 提交于
      13a9a0d3
    • H
      usb-linux: Add support for buffering iso out usb packets · bb6d5498
      Hans de Goede 提交于
      Extend the iso buffering code to also buffer iso out packets, this
      fixes for example using usb speakers with usb redirection.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      bb6d5498
    • H
      usb-linux: We only need to keep track of 15 endpoints · 3a4854b3
      Hans de Goede 提交于
      Currently we reserve room for endpoint data for 16 endpoints, but given
      that we only use endpoint data for endpoints 1-15, and always index the
      array with the endpoint-number - 1, 15 is enough.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      3a4854b3
    • H
      usb-linux: Refuse iso packets when max packet size is 0 (alt setting 0) · 975f2998
      Hans de Goede 提交于
      Refuse iso usb packets when then max packet size for the endpoint is 0,
      this avoids an abort in usb_host_alloc_iso() caused by trying to qemu_malloc
      a 0 bytes large buffer.
      975f2998
    • H
      usb-linux: Refuse packets for endpoints which are not in the usb descriptor · a0b5fece
      Hans de Goede 提交于
      If an endpoint is not in the usb descriptor we've no idea what kind of
      endpoint it is and thus how to handle it, refuse packages in this case.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      a0b5fece
    • H
      usb-linux: Add support for buffering iso usb packets · 060dc841
      Hans de Goede 提交于
      Currently we are submitting iso packets to the host one at a time, as we
      receive them from the emulated host controller. This has 2 problems:
      1) If we were fast enough to submit every packet in time for the next host host
      controller usb frame, we would be generating 1000 hardware interrupts per
      second on the host
      2) We are not fast enough to submit every packet in time for the next host host
      controller usb frame, causing us to not submit iso urbs in some usb frames
      which causes devices with an endpoint with an interval of 1 ms (so every
      frame) to loose data. This causes for example ubs-1.1 webcams to not work
      properly (usb-2.0 is not supported at all atm).
      
      This patch fixes both problems by changing the iso packet pass through handling
      to buffer packets. This version only does so for iso input packets (webcams,
      audio in) I'm working on a second patch extending this to iso output packets
      (audio out).
      
      This patch makes use of the linux batching of iso packets in one urb.
      When an iso in packet gets received from the emulated host controller,
      it immediately submits 3 urbs with 32 iso in packets each. This causes
      the host to only get an hw interrupt every 32 packets dropping the
      interrupt rate to 32 interrupts per second and gives it a queue of urbs
      to work from once the first 32 iso in packets have been received to make sure
      no packets are dropped.
      
      Besides submitting a whole bunch or urbs as soon as the first urb is
      received, effectively creating a buffer inside the kernel, this patch also
      gets rid of the asynchroneous completion for iso in urbs. Instead they are
      only marked as complete in the fd write callback (which usbfs uses to signal
      complete urbs). These complete packets then get consumed by returning them
      synchroneously to the emulated host controller when it submits an iso in
      packet for the ep in question. When no complete packets are ready (which
      happens when the stream is starting) a 0 length packet gets returned to
      the emulated host controller.
      
      With this patch I've several usb-1.1 webcams working well with usb pass
      through, where as without this patch none of them work.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      060dc841