I have a USB webcam I'm using under QEMU (version 1.6.1). The guest is Windows 7 (32-bit) while the host is Gentoo Linux (64-bit). I have been using it for several weeks without any problem, but now it doesn't work any more. I have been able to pinpoint the cause: it is because I switched from udev-208 to eudev-1.3 (which is based on udev-207). These are the command line options for QEMU: qemu-system-i386 -cpu host -m 1G -k it -drive file=Windows_7.qcow2,media=disk,index=0 -vga std -net nic -net user -enable-kvm -display sdl -soundhw ac97 -device usb-ehci,id=ehci -usb -rtc base=localtime -usbdevice tablet The relevant options are -device usb-ehci,id=ehci -usb. That is, I'm enabling both USB 2.0 (EHCI) and USB 1.1 (UHCI). I manually add the webcam using: device_add usb-host,hostbus=x,hostaddr=y,id=webcam but if I do so when running eudev it gets added as a slow USB 1.1 1.5 Mb/s device: (qemu) info usb [...] Device 1.0, Port 1, Speed 1.5 Mb/s, Product USB Host Device I also noticed that the "info usbhost" command works differently now, in that it doesn't display any more a description, such as the brand name (Creative): (qemu) info usbhost [...] Bus 1, Addr 3, Port 3, Speed 480 Mb/s Class ef: USB device 041e:4088 From the host system: $ lsusb | grep Creative Bus 001 Device 003: ID 041e:4088 Creative Technology, Ltd Live! Cam Chat HD [VF0700] If I turn back to udev I get the following results instead: (qemu) info usb [...] Device 1.1, Port 1, Speed 480 Mb/s, Product VF0700 Live! Cam Chat HD (qemu) info usbhost [...] Bus 1, Addr 2, Port 4, Speed 480 Mb/s Class ef: USB device 041e:4088, VF0700 Live! Cam Chat HD I don't know if this is a problem with QEMU or with eudev, so I'm also going to report this bug on the QEMU bug tracking system. Reproducible: Always $ emerge --info Portage 2.2.7 (default/linux/amd64/13.0/no-multilib, gcc-4.8.2, glibc-2.17, 3.12.5-gentoo x86_64) ================================================================= System uname: Linux-3.12.5-gentoo-x86_64-Intel-R-_Core-TM-2_Duo_CPU_E8400_@_3.00GHz-with-gentoo-2.2 KiB Mem: 8101724 total, 4930148 free KiB Swap: 0 total, 0 free Timestamp of tree: Fri, 20 Dec 2013 00:45:01 +0000 ld GNU ld (GNU Binutils) 2.23.2 app-shells/bash: 4.2_p45 dev-lang/python: 2.7.6, 3.2.5-r3, 3.3.3 dev-util/cmake: 2.8.12.1-r2 dev-util/pkgconfig: 0.28 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.12.4 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.13, 2.69 sys-devel/automake: 1.11.6, 1.12.6, 1.14 sys-devel/binutils: 2.23.2 sys-devel/gcc: 4.8.2 sys-devel/gcc-config: 1.8 sys-devel/libtool: 2.4.2 sys-devel/make: 4.0-r1 sys-kernel/linux-headers: 3.12 (virtual/os-headers) sys-libs/glibc: 2.17 Repositories: gentoo x-portage ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -march=native -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-O2 -march=native -pipe" DISTDIR="/usr/portage/distfiles" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://mirror.switch.ch/ftp/mirror/gentoo/ http://gentoo.lagis.at/ http://gentoo.inode.at/ http://gd.tuwien.ac.at/opsys/linux/gentoo/" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j 2" PKGDIR="/usr/portage/packages" PORTAGE_COMPRESS="xz" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" USE="X alsa amd64 bash-completion berkdb bzip2 cdr cli cracklib crypt cxx dri dvd dvdr flac gdbm gif gtk iconv jpeg lm_sensors mmx modules mp3 mudflap ncurses nptl openmp pcre png readline scanner session smp sse sse2 sse3 ssl tcpd tiff truetype unicode usb zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_US" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby19 ruby18" SANE_BACKENDS="snapscan" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON
Please also see: https://bugs.launchpad.net/qemu/+bug/1263318
I tried eudev-1.4, but I get the same problem as with 1.3.
Instead of device_add, could you try > -device usb-host,vendorid=0x041e,productid=0x4088,bus=ehci.0 Also, do you have these USE flags: > app-emulation/qemu usb > dev-libs/libusbx udev ?
app-emulation/qemu already had "usb" flag enabled. dev-libs/libusbx had "udev" flag disabled, I now enabled it, but I don't know if the problem depends on this. I tried running qemu with the -device option you told me to use, but it says me: libusbx: error [_get_usbfs_fd] libusbx couldn't open USB device /dev/bus/usb/001/003: Permission denied libusbx: error [_get_usbfs_fd] libusbx requires write access to USB device nodes. That device file is owned by root: ls -l /dev/bus/usb/001/003 crw-rw-r-- 1 root root 189, 2 Jan 25 15:53 /dev/bus/usb/001/003 If I run qemu via the root user I'm able to use the webcam without problems, but of course this is not recommended. It could be a problem related to udev rules, but I have absolutely no experience with them.
I think I fixed the problem. It seems the "udev" USE flag for libusbx doesn't matter at all. I noticed instead that udev had a rule that eudev hadn't: 40-gentoo.rules. The relevant content is: SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb" With this rule everything works correctly. No need to run QEMU via the root user. I'm closing this bug but I think I will report another one because it is not so clear to me why eudev doesn't come with this rule enabled by default.