[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] monitor: add usb_detach
From: |
Alon Levy |
Subject: |
Re: [Qemu-devel] [PATCH] monitor: add usb_detach |
Date: |
Mon, 11 Oct 2010 07:02:46 -0400 (EDT) |
----- "Gerd Hoffmann" <address@hidden> wrote:
> 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
>
debugging. naturally when developing the ccid I had cases where I'd
rather detach the device then bring down qemu. since there is no way
currently to add/remove chardev's from monitor, removing/adding
a device is not enough to reset a device state to the state right
after start.
> could have unwanted side effects ...
>
> cheers,
> Gerd