RE: [Qemu-devel] Bus number and address changes after usb_add?

2006-12-06 Thread Lonnie Mendez
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




___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


RE: [Qemu-devel] Bus number and address changes after usb_add?

2006-12-06 Thread Yu, Xiaoyang
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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.


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


RE: [Qemu-devel] Bus number and address changes after usb_add?

2006-12-06 Thread Lonnie Mendez
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.



___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


RE: [Qemu-devel] Bus number and address changes after usb_add?

2006-12-06 Thread Yu, Xiaoyang
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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.


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] Bus number and address changes after usb_add?

2006-12-06 Thread Lonnie Mendez
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.



___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] Bus number and address changes after usb_add?

2006-12-06 Thread Yu, Xiaoyang
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

___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] Bus number and address changes after usb_add?

2006-12-06 Thread Yu, Xiaoyang
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

___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel