From: Oliver Gerlich <olig9@gmx.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [patch] USB support
Date: Sun, 13 Nov 2005 02:00:10 +0100 [thread overview]
Message-ID: <4376901A.1030805@gmx.de> (raw)
In-Reply-To: <436E0F25.9090205@bellard.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Fabrice Bellard schrieb:
> Lonnie Mendez wrote:
>
>> On Saturday 05 November 2005 11:10 am, Fabrice Bellard wrote:
>>
>>> 1) The host OS must not use the USB device. It means in particular
>>> that no host OS driver must be present for that device. The solution
>>> I am using is to rename the host kernel module "usb-storage.o" to
>>> "usb-storage.o.disabled" so that it is not loaded by Linux. Then QEMU
>>> can exclusively access to the corresponding host storage USB device.
>>> The same apply to every other type of USB devices.
>>
>>
>>
>> usb devfs has a disconnect ioctl (USBDEVFS_DISCONNECT) which
>> allows you to disconnect a single device from a driver.
>>
>> A suggestion is to hook the interface up to qemu monitor. Then you
>> would be able to list usb devices and then claim only the ones you
>> want to use.
>
>
> Good idea. I am adding something like that:
>
> In the monitor:
>
> 'info usbhost' lists the available host USB devices
>
> 'usbhost_add 3.4' or 'usbhost_add 1234:5678' adds the USB host device on
> bus 3 at address 4 or the first one matching the vendor ID 0x1234 and
> product ID 0x5678.
>
> The QEMU option '-usbhost x' can be used to do the same as usbhost_add.
>
> Fabrice.
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
>
When I use usb_add, I get:
USBDEVFS_DISCONNECT: Inappropriate ioctl for device
This is with snapshot from 2005-11-11, on Debian testing, kernel 2.6.13
(with 1000Hz timer).
The patch below fixes this (plainly taken from
http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg35550.html
; is ifno = 0 correct?)
diff -Naur qemu-snapshot-2005-11-11_23/usb-linux.c
qemu-snapshot-2005-11-11_23-usb/usb-linux.c
- --- qemu-snapshot-2005-11-11_23/usb-linux.c 2005-11-06
17:13:29.000000000 +0
100
+++ qemu-snapshot-2005-11-11_23-usb/usb-linux.c 2005-11-13
01:10:19.000000000 +0
100
@@ -181,7 +181,10 @@
#ifdef USBDEVFS_DISCONNECT
/* earlier Linux 2.4 do not support that */
- - ret = ioctl(fd, USBDEVFS_DISCONNECT);
+ struct usbdevfs_ioctl ctrl;
+ ctrl.ioctl_code = USBDEVFS_DISCONNECT;
+ ctrl.ifno = 0;
+ ret = ioctl(fd, USBDEVFS_IOCTL, &ctrl);
if (ret < 0 && errno != ENODATA) {
perror("USBDEVFS_DISCONNECT");
goto fail;
With this patch, qemu recognized all USB devices I had available - which
is actually only one device, a joystick :)
Win2k showed it in the control panel with all available buttons and axes
and reacted to events correctly.
Though, a strange thing is that as long as the device is attached to the
guest, Windows gets very slow. The Windows task manager shows that the
guest CPU load is at 100%; but "top" on the guest shows that qemu uses
only 20% host CPU. This starts as soon as usb_add is executed, and stops
as soon as usb_del is executed.
Does qemu use sleep in the usb code, or does maybe Windows sent the CPU
a HLT ? I don't really understand that behaviour :)
Regards,
Oliver
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFDdpAWTFOM6DcNJ6cRAjzgAJ4rJlhVBe8thmg3VCBRRs+iw7dCsgCeI8s/
vDSywn5WpfH4vkCNSfEpDvI=
=Djpx
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2005-11-13 1:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-05 14:45 [Qemu-devel] USB support Fabrice Bellard
2005-11-05 16:31 ` Volker Ruppert
2005-11-05 17:10 ` Fabrice Bellard
2005-11-05 17:24 ` Lonnie Mendez
2005-11-06 14:11 ` Fabrice Bellard
2005-11-13 1:00 ` Oliver Gerlich [this message]
2005-11-13 21:47 ` [Qemu-devel] [patch] " Fabrice Bellard
2005-11-05 23:39 ` [Qemu-devel] " Matthew Mastracci
2005-11-06 2:04 ` [Qemu-devel] " Mark Williamson
2005-11-06 2:10 ` Paul Brook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4376901A.1030805@gmx.de \
--to=olig9@gmx.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).