|
From: | Gerd Hoffmann |
Subject: | Re: [Qemu-devel] [PATCH] monitor: add usb_detach |
Date: | Mon, 11 Oct 2010 09:51:14 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100827 Red Hat/3.1.3-1.el6 Thunderbird/3.1.3 |
On 10/10/10 13:12, Alon Levy wrote:
----- "Anthony Liguori"<address@hidden> wrote:How is this different than usb_del? Is it that it detaches it but does not delete the device?yes. There is no usb_attach command because it was harder to write (can't use the bus.addr since a detached device doesn't have them) and I didn't need it right now, my device attaches itself based on a external event.
Which points out a problem with this patch: It should better not use bus.addr. addr isn't fixed and even can be uninitialized. Yes, usb_del uses it (for historical reasons). But we better should not use it in new code. Better use the device id (like device_del). Which will work for usb_attach too.
Next question: What is the use case? attach/detach is used by devices internally. usb-host does attach/detach when devices get plugged-in and -out on the host. The ccid device does simliar things on vsclient connect/disconnect. So toggeling the attach state via monitor easily could have unwanted side effects ...
cheers, Gerd
[Prev in Thread] | Current Thread | [Next in Thread] |