History | View | Annotate | Download (57.3 kB)
usb-host: tag as unmigratable
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb-host: endpoint table fixup
USB Devices can have up to 15 IN and 15 OUT endpoints, not 15 endpointstotal. Move from one array to two arrays (one IN, one OUT) to maintainthe endpoint state.
usb-host: constify port
usb-host: parse port in /proc/bus/usb/devices scan
Unfortunaly this is limited to root ports.
usb-host: claim port
When configured to pass through a specific host port (using hostbus andhostport properties), try to claim the port if supported by the kernel.That will avoid any kernel drivers binding to devices plugged into thatport. It will not stop any userspace apps (such as usb_modeswitch)...
usb-host: reapurb error report fix
Don't report errors on devices which are in disconnectedand closing state.
usb-host: fix halted endpoints
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...
usb-host: limit open retries
Limit the number of times qemu tries to open host devices to three.Reset error counter when the device goes away, after un-plugging andre-plugging the device qemu will try again three times.
usb-host: fix configuration tracking.
It is perfectly fine to leave the usb device in unconfigured state(USBHostDevice->configuration == 0). Just do that and wait for theguest to explicitly set a configuration. This is closer to what realhardware does and it also simplifies the device initialization. There...
usb-host: start tracing support
Add a bunch of trace points to usb-linux.c Drop a bunch of DPRINTK's infavor of the trace points. Also cleanup error reporting a bit while beingat it.
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
usb-host: iovec support
Add full support for iovecs to usb-host. The code can split largetransfers into smaller ones already, we are using this to also splitrequests at iovec borders.
usb: use iovecs in USBPacket
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 topass in the buffer size and second to return the number of...
notifier: Pass data argument to callback
This allows to pass additional information to the notifier callbackwhich is useful if sender and receiver do not share any other distinctdata structure.
Will be used first for the clock reset notifier.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
usb: Proper error propagation for usb_device_attach errors
usb: Add a speedmask to devices
This is used to indicate at which speed[s] the device can operate,so that this can be checked to match the ports capabilities when it getsattached to a bus.
Note that currently all usb1 emulated device claim to be fullspeed, this...
usb-linux: allow "compatible" high speed devices to connect at fullspeed
Some usb2 highspeed devices, like usb-msd devices, work fine when redirectedto a usb1 virtual controller. Allow this to avoid the new speedhecks causingregressions for users who do not enable the new experimental ehci code....
usb-linux: add get_endp()
Add a helper function to get the endpoint data structureand put it into use.
usb-linux: make iso urb count contigurable
Add a qdev property for the number of iso urbs whichusb-linux keeps in flight, so it can be configured atruntime. Make it default to four (old hardcoded valueused to be three).
usb-linux: track inflight iso urb count
Track the number of iso urbs which are currently in flight.Log a message in case the count goes down to zero. Alsowarn in case many urbs are returned at the same time.
usb-linux: Get speed from sysfs rather then from the connectinfo ioctl
The connectinfo ioctl only differentiates between lo speed devices, andall other speeds, where as we would like to know the real speed. The realspeed is available in sysfs so use that when available....
usb-linux: Teach about super speed
usb-linux: Don't do perror when errno is not set
Note that "op" also is not set, so before this change these error pathswould feed NULL to perror.
usb-linux: Ensure devep != 0
So that we don't index endp_table with a negative index.
usb-linux: Don't try to open the same device twice
If a user wants to redirect 2 identical usb sticks, in theory this ispossible by doing:usb_add host:1234:5678usb_add host:1234:5678
But this will lead to us trying to open the first stick twice, since we...
usb-linux: only cleanup in host_close when host_open was successful.
usb-linux: Enlarge buffer for descriptors to 8192 bytes
1024 bytes is way to small, one hd UVC webcam I have over here has somany resolutions its descriptors take op close to 4k. Hopefully 8k willbe enough for all devices.
usb-linux: catch ENODEV in more places.
Factor out disconnect code (called when a device disappears) to aseparate function. Add a check for ENODEV errno to a few more placesto make sure we notice disconnects.
Fix compilation warning due to missing header for sigaction (followup)
This patch removes all references to signal.h when qemu-common.h is includedas they become redundant.
Signed-off-by: Alexandre Raymond <cerbere@gmail.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
usb: move cancel callback to USBDeviceInfo
Remove the cancel callback from the USBPacket struct, move it overto USBDeviceInfo. Zap usb_defer_packet() which is obsolete now.
usb-linux: use usb_generic_handle_packet()
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 almostidentical code.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
usb-linux: fix device path aka physical port handling
The device path isn't just a number. It specifies the physical portthe device is connected to and in case the device is connected viausb hub you'll have two numbers there, like this: "5.1". The first...
usb-linux: add hostport property
This patch adds a hostport property which allows to specify the host usbdevices to pass through by bus number and physical port. This means youcan basically hand over one (or more) of the usb plugs on your host tothe guest and whatever device is plugged in there will show up in the...
usb-linux: track aurbs in list
This patch adds code to track all async urbs in a linked list,so we can find them without having to pass around a opaquepointer to them. Prerequisite for the cleanups.
usb-linux: walk async urb list in cancel
Lookup async urbs which are to be canceled using the linked listinstead of the direct opaque pointer. There are two reasons weare doing that: First, to avoid the opaque poiner to the callback,which is needed for upcoming cleanups. Second, because we might...
usb-linux: split large xfers
Add support for splitting large transfers into multiple smaller ones.This is needed for the upcoming EHCI emulation which allows gueststo submit requests up to 20k in size. The linux kernel allows 16kmax size though.
Based on a patch from David Ahern, see...
usb-linux: fix max_packet_size for highspeed.
Calculate the max packet size correctly. Only bits 0..11 specify the size,bits 11+12 specify the number of (highspeed) microframes the endpoint wantsto use.
usb-linux: Add missing break statement
cppcheck report:usb-linux.c:661: warning: Redundant assignment of "len" in switch
Cc: Hans de Goede <hdegoede@redhat.com>Cc: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: move complete callback to port ops
usb-linux: introduce a usb_linux_alt_setting function
The next patch in this series introduces multiple ways to get thealt setting dependent upon usb_fs_type, it is cleaner to put thisinto its own function.
Note that this patch also changes the assumed alt setting in case...
usb-linux: Get the alt. setting from sysfs rather then asking the dev
At least one device I have lies when receiving a USB_REQ_GET_INTERFACE,always returning 0 even if the alternate setting is different. This islikely caused because in practice this control message is never used as...
usb-linux: Add support for buffering iso usb packets
Currently we are submitting iso packets to the host one at a time, as wereceive 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...
usb-linux: Refuse packets for endpoints which are not in the usb descriptor
If an endpoint is not in the usb descriptor we've no idea what kind ofendpoint it is and thus how to handle it, refuse packages in this case.
usb-linux: Refuse iso packets when max packet size is 0 (alt setting 0)
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_malloca 0 bytes large buffer.
usb-linux: We only need to keep track of 15 endpoints
Currently we reserve room for endpoint data for 16 endpoints, but giventhat we only use endpoint data for endpoints 1-15, and always index thearray with the endpoint-number - 1, 15 is enough.
usb-linux: Add support for buffering iso out usb packets
Extend the iso buffering code to also buffer iso out packets, thisfixes for example using usb speakers with usb redirection.
usb: initialise data element in Linux USB_DISCONNECT ioctl
This isn't used, but leaving it empty causes valgrind noise.
Signed-off-by: Brad Hards <bradh@frogmouth.net>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
usb: fix spelling errors in usb-linux.c
change all rt_clock references to use millisecond resolution accessors
This was done with:
sed -i '/get_clock\>.*rt_clock/s/get_clock\>/get_clock_ms/' \ $(git grep -l 'get_clock\>.*rt_clock' ) sed -i '/new_timer\>.*rt_clock/s/new_timer\>/new_timer_ms/' \...
usb-linux: Store devpath into USBHostDevice when usb_fs_type == USB_FS_SYS
This allows us to recreate the sysfspath used during scanning later(which will be used in a later patch in this series).
usb-linux: introduce a usb_linux_get_configuration function
The next patch in this series introduces multiple ways to get theconfiguration dependent upon usb_fs_type, it is cleaner to put thisinto its own function.
usb-linux: Get the active configuration from sysfs rather then asking the dev
Some devices seem to choke on receiving a USB_REQ_GET_CONFIGURATION ctrl msg(witnessed with a digital picture frame usb id 1908:1320).When usb_fs_type == USB_FS_SYS, the active configuration can be read directly...
Return usb device to host on exit
Signed-off-by: Shahar Havivi <shaharh@redhat.com>Acked-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Return usb device to host on usb_del command
Changes to usb-linux to conform to coding style
Signed-off-by: David Ahern <daahern@cisco.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
usb: remove dead assignments, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Revert "usb-linux: remove unreachable default in switch statement"
This reverts commit 3c9c706c3b66d838942aba53c0d3fdcdf06c7423.
This breaks build (gcc 4.3.2): CC usb-linux.o cc1: warnings being treated as errors /src/qemu/usb-linux.c: In function 'usb_linux_update_endp_table':...
usb-linux: remove unreachable default in switch statement
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
usb: Remove disabled monitor_printf() in usb_read_file()
The monitor_printf() reports failure. Printing is wrong, because thecaller tries various arguments, and expects the function to fail forsome or all.
Disabled since commit 26a9e82a. Remove it.
Do not use dprintf
dprintf is already claimed by POSIX1, and on at least one systemis implemented as a macro
[1] http://www.opengroup.org/onlinepubs/9699919799/functions/dprintf.html
Signed-off-by: malc <av1474@comtv.ru>
usb-linux: increase buffer for USB control requests
The WLAN USB stick ZyXEL NWD271N (0586:3417) uses very largeusb control transfers of more than 2048 bytes which won't fitinto the buffer of the ctrl_struct. This results in an error message"husb: ctrl buffer too small" and a non-working device....
usb-linux.c: remove write-only variable
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
usb-linux.c: fix warning with _FORTIFY_SOURCE
CC usb-linux.occ1: warnings being treated as errorsusb-linux.c: In function 'usb_host_read_file':usb-linux.c:1204: error: ignoring return value of 'fgets', declared with attribute warn_unused_resultmake: *** [usb-linux.o] Error 1...
Fix QEMU_WARN_UNUSED_RESULT
Since commit 747bbdf7 QEMU_WARN_UNUSED_RESULT is never defined as it isconditional on a define from config-host.h which is included only later.Include that file earlier to get the warnings back.
Reactivating it unfortunately leads to some warnings about unused qdev_init...
usb-host: check mon before using it.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: Rename USBDevice member devname to product_desc
It's not a device name, it's the USB product description string.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: Separate USB product description from qdev name
Using the qdev name for the product description makes for inconvenientqdev names.
Put the product description in new USBDeviceInfo member product_desc.Make usb_qdev_init() use it. No user or guest visible change, since...
qdev: Replace device names containing whitespace
Device names with whitespace require quoting in the shell and in themonitor. Some of the offenders are also overly long. Some have amore convenient alias, some don't.
The place for verbose device names is DeviceInfo member desc. The...
Fix recently introduced bugs in -usbdevice host
Commit 26a9e82a has the following flaws:
usb-host: use qdev for -usbdevice + rework.
Changes:
usb-linux: return USB_RET_STALL on -EPIPE
0) This is an attempt to get an issue in usb-linux.c, for which a patchwas posted about a year ago, finally fixed.
1) Mark Burkley submitted a "EHCI emulation module" for review in inOctober 2008 (see:http://lists.gnu.org/archive/html/qemu-devel/2008-10/msg01326.html). No...
Check return value of qdev_init()
But do so only where it may actually fail. Leave the rest for thenext commit.
Patchworks-ID: 35167Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Unbreak USB autoconnect filters
Commit 22f84e73 added a qdev_init() missing on the path throughusb_host_device_open(), but that broke the path throughusb_host_auto_scan(), which already had one. Remove that one.
Patchworks-ID: 35169Signed-off-by: Markus Armbruster <armbru@redhat.com>...
unbreak usb pass-through on linux.
Changes: * Re-add the 'dev->fd = fd;' line which the qdev patches dropped by mistake. * call qdev_init() so the newly created usb device is plugged into a usb port and thus actually visible to the guest.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>...
Use proper format conversion specifier when printing size_t value
And untabify this while we are at it.
usb-linux.c: fix buffer overflow
In usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer andlength to the kernel. However, the length was provided by the callerof dev->handle_packet, and is not checked, so the kernel might providetoo much data and overflow our buffer....
qdev/usb: add usb bus support to qdev, convert drivers.
TODO: * make the rest of qemu aware of usb busses and kill the FIXMEs added by this patch....
qdev/usb: make qemu aware of usb busses.
Move usb code from vl.c to usb-bus.c and make it use the new datastructures added by qdev conversion. qemu usb core should be ableto handle multiple USB busses just fine now (untested though).
Kill some usb_*_init() legacy functions, use usb_create_simple()...
USB: use opaque parameter passing for monitor handle
Fix Sparse warnings: "Using plain integer as NULL pointer"
Prefer sysfs for USB host devices
Scanning for devices via /sys/bus/usb/devices/ and using them via the/dev/bus/usb/<bus>/<device> character devices is the prefered methodon modern kernels, so try that first.
When using SELinux and libvirt, qemu will have access to /sys/bus/usb...
USB serial device support
Add in a workaround to allow the usb serial devices to work with theusb pass through mechanism. The ioctl() to request an alternateinterface will always return < 0 for a usb-serial device based on thekernel driver. This means there is no alternate interface end point....
monitor: Rework API (Jan Kiszka)
Refactor the monitor API and prepare it for decoupled terminals:term_print functions are renamed to monitor_* and all monitor servicesgain a new parameter (mon) that will once refer to the monitor instancethe output is supposed to appear on. However, the argument remains...
toplevel: remove error handling from qemu_malloc() callers (Avi Kivity)
Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6531 c046a42c-6fe2-441c-8c8c-71466251a162
Suppress a -Werror=format-security warning
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6135 c046a42c-6fe2-441c-8c8c-71466251a162
Native BSD host USB support (Juergen Lock, Lonnie Mendez)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5780 c046a42c-6fe2-441c-8c8c-71466251a162
Use qemu_isfoobar and qemu_towombat versions, based on patch by Christoph Egger
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5774 c046a42c-6fe2-441c-8c8c-71466251a162
Use locally defined structure.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5569 c046a42c-6fe2-441c-8c8c-71466251a162
Silence warnings about unused variables
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5535 c046a42c-6fe2-441c-8c8c-71466251a162
Keep usb host scanning from leaking file descriptors
If the first case does not succeed, then the usb scanning code will leak filedescriptors on every scan.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5509 c046a42c-6fe2-441c-8c8c-71466251a162
Fix broken USB support for Linux host (Bjorn Danielsson)
Make "host:" usb devices work again on systems that have thefile /proc/bus/usb/devices. This was broken in r5441 due toincorrect logic for the USB_FS_SYS case in usb_host_scan().
Signed-off-by: Bjorn Danielsson <bdq@dax.nu>...
Add USB sys file-system support (v8) (TJ)
This patch adds support for host USB devices discovered via:
/sys/bus/usb/devices/* and opened from /dev/bus/usb/*/*/dev/bus/usb/devices and opened from /dev/bus/usb/*/*
in addition to the existing discovery via:...
Don't use sprintf() or strcpy()
They are unsafe. The current code is correct, but to be safer, we should passan explicit size.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5290 c046a42c-6fe2-441c-8c8c-71466251a162
Define a few structures instead of including a file, add "static"
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5225 c046a42c-6fe2-441c-8c8c-71466251a162
usb: Support for removing device by host addr, improved auto filter syntax (Max Krasnyansky)
This patch adds support for removing USB devices by host address.Which is usefull for things like libvirtd because there is no easy way tofind guest USB address of the host device....
husb: Make control transactions asynchronous (Max Krasnyansky)
USB is 99.8% async now :). 0.2% is the three control requests thatwe need to execute synchronously. We could off-load that to a threador something but it's not worth the pain since those requests are...
husb: Fixup printfs and stuff based on the review comments (Max Krasnyansky)
Addressing Anthony's comments regarding printf and stuff.
Anthony, if you you want I can fold this commit and resendthe original patch.
Signed-off-by: Max Krasnyansky <maxk@kernel.org>...
husb: remove disconnect detection timer (Max Krasnyansky)
On top of my previous USB patchset.
Async completion handler can detect device disconnects without polling.We do not need the timer anymore.
Signed-off-by: Max Krasnyansky <maxk@kernel.org>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
husb: rewrite Linux host USB layer, fully async operation (Max Krasnyansky)
This is a follow up to the async UHCI patch. Both BULK and ISOC transactionsare now fully asynchrounous. I left CONTROL synchronous for now, ideallywe want it to be async too and it should not be that hard to do now....
husb: support for USB host device auto connect (Max Krasnyansky)
QEMU can now automatically grab host USB devices that match the filter.For now I just extended 'host:X.Y' and 'host:VID:PID' syntax to handlewildcards. So for example if you do something like...