From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=58548 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P5DAI-0006ol-1D for qemu-devel@nongnu.org; Mon, 11 Oct 2010 03:51:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P5DAG-0001w3-Tl for qemu-devel@nongnu.org; Mon, 11 Oct 2010 03:51:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41071) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P5DAG-0001vw-Nq for qemu-devel@nongnu.org; Mon, 11 Oct 2010 03:51:20 -0400 Message-ID: <4CB2C1F2.7070101@redhat.com> Date: Mon, 11 Oct 2010 09:51:14 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] monitor: add usb_detach References: <64312746.15881286709134101.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> In-Reply-To: <64312746.15881286709134101.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alon Levy Cc: qemu-devel@nongnu.org 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 could have unwanted side effects ... cheers, Gerd