From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7Jb3-0004F0-Cw for qemu-devel@nongnu.org; Tue, 23 Jun 2015 04:30:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7Jay-00015R-G5 for qemu-devel@nongnu.org; Tue, 23 Jun 2015 04:30:21 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:45900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7Jax-000148-UK for qemu-devel@nongnu.org; Tue, 23 Jun 2015 04:30:16 -0400 Message-ID: <55891904.9060508@huawei.com> Date: Tue, 23 Jun 2015 16:29:56 +0800 From: Gonglei MIME-Version: 1.0 References: <1435033463-13185-1-git-send-email-lma@suse.com> In-Reply-To: <1435033463-13185-1-git-send-email-lma@suse.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Re-attach usb device to kernel while usb_host_open fails List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lin Ma , qemu-devel@nongnu.org, kraxel@redhat.com On 2015/6/23 12:24, Lin Ma wrote: > Signed-off-by: Lin Ma > --- > hw/usb/host-libusb.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c > index 10f4735..7258c4d 100644 > --- a/hw/usb/host-libusb.c > +++ b/hw/usb/host-libusb.c > @@ -888,6 +888,11 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev) > fail: > trace_usb_host_open_failure(bus_num, addr); > if (s->dh != NULL) { > + qemu_remove_exit_notifier(&s->exit); > + QTAILQ_REMOVE(&hostdevs, s, next); This change will cause a regression. For example, if an usb device's (assume that it's usb1.0 device) speed does not match the ehci adapter, then then invoking usb_host_open failed. if somebody changes the usb device to an usb 2.0 device, it will not auto check because the device has removed from the global hostdevs list. So I think we don't need do the above operations. Regards, -Gonglei > + usb_host_release_interfaces(s); > + libusb_reset_device(s->dh); > + usb_host_attach_kernel(s); > libusb_close(s->dh); > s->dh = NULL; > s->dev = NULL; >