Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 439540 - app-emulation/qemu fails to handle a usb serial port with a specific vendorid - qdev_prop_set: property "usb-serial.vendorid" not found
Summary: app-emulation/qemu fails to handle a usb serial port with a specific vendorid...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Doug Goldstein
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-24 19:11 UTC by Rostislav Devyatov
Modified: 2013-08-27 23:43 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
outputs of gdb with backtrace and emerge --info (file_439540.txt,11.81 KB, text/plain)
2012-10-24 19:11 UTC, Rostislav Devyatov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rostislav Devyatov 2012-10-24 19:11:20 UTC
Created attachment 327322 [details]
outputs of gdb with backtrace and emerge --info

If I run qemu-system-i386 with arguments
-usb -usbdevice serial:vendorid=1221,productid=1331:pty
(this is what the documentation says about how I shoud add a usb device which has a serial port interface and which has a specific vendor id and product id), it says 
qdev_prop_set: property "usb-serial.vendorid" not found
, receives signal SIGABRT and exits. Moreover, if I try to add such a device to a running machine by typing usb_add serial:vendorid=1221,productid=1331:pty in the machine's control terminal (to reach it, I press ctrl-alt-2), qemu also writes 
qdev_prop_set: property "usb-serial.vendorid" not found
to the terminal where I run it from, receives SIGABRT and exits. To the quest OS this looks like a power failure which causes all the programs inside the virtual machine to lose their unsaved data.

Reproducible: Always

Steps to Reproduce (way 1):
1. create a qemu disk image
2. run qemu:
qemu-system-i386 -usb -usbdevice serial:vendorid=1221,productid=1331:pty vmach1_v3.qcow2

Actual Results:  
output:
<...see full output in the attachment...>
qdev_prop_set: property "usb-serial.vendorid" not found
Aborted

Expected results:
virtual machine starts

Steps to Reproduce (way 2):
1. create a qemu disk image
2. run qemu and install some guest OS
qemu-system-i386 -usb -cdrom live.iso vmach1_v3.qcow2
3. shutdown and run qemu again, without cd disk (possibly not necessary, but I didn't check)
qemu-system-i386 -usb vmach1_v3.qcow2
4. In machine window, press ctrl-alt-2 to switch to the machine's control terminal.
5. add a usb device:
usb_add serial:vendorid=1221,productid=1331:pty

Actual results:
output is the same as in the previous case
the machine stops, for the quest os this is unexpected at all

Expected results:
machine keeps running, a new usb device is added
Comment 1 Rostislav Devyatov 2012-10-24 19:13:00 UTC
rostislav@hp_linux ~/my_computer/qemu/vmach1 $ emerge --info
Portage 2.1.11.9 (default/linux/amd64/10.0, gcc-4.5.4, glibc-2.15-r2, 3.4.9-gentoo-gnu_build20120904 x86_64)
=================================================================
System uname: Linux-3.4.9-gentoo-gnu_build20120904-x86_64-Intel-R-_Core-TM-_i5_CPU_M_450_@_2.40GHz-with-gentoo-2.1
Timestamp of tree: Sun, 02 Sep 2012 12:00:01 +0000
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.3-r2, 3.2.3
dev-util/cmake:           2.8.8-r3
dev-util/pkgconfig:       0.27
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.11.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            3.4.6-r2, 4.5.4
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.4-r2 (virtual/os-headers)
sys-libs/glibc:           2.15-r2
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -ggdb"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -pipe -ggdb"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_US fr ru de en ua"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --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=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl alsa amd64 apng berkdb bluetooth bzip2 cairo cdda cli consolekit cracklib crypt cups cxx dbus deblob declarative device-mapper djvu dri ebook embedded extras fortran gdbm gdu gpm iconv ipv6 kde mmx mng modules mudflap multilib ncurses networkmanager nls nptl ogg opengl openmp pam pcre png policykit pppd qt3support qt4 readline session sql sqlite sse sse2 ssl svg tcpd udev unicode vorbis webkit zlib" 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" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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" 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 ubx" INPUT_DEVICES="synaptics keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_US fr ru de en ua" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="radeon" 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, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 2 Doug Goldstein gentoo-dev 2012-12-04 00:39:14 UTC
What version did you use?
Comment 3 Rostislav Devyatov 2012-12-05 16:53:05 UTC
(In reply to comment #2)
> What version did you use?

rostislav@hp_linux ~/my_computer/qemu $ equery list qemu
 * Searching for qemu ...
[IP-] [  ] app-emulation/qemu-1.0.1:0
Comment 4 Doug Goldstein gentoo-dev 2012-12-08 06:08:04 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > What version did you use?
> 
> rostislav@hp_linux ~/my_computer/qemu $ equery list qemu
>  * Searching for qemu ...
> [IP-] [  ] app-emulation/qemu-1.0.1:0

Can you try some of the more recent stabile versions?
Comment 5 Rostislav Devyatov 2012-12-12 19:42:54 UTC
(In reply to comment #4)
> 
> Can you try some of the more recent stabile versions?

I have upgraded the whole system, now qemu is

rostislav@hp_linux ~/my_computer/qemu $ equery list qemu
 * Searching for qemu ...
[IP-] [  ] app-emulation/qemu-1.1.2-r2:0

but the error message still shows up:

rostislav@hp_linux ~/my_computer/qemu/vmach1 $ qemu-system-i386 -usb -usbdevice serial:vendorid=1221,productid=1331:pty -no-kvm vmach1_v2.qcow2
char device redirected to /dev/pts/5
qemu-system-i386: -usbdevice serial:vendorid=12d1,productid=1001:pty: Property '.vendorid' not found
Aborted

I cannot reproduce this in gdb anymore as gdb shows a different error, namely:

rostislav@hp_linux ~/my_computer/qemu/vmach1 $ gdb qemu-system-i386 
GNU gdb (Gentoo 7.5 p1) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/bin/qemu-system-i386...Reading symbols from /usr/lib64/debug/usr/bin/qemu-system-i386.debug...done.
done.
(gdb) run -usb -usbdevice serial:vedorid=1221,productid=1331:pty -no-kvm vmach1_v2.qcow2
Starting program: /usr/bin/qemu-system-i386 -usb -usbdevice serial:vedorid=1221,productid=1331:pty -no-kvm vmach1_v2.qcow2
Warning:
Cannot insert breakpoint -1.
Error accessing memory address 0x23ccf0: Input/output error.

(gdb) quit
A debugging session is active.

        Inferior 1 [process 14472] will be killed.

Quit anyway? (y or n) y
Comment 6 Doug Goldstein gentoo-dev 2013-01-14 02:47:52 UTC
Now I'm actually really reading this. I'm a bit confused. You can't just say go to a random pty, which is what you're doing. Your error messages are confusing as well..

rostislav@hp_linux ~/my_computer/qemu/vmach1 $ qemu-system-i386 -usb -usbdevice serial:vendorid=1221,productid=1331:pty -no-kvm vmach1_v2.qcow2
char device redirected to /dev/pts/5
qemu-system-i386: -usbdevice serial:vendorid=12d1,productid=1001:pty: Property '.vendorid' not found
Aborted

See how the vendor and product don't match above?

I would expect you connected your HSPDA modem and it showed up as /dev/ttyUSB0, let's say. You would do:

qemu-system-i386 -usb -usbdevice serial:vendorid=1221,productid=1001:/dev/ttyUSB0
Comment 7 Rostislav Devyatov 2013-01-14 15:00:07 UTC
First of all, sorry for confusing error messages (as I can guess, the confusing part is that when I run qemu, the parameters are 
serial:vendorid=1221,productid=1331:pty
, but in the error message they are
serial:vendorid=12d1,productid=1001:pty
, otherwise I don't understang what exactly in my error messages is confugsing). I think this was my mistake, now I cannot understand exactly how I got this, probably I copied different parts of the message from different parts of my terminal where I tried to test different parameters.

Elsewhere I don't understand why you say that I should redirect a device to a really existing USB device if I use a specific vendorid. The documentation does not say anything about this. I could test not only how drivers in the guest OS interact with actual devices, but also with device emulation programs that use pty's.

Unfortunately, I don't have any real device right now which makes /dev/ttyUSB0 appear in /dev/ . I only have /dev/tty0 through /dev/tty63 and /dev/ttyS0 through /dev/ttyS3 in /dev/ , so maybe the results of my tests are not exaclty what you would expect.

However, I've tried to use pty, /dev/ttyS0 and /dev/ttyUSB0, which does not exist. Here are the results (I posted the first one to show how the error message really looks).

rostislav@hp_linux ~/my_computer/qemu/vmach1 $ qemu-system-i386 -no-kvm -usb -usbdevice serial:vendorid=1221,productid=1331:pty vmach1_v2.qcow2 
char device redirected to /dev/pts/12
qemu-system-i386: -usbdevice serial:vendorid=1221,productid=1331:pty: Property '.vendorid' not found
Aborted
rostislav@hp_linux ~/my_computer/qemu/vmach1 $ qemu-system-i386 -no-kvm -usb -usbdevice serial:vendorid=1221,productid=1331:/dev/ttyS0 vmach1_v2.qcow2 
chardev: opening backend "tty" failed
qemu: could not add USB device 'serial:vendorid=1221,productid=1331:/dev/ttyS0'
rostislav@hp_linux ~/my_computer/qemu/vmach1 $ qemu-system-i386 -no-kvm -usb -usbdevice serial:vendorid=1221,productid=1331:/dev/ttyUSB0 vmach1_v2.qcow2 
chardev: opening backend "tty" failed
qemu: could not add USB device 'serial:vendorid=1221,productid=1331:/dev/ttyUSB0'

So it does not work anyway, but the error messages are different. In the second case (/dev/ttyS0), I think this is caused by some access violation policy, because when I do all the same as root:

hp_linux /home/rostislav/my_computer/qemu/vmach1 # qemu-system-i386 -no-kvm -usb -usbdevice serial:vendorid=1221,productid=1331:pty vmach1_v2.qcow2
char device redirected to /dev/pts/12
qemu-system-i386: -usbdevice serial:vendorid=1221,productid=1331:pty: Property '.vendorid' not found
Aborted
hp_linux /home/rostislav/my_computer/qemu/vmach1 # qemu-system-i386 -no-kvm -usb -usbdevice serial:vendorid=1221,productid=1331:/dev/ttyS0 vmach1_v2.qcow2
qemu-system-i386: -usbdevice serial:vendorid=1221,productid=1331:/dev/ttyS0: Property '.vendorid' not found
Aborted
hp_linux /home/rostislav/my_computer/qemu/vmach1 # qemu-system-i386 -no-kvm -usb -usbdevice serial:vendorid=1221,productid=1331:/dev/ttyUSB0 vmach1_v2.qcow2
chardev: opening backend "tty" failed
qemu: could not add USB device 'serial:vendorid=1221,productid=1331:/dev/ttyUSB0'

, the error message in the second case looks different, it again says "Property '.vendorid' not found Aborted".

That's all I can reproduce at my computer, and I beleive that this behavior is not what should be and is not what is described in the documentation.

Moreover, I have compiled an older version of qemu, namely 0.11.1 (I've downloaded it directly from qemu's website, this version is already outside of portage), and with this version the virtual machine runs smoothly:

rostislav@hp_linux ~/my_computer/qemu/vmach1 $ ~/my_computer/alter_progs/bin/qemu -usb -usbdevice serial:vendorid=1221,productid=1331:pty vmach1_v2.qcow2 
char device redirected to /dev/pts/12
Comment 8 Doug Goldstein gentoo-dev 2013-02-10 17:43:13 UTC
I'd recommend following up with upstream on this issue. I've been really busy and haven't been giving it the attention it needs and that won't likely change soon. As an intermediate stop gap, try qemu 1.2.2
Comment 9 Doug Goldstein gentoo-dev 2013-08-27 23:43:53 UTC
As previously mentioned, really the best place for this is upstream.