Statistics
| Branch: | Revision:

root / usb-linux.c @ a88790a1

History | View | Annotate | Download (43.5 kB)

# Date Author Comment
b373a63a 06/30/2010 11:51 pm Shahar Havivi

Return usb device to host on exit

Signed-off-by: Shahar Havivi <>
Acked-by: Gerd Hoffmann <>
Signed-off-by: Aurelien Jarno <>

00ff227a 06/30/2010 11:51 pm Shahar Havivi

Return usb device to host on usb_del command

Signed-off-by: Shahar Havivi <>
Acked-by: Gerd Hoffmann <>
Signed-off-by: Aurelien Jarno <>

2791104c 05/03/2010 08:39 pm David Ahern

Changes to usb-linux to conform to coding style

Signed-off-by: David Ahern <>
Signed-off-by: Anthony Liguori <>

d4c4e6fd 04/25/2010 09:23 pm Blue Swirl

usb: remove dead assignments, spotted by clang analyzer

Value stored is never read.

Signed-off-by: Blue Swirl <>

ddbda432 03/19/2010 10:27 pm Anthony Liguori

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':...

3c9c706c 03/17/2010 05:41 pm Paul Bolle

usb-linux: remove unreachable default in switch statement

Signed-off-by: Paul Bolle <>
Signed-off-by: Anthony Liguori <>

4491e0f3 03/16/2010 05:55 pm Markus Armbruster

usb: Remove disabled monitor_printf() in usb_read_file()

The monitor_printf() reports failure. Printing is wrong, because the
caller tries various arguments, and expects the function to fail for
some or all.

Disabled since commit 26a9e82a. Remove it.

d0f2c4c6 02/07/2010 01:03 am malc

Do not use dprintf

dprintf is already claimed by POSIX1, and on at least one system
is implemented as a macro

[1] http://www.opengroup.org/onlinepubs/9699919799/functions/dprintf.html

Signed-off-by: malc <>

fd7a446f 02/06/2010 06:14 pm Christian Krause

usb-linux: increase buffer for USB control requests

The WLAN USB stick ZyXEL NWD271N (0586:3417) uses very large
usb control transfers of more than 2048 bytes which won't fit
into the buffer of the ctrl_struct. This results in an error message
"husb: ctrl buffer too small" and a non-working device....

b29a7def 02/05/2010 08:13 pm Paolo Bonzini

usb-linux.c: remove write-only variable

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Blue Swirl <>

9f99cee7 01/26/2010 10:59 pm Kirill A. Shutemov

usb-linux.c: fix warning with _FORTIFY_SOURCE

CC usb-linux.o
cc1: warnings being treated as errors
usb-linux.c: In function 'usb_host_read_file':
usb-linux.c:1204: error: ignoring return value of 'fgets', declared with attribute warn_unused_result
make: *** [usb-linux.o] Error 1...

beb6f0de 01/20/2010 12:31 am Kevin Wolf

Fix QEMU_WARN_UNUSED_RESULT

Since commit 747bbdf7 QEMU_WARN_UNUSED_RESULT is never defined as it is
conditional 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...

eba6fe87 12/18/2009 07:26 pm Gerd Hoffmann

usb-host: check mon before using it.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

0fe6d12e 12/12/2009 03:59 pm Markus Armbruster

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 <>
Signed-off-by: Anthony Liguori <>

06384698 12/12/2009 03:59 pm Markus Armbruster

qdev: Separate USB product description from qdev name

Using the qdev name for the product description makes for inconvenient
qdev names.

Put the product description in new USBDeviceInfo member product_desc.
Make usb_qdev_init() use it. No user or guest visible change, since...

556cd098 12/12/2009 03:59 pm Markus Armbruster

qdev: Replace device names containing whitespace

Device names with whitespace require quoting in the shell and in the
monitor. Some of the offenders are also overly long. Some have a
more convenient alias, some don't.

The place for verbose device names is DeviceInfo member desc. The...

0745eb1e 12/03/2009 11:25 pm Markus Armbruster

Fix recently introduced bugs in -usbdevice host

Commit 26a9e82a has the following flaws:

  • It enabled DEBUG.
  • It referenced two properties by the wrong name in
    usb_host_device_open(), which crashes with "qdev_prop_set: property
    "USB Host Device.bus" not found"....
26a9e82a 10/30/2009 03:39 pm Gerd Hoffmann

usb-host: use qdev for -usbdevice + rework.

Changes:

  • We don't create/delete devices, we attach/detach them instead.
  • The separate autofilter list is gone, we simply walk the list
    of devices directly instead.
  • Autofiltering is done unconditionally now. Non-auto device scan...
dcc7e25f 10/27/2009 07:28 pm Paul Bolle

usb-linux: return USB_RET_STALL on -EPIPE

0) This is an attempt to get an issue in usb-linux.c, for which a patch
was posted about a year ago, finally fixed.

1) Mark Burkley submitted a "EHCI emulation module" for review in in
October 2008 (see:
http://lists.gnu.org/archive/html/qemu-devel/2008-10/msg01326.html). No...

33e66b86 10/07/2009 04:54 pm Markus Armbruster

Check return value of qdev_init()

But do so only where it may actually fail. Leave the rest for the
next commit.

Patchworks-ID: 35167
Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

05a91699 10/07/2009 04:54 pm Markus Armbruster

Unbreak USB autoconnect filters

Commit 22f84e73 added a qdev_init() missing on the path through
usb_host_device_open(), but that broke the path through
usb_host_auto_scan(), which already had one. Remove that one.

Patchworks-ID: 35169
Signed-off-by: Markus Armbruster <>...

22f84e73 09/25/2009 06:40 pm Gerd Hoffmann

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 <>...

b2e3b6e9 09/12/2009 02:18 am malc

Use proper format conversion specifier when printing size_t value

And untabify this while we are at it.

Signed-off-by: malc <>

c4c0e236 09/11/2009 06:19 pm Jim Paris

usb-linux.c: fix buffer overflow

In usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and
length to the kernel. However, the length was provided by the caller
of dev->handle_packet, and is not checked, so the kernel might provide
too much data and overflow our buffer....

806b6024 09/09/2009 10:55 pm Gerd Hoffmann

qdev/usb: add usb bus support to qdev, convert drivers.

  • Add USBBus. * Add USBDeviceInfo, move device callbacks here. * Add usb-qdev helper functions. * Switch drivers to qdev.

TODO: * make the rest of qemu aware of usb busses and kill the FIXMEs
added by this patch....

a5d2f727 09/09/2009 10:55 pm Gerd Hoffmann

qdev/usb: make qemu aware of usb busses.

Move usb code from vl.c to usb-bus.c and make it use the new data
structures added by qdev conversion. qemu usb core should be able
to handle multiple USB busses just fine now (untested though).

Kill some usb_*_init() legacy functions, use usb_create_simple()...

179da8af 09/07/2009 10:00 pm Blue Swirl

USB: use opaque parameter passing for monitor handle

Signed-off-by: Blue Swirl <>

660f11be 08/01/2009 12:16 am Blue Swirl

Fix Sparse warnings: "Using plain integer as NULL pointer"

Signed-off-by: Blue Swirl <>

55496240 07/10/2009 09:44 pm Mark McLoughlin

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 method
on modern kernels, so try that first.

When using SELinux and libvirt, qemu will have access to /sys/bus/usb...

d55ebf55 05/22/2009 06:50 pm Jason Wessel

USB serial device support

Add in a workaround to allow the usb serial devices to work with the
usb pass through mechanism. The ioctl() to request an alternate
interface will always return < 0 for a usb-serial device based on the
kernel driver. This means there is no alternate interface end point....

376253ec 03/06/2009 01:01 am aliguori

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 services
gain a new parameter (mon) that will once refer to the monitor instance
the output is supposed to appear on. However, the argument remains...

1eec614b 02/06/2009 12:06 am aliguori

toplevel: remove error handling from qemu_malloc() callers (Avi Kivity)

Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6531 c046a42c-6fe2-441c-8c8c-71466251a162

b4e237aa 12/28/2008 05:45 pm blueswir1

Suppress a -Werror=format-security warning

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6135 c046a42c-6fe2-441c-8c8c-71466251a162

68063649 11/22/2008 11:03 pm blueswir1

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

47398b9c 11/22/2008 10:04 pm blueswir1

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

e41b3910 10/28/2008 08:22 pm pbrook

Use locally defined structure.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5569 c046a42c-6fe2-441c-8c8c-71466251a162

5be8e1f2 10/25/2008 02:47 pm blueswir1

Silence warnings about unused variables

Signed-off-by: Jan Kiszka <>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5535 c046a42c-6fe2-441c-8c8c-71466251a162

f16a0db3 10/21/2008 07:34 pm aliguori

Keep usb host scanning from leaking file descriptors

If the first case does not succeed, then the usb scanning code will leak file
descriptors on every scan.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5509 c046a42c-6fe2-441c-8c8c-71466251a162

22babebb 10/21/2008 07:27 pm aliguori

Fix broken USB support for Linux host (Bjorn Danielsson)

Make "host:" usb devices work again on systems that have the
file /proc/bus/usb/devices. This was broken in r5441 due to
incorrect logic for the USB_FS_SYS case in usb_host_scan().

Signed-off-by: Bjorn Danielsson <>...

0f431527 10/07/2008 11:06 pm aliguori

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:...

ac4ffb5a 09/22/2008 06:04 pm aliguori

Don't use sprintf() or strcpy()

They are unsafe. The current code is correct, but to be safer, we should pass
an explicit size.

Signed-off-by: Anthony Liguori <>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5290 c046a42c-6fe2-441c-8c8c-71466251a162

d9cf1578 09/15/2008 05:57 pm blueswir1

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

5d0c5750 09/14/2008 04:07 am aliguori

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 to
find guest USB address of the host device....

446ab128 09/14/2008 04:06 am aliguori

husb: Make control transactions asynchronous (Max Krasnyansky)

USB is 99.8% async now :). 0.2% is the three control requests that
we need to execute synchronously. We could off-load that to a thread
or something but it's not worth the pain since those requests are...

0d380648 08/21/2008 10:32 pm aliguori

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 resend
the original patch.

Signed-off-by: Max Krasnyansky <>...

24772c1e 08/21/2008 10:31 pm aliguori

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 <>
Signed-off-by: Anthony Liguori <>...

64838171 08/21/2008 10:31 pm aliguori

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 transactions
are now fully asynchrounous. I left CONTROL synchronous for now, ideally
we want it to be async too and it should not be that hard to do now....

4b096fc9 08/21/2008 10:28 pm aliguori

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 handle
wildcards. So for example if you do something like...

1f3870ab 08/21/2008 10:27 pm aliguori

husb: support for USB host device auto disconnect (Max Krasnyansky)

I got really annoyed by the fact that you have to manually do
usb_del in the monitor when host device is unplugged and decided
to fix it :)

Basically we now automatically remove guest USB device...

9596ebb7 11/18/2007 03:44 am pbrook

Add statics and missing #includes for prototypes.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3683 c046a42c-6fe2-441c-8c8c-71466251a162

87ecb68b 11/17/2007 07:14 pm pbrook

Break up vl.h.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3674 c046a42c-6fe2-441c-8c8c-71466251a162

046833ea 10/31/2007 02:27 am balrog

Use a O_NONBLOCK pipe for iso completion signals for thread-safety, by Arnon Gilboa.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3492 c046a42c-6fe2-441c-8c8c-71466251a162

4d043a09 10/05/2007 01:55 am balrog

Quiet warnings introduced with the USB iso support.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3329 c046a42c-6fe2-441c-8c8c-71466251a162

b9dc033c 10/05/2007 01:47 am balrog

USB iso transfers support for the linux redirector and for UHCI, by Arnon Gilboa.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3328 c046a42c-6fe2-441c-8c8c-71466251a162

3b46e624 09/17/2007 11:09 am ths

find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in the regex.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3177 c046a42c-6fe2-441c-8c8c-71466251a162

5fafdf24 09/17/2007 12:08 am ths

find -type f | xargs sed -i 's/[\t ]$//g' # on most files

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162

a42aa815 12/11/2006 12:11 am ths

Build fix for newer kernel headers, thanks Jason Wessel.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2236 c046a42c-6fe2-441c-8c8c-71466251a162

4d611c9a 08/12/2006 04:04 am pbrook

SCSI and USB async IO support.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2107 c046a42c-6fe2-441c-8c8c-71466251a162

059809e4 07/19/2006 09:06 pm bellard

usb destroy API change (Lonnie Mendez)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2066 c046a42c-6fe2-441c-8c8c-71466251a162

3b2ccc57 07/19/2006 08:54 pm bellard

Linux compilation fix

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2065 c046a42c-6fe2-441c-8c8c-71466251a162

1f6e24e7 06/27/2006 12:00 am bellard

display device identifier string for user with info usb (Lonnie Mendez)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2029 c046a42c-6fe2-441c-8c8c-71466251a162

2e5d83bb 05/26/2006 02:58 am pbrook

Rearrange SCSI disk emulation code.
Add USB mass storage device emulation.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1940 c046a42c-6fe2-441c-8c8c-71466251a162

38ca0f6d 03/11/2006 08:03 pm pbrook

Tweak UHCI device settings. Ignore host root hubs.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1779 c046a42c-6fe2-441c-8c8c-71466251a162

868bfe2b 11/13/2005 11:53 pm bellard

correct use of USBDEVFS_DISCONNECT

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1621 c046a42c-6fe2-441c-8c8c-71466251a162

a594cfbf 11/06/2005 06:13 pm bellard

USB user interface

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1603 c046a42c-6fe2-441c-8c8c-71466251a162

bb36d470 11/05/2005 04:22 pm bellard

initial USB support

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1597 c046a42c-6fe2-441c-8c8c-71466251a162