From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60600 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P5G9Z-0004YP-EU for qemu-devel@nongnu.org; Mon, 11 Oct 2010 07:02:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P5G9X-0002f5-Ju for qemu-devel@nongnu.org; Mon, 11 Oct 2010 07:02:49 -0400 Received: from mx4-phx2.redhat.com ([209.132.183.25]:53859 helo=mx02.colomx.prod.int.phx2.redhat.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P5G9X-0002ex-D9 for qemu-devel@nongnu.org; Mon, 11 Oct 2010 07:02:47 -0400 Date: Mon, 11 Oct 2010 07:02:46 -0400 (EDT) From: Alon Levy Message-ID: <50382020.43081286794966393.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> In-Reply-To: <4CB2C1F2.7070101@redhat.com> Subject: Re: [Qemu-devel] [PATCH] monitor: add usb_detach MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org ----- "Gerd Hoffmann" wrote: > On 10/10/10 13:12, Alon Levy wrote: > > > > ----- "Anthony Liguori" 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