From patchwork Fri Jan 13 13:28:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 135836 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5F959B6F13 for ; Sat, 14 Jan 2012 00:28:00 +1100 (EST) Received: from localhost ([::1]:57617 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlhAk-0004lm-BR for incoming@patchwork.ozlabs.org; Fri, 13 Jan 2012 08:27:58 -0500 Received: from eggs.gnu.org ([140.186.70.92]:49601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlhAb-0004lF-D9 for qemu-devel@nongnu.org; Fri, 13 Jan 2012 08:27:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlhAa-0001Ka-5U for qemu-devel@nongnu.org; Fri, 13 Jan 2012 08:27:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlhAZ-0001KV-Ky for qemu-devel@nongnu.org; Fri, 13 Jan 2012 08:27:48 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0DDRkx4032672 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 13 Jan 2012 08:27:46 -0500 Received: from shalem.localdomain.com (vpn1-6-225.ams2.redhat.com [10.36.6.225]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q0DDRiw0014709; Fri, 13 Jan 2012 08:27:45 -0500 From: Hans de Goede To: Gerd Hoffmann Date: Fri, 13 Jan 2012 14:28:56 +0100 Message-Id: <1326461336-5699-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Hans de Goede , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] usb-ehci: Clear the portstatus powner bit on device disconnect 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 According to the EHCI spec port ownerhsip should revert to the EHCI controller on device disconnect. This fixes the problem of a port getting stuck on USB 1 when using redirection and plugging in a USB 2 device after a USB 1 device has been redirected. Signed-off-by: Hans de Goede --- hw/usb-ehci.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c index a946e1d..69bcc4b 100644 --- a/hw/usb-ehci.c +++ b/hw/usb-ehci.c @@ -764,6 +764,11 @@ static void ehci_detach(USBPort *port) USBPort *companion = s->companion_ports[port->index]; companion->ops->detach(companion); companion->dev = NULL; + /* + * EHCI spec 4.2.2: "When a disconnect occurs... On the event, + * the port ownership is returned immediately to the EHCI controller." + */ + *portsc &= ~PORTSC_POWNER; return; }