From patchwork Wed Jun 24 03:39:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Ma X-Patchwork-Id: 487935 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C3EAC14030D for ; Wed, 24 Jun 2015 13:40:58 +1000 (AEST) Received: from localhost ([::1]:48408 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7bYW-0006rV-Qx for incoming@patchwork.ozlabs.org; Tue, 23 Jun 2015 23:40:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7bY9-0006YV-PJ for qemu-devel@nongnu.org; Tue, 23 Jun 2015 23:40:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7bY4-0000xV-Oi for qemu-devel@nongnu.org; Tue, 23 Jun 2015 23:40:33 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:53118) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7bY4-0000vZ-Hy for qemu-devel@nongnu.org; Tue, 23 Jun 2015 23:40:28 -0400 Received: from linux-wc25.site (ip-203-192-156-9.asianetcom.net [203.192.156.9]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Wed, 24 Jun 2015 05:40:24 +0200 From: Lin Ma To: arei.gonglei@huawei.com, qemu-devel@nongnu.org, kraxel@redhat.com Date: Wed, 24 Jun 2015 11:39:01 +0800 Message-Id: <1435117141-10459-1-git-send-email-lma@suse.com> X-Mailer: git-send-email 2.1.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.135.221.5 Cc: Lin Ma Subject: [Qemu-devel] [PATCH V1] Re-attach usb device to kernel while usb_host_open fails X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Changes in V1: For avoiding regression issue, Dont remove the usb device from global hostdevs list while usb speed mismatch occurs. Signed-off-by: Lin Ma --- hw/usb/host-libusb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index bc2944c..11429f5 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -889,6 +889,9 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev) fail: trace_usb_host_open_failure(bus_num, addr); if (s->dh != NULL) { + 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;