From patchwork Sat May 11 02:48:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 243108 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 8711D2C00D7 for ; Sat, 11 May 2013 12:49:42 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 20CE14A178; Sat, 11 May 2013 04:49:41 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VFrbWWWD72dl; Sat, 11 May 2013 04:49:40 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A4BA44A185; Sat, 11 May 2013 04:49:29 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0D5204A179 for ; Sat, 11 May 2013 04:49:26 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nKu94Xrgu0SI for ; Sat, 11 May 2013 04:49:20 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=ERR(-1.5) (only DNSBL check requested) Received: from mail-ye0-f202.google.com (mail-ye0-f202.google.com [209.85.213.202]) by theia.denx.de (Postfix) with ESMTPS id 86B244A178 for ; Sat, 11 May 2013 04:49:12 +0200 (CEST) Received: by mail-ye0-f202.google.com with SMTP id r13so455892yen.1 for ; Fri, 10 May 2013 19:49:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=1IIyi1Eb/01XMNC1lDZuQzl3ld/6jMDbBn3VzFgkeuE=; b=L0NIlUo/LOn8H/niErC/mFNetz9mrKghq5KFDG8ineYMD7dVmD9DMsFKH7LGYzzA3L uJr9eHU2PmIA271SELk78ngofBkFYkkOAFlMD8MDz01qRlOlv2YrHVx+AvHjGQErUrUw M71hnPJPRTZwHs+7PfEjw16YCOGYXy00qHLbQcgors0Q3vjPxB9fHY+5lt6GONOkfSNi SU04q8fdwdPRWOtKYUev0JV/q3zhHZB6IWh/a6eD838+geELiFMskELLCiULPWzBkGM7 IvzYA9BAVlVfvOWbcZJNQnpotm8QsuWjKeIF4S4A3lAAziweDW4YmMbhw941HeQfkLLo hI7Q== X-Received: by 10.236.123.199 with SMTP id v47mr8318725yhh.21.1368240550663; Fri, 10 May 2013 19:49:10 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id k33si270218yhi.3.2013.05.10.19.49.10 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Fri, 10 May 2013 19:49:10 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.83.1]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 8257931C078; Fri, 10 May 2013 19:49:10 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 3631516025A; Fri, 10 May 2013 19:49:10 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 10 May 2013 19:48:59 -0700 Message-Id: <1368240540-11741-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1368240540-11741-1-git-send-email-sjg@chromium.org> References: <1368240540-11741-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQlE1tkvn47r1ePpIZEjmSCvuMlse8qUO3aQoRVY94cvLu+mtkxDgPuO/oEhGAr0FGYafe1b3VIpMIKXIXUjBwM4u03fMQzg1TgDOf8E08AC1WPUXea7Kpgyoo2R5bQ1f0KOO6VxNGc2QX10HKXWfmN8O6C+TxYJx+lFzBODjbCPUEzH6ukTtEQ3W3pJjFyYGuHZMqW5 Cc: Julius Werner , Vincent Palatin , u-boot-review@google.com Subject: [U-Boot] [PATCH 2/3] usb: workaround non-working keyboards. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Vincent Palatin If the USB keyboard is not answering properly the first request on its interrupt endpoint, just skip it and try the next one. This workarounds an issue with a wireless mouse dongle which presents itself both as a keyboard and a mouse but has a non-functional keyboard interface. Signed-off-by: Vincent Palatin (cherry picked from commit 012bbf0ce0301be2482857e3f03b481dd15c2340) Rebased to upstream/master: Signed-off-by: Simon Glass Reviewed-by: Stefan Reinauer Tested-by: Vincent Palatin --- common/usb_kbd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 188763d..3174b5e 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -461,8 +461,13 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum) usb_set_idle(dev, iface->desc.bInterfaceNumber, REPEAT_RATE, 0); debug("USB KBD: enable interrupt pipe...\n"); - usb_submit_int_msg(dev, pipe, data->new, maxp > 8 ? 8 : maxp, - ep->bInterval); + if (usb_submit_int_msg(dev, pipe, data->new, maxp > 8 ? 8 : maxp, + ep->bInterval) < 0) { + printf("Failed to get keyboard state from device %04x:%04x\n", + dev->descriptor.idVendor, dev->descriptor.idProduct); + /* Abort, we don't want to use that non-functional keyboard. */ + return 0; + } /* Success. */ return 1;