* [Qemu-devel] Bus number and address changes after usb_add?
@ 2006-12-07 4:18 Yu, Xiaoyang
2006-12-07 4:25 ` Lonnie Mendez
0 siblings, 1 reply; 7+ messages in thread
From: Yu, Xiaoyang @ 2006-12-07 4:18 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 607 bytes --]
After add a USB device by "usb_add", I can view it by "info usb". It
shows the bus number and address.
As shown in vl.c, it seems that usb_info() is called when issue "info
usb", and usb_device_add() is called when issue "usb_add".
But if I add call to usb_info() in the end of usb_device_add(), it
always show the bus number and address as "0.0", which can be different
from the output of "usb_add".
So it seems like the bus number and address of a USB device changed some
time after "usb_add". Does anyone know why it changes? Thanks in
advance!
Thanks
Xiaoyang
[-- Attachment #2: Type: text/html, Size: 2951 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] Bus number and address changes after usb_add?
@ 2006-12-07 4:20 Yu, Xiaoyang
0 siblings, 0 replies; 7+ messages in thread
From: Yu, Xiaoyang @ 2006-12-07 4:20 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 608 bytes --]
After add a USB device by "usb_add", I can view it by "info usb". It
shows the bus number and address.
As shown in vl.c, it seems that usb_info() is called when issue "info
usb", and usb_device_add() is called when issue "usb_add".
But if I add call to usb_info() in the end of usb_device_add(), it
always show the bus number and address as "0.0", which can be different
from the output of "info usb".
So it seems like the bus number and address of a USB device changed some
time after "usb_add". Does anyone know why it changes? Thanks in
advance!
Thanks
Xiaoyang
[-- Attachment #2: Type: text/html, Size: 2952 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] Bus number and address changes after usb_add?
2006-12-07 4:18 Yu, Xiaoyang
@ 2006-12-07 4:25 ` Lonnie Mendez
0 siblings, 0 replies; 7+ messages in thread
From: Lonnie Mendez @ 2006-12-07 4:25 UTC (permalink / raw)
To: qemu-devel
On Thu, 2006-12-07 at 12:18 +0800, Yu, Xiaoyang wrote:
> After add a USB device by “usb_add”, I can view it by “info usb”. It
> shows the bus number and address.
>
>
>
> As shown in vl.c, it seems that usb_info() is called when issue “info
> usb”, and usb_device_add() is called when issue “usb_add”.
>
>
>
> But if I add call to usb_info() in the end of usb_device_add(), it
> always show the bus number and address as “0.0”, which can be
> different from the output of “usb_add”.
>
> So it seems like the bus number and address of a USB device changed
> some time after “usb_add”. Does anyone know why it changes? Thanks in
> advance!
The address you see with the monitor command "info usb" is the address
all usb devices start out with when connected to the guest. The guest
os will later assign the device an address on bus 0 (the uhci controller
on the i386 system target) after it does things like fetch the device
descriptor, configuration, etc. iirc linux will first assign a device
an address unlike windows which queries for the configuration
information before an address is assigned.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [Qemu-devel] Bus number and address changes after usb_add?
@ 2006-12-07 6:11 Yu, Xiaoyang
2006-12-07 6:22 ` Lonnie Mendez
0 siblings, 1 reply; 7+ messages in thread
From: Yu, Xiaoyang @ 2006-12-07 6:11 UTC (permalink / raw)
To: qemu-devel
I see. Guest OS will assign the USB device an address later. Is it possible to store this new address in host OS? Then when the USB device is unplugged, host OS can send "usb_del" command to QEMU to automatically delete the device.
Thanks!
Xiaoyang
-----Original Message-----
From: qemu-devel-bounces+xiaoyang.yu=intel.com@nongnu.org [mailto:qemu-devel-bounces+xiaoyang.yu=intel.com@nongnu.org] On Behalf Of Lonnie Mendez
Sent: 2006年12月7日 12:25
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Bus number and address changes after usb_add?
On Thu, 2006-12-07 at 12:18 +0800, Yu, Xiaoyang wrote:
> After add a USB device by “usb_add”, I can view it by “info usb”. It
> shows the bus number and address.
>
>
>
> As shown in vl.c, it seems that usb_info() is called when issue “info
> usb”, and usb_device_add() is called when issue “usb_add”.
>
>
>
> But if I add call to usb_info() in the end of usb_device_add(), it
> always show the bus number and address as “0.0”, which can be
> different from the output of “usb_add”.
>
> So it seems like the bus number and address of a USB device changed
> some time after “usb_add”. Does anyone know why it changes? Thanks in
> advance!
The address you see with the monitor command "info usb" is the address
all usb devices start out with when connected to the guest. The guest
os will later assign the device an address on bus 0 (the uhci controller
on the i386 system target) after it does things like fetch the device
descriptor, configuration, etc. iirc linux will first assign a device
an address unlike windows which queries for the configuration
information before an address is assigned.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [Qemu-devel] Bus number and address changes after usb_add?
2006-12-07 6:11 [Qemu-devel] Bus number and address changes after usb_add? Yu, Xiaoyang
@ 2006-12-07 6:22 ` Lonnie Mendez
0 siblings, 0 replies; 7+ messages in thread
From: Lonnie Mendez @ 2006-12-07 6:22 UTC (permalink / raw)
To: qemu-devel
On Thu, 2006-12-07 at 14:11 +0800, Yu, Xiaoyang wrote:
> I see. Guest OS will assign the USB device an address later. Is it possible to store this new address in host OS? Then when the USB device is unplugged, host OS can send "usb_del" command to QEMU to automatically delete the device.
It's possible (on linux host) to register a signal with the kernel that
will trigger when the device is disconnected from the host system. From
the signal handler the device can then be removed from the guest. See
USBDEVFS_DISCSIGNAL ioctl in usbdevice_fs.h.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [Qemu-devel] Bus number and address changes after usb_add?
@ 2006-12-07 6:43 Yu, Xiaoyang
2006-12-07 7:04 ` Lonnie Mendez
0 siblings, 1 reply; 7+ messages in thread
From: Yu, Xiaoyang @ 2006-12-07 6:43 UTC (permalink / raw)
To: qemu-devel
Thanks a lot! So we need to use "usb_del bus.addr" to remove the device from the guest. So I must get the bus.addr information for the device first. But I cannot do so by just add code into usb_device_add() function, because the bus.addr will change after that. Is there a place in QEMU source code suitable for logging the bus.addr information?
Thanks
Xiaoyang
-----Original Message-----
From: qemu-devel-bounces+xiaoyang.yu=intel.com@nongnu.org [mailto:qemu-devel-bounces+xiaoyang.yu=intel.com@nongnu.org] On Behalf Of Lonnie Mendez
Sent: 2006年12月7日 14:23
To: qemu-devel@nongnu.org
Subject: RE: [Qemu-devel] Bus number and address changes after usb_add?
On Thu, 2006-12-07 at 14:11 +0800, Yu, Xiaoyang wrote:
> I see. Guest OS will assign the USB device an address later. Is it possible to store this new address in host OS? Then when the USB device is unplugged, host OS can send "usb_del" command to QEMU to automatically delete the device.
It's possible (on linux host) to register a signal with the kernel that
will trigger when the device is disconnected from the host system. From
the signal handler the device can then be removed from the guest. See
USBDEVFS_DISCSIGNAL ioctl in usbdevice_fs.h.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [Qemu-devel] Bus number and address changes after usb_add?
2006-12-07 6:43 Yu, Xiaoyang
@ 2006-12-07 7:04 ` Lonnie Mendez
0 siblings, 0 replies; 7+ messages in thread
From: Lonnie Mendez @ 2006-12-07 7:04 UTC (permalink / raw)
To: qemu-devel
On Thu, 2006-12-07 at 14:43 +0800, Yu, Xiaoyang wrote:
> Thanks a lot! So we need to use "usb_del bus.addr" to remove the device from the guest. So I must get the bus.addr information for the device first. But I cannot do so by just add code into usb_device_add() function, because the bus.addr will change after that. Is there a place in QEMU source code suitable for logging the bus.addr information?
The usb code could use some improvement in regards to tracking the
devices internally in qemu. If you scan this list there was an attempt
at adding devices to a tree for tracking them, but that code was
seemingly rushed so it had numerous bugs. You can find the thread with
the proposal here:
http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00489.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-12-07 7:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-07 6:11 [Qemu-devel] Bus number and address changes after usb_add? Yu, Xiaoyang
2006-12-07 6:22 ` Lonnie Mendez
-- strict thread matches above, loose matches on Subject: below --
2006-12-07 6:43 Yu, Xiaoyang
2006-12-07 7:04 ` Lonnie Mendez
2006-12-07 4:20 Yu, Xiaoyang
2006-12-07 4:18 Yu, Xiaoyang
2006-12-07 4:25 ` Lonnie Mendez
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).