From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by mx.groups.io with SMTP id smtpd.web09.1536.1578283942138579749 for ; Sun, 05 Jan 2020 20:12:22 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TnWxAmdU; spf=pass (domain: gmail.com, ip: 209.85.210.65, mailfrom: matt.devillier@gmail.com) Received: by mail-ot1-f65.google.com with SMTP id r27so69896516otc.8 for ; Sun, 05 Jan 2020 20:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eNfWbHTt2+Hv6HgGPupwf94c/ETKHUTd5pKHKaABSpY=; b=TnWxAmdUQngVXLh4qsPh3wXajR2P6JSoTnXUGuUMIP2BoGnqpsXh+3aNRW/68JCucb jjJX3Ie3SUvDuTDGbPw8A9OBABolw/0J+smwWgibKL75Ck14GjKQEAsUnsRvQFpz0mfG nA8iuCTOSjiso+pTZPHzKDUjV4Ud/+sk43PU3AD5wokKhXl6hHCYzQvOLNQV0wdSN+JW nNOp9RzR6mLMBCGiB4ObeWq9W5gQWfrHjpLgywB558owObm4if5CzYDbhHx20op+oX5T kELA9AeoPXdchZtUquqn80LhchDJPnVolqfTUn4PMcB/gFiH+1P3BnBSF7L/E+oSr+Na jlXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eNfWbHTt2+Hv6HgGPupwf94c/ETKHUTd5pKHKaABSpY=; b=X8kPBpgRUSHh02+yh/E0be4LovP/BZZpdjXpOyXfLGmSHzqopPpqTtGgL+z7vw3sW2 tyMeNx2i7pEfsGU0KOPtkFq/IEzSoDKVhXTxp3iglNiJtOgyoNK1BW8L5IgyeALmO0Km CHXIf3gNZbOXr7SIe/81A87DOjBv8LAa9PTSSLIuPwq1i7LysLhqrvnJb6ffr86vcaeT i/PeHCZzLQ4KtQooDXFy+AM11adhPR8ru7ATYR/ALsQUy3X6vKT2MOWy6lUYMwLL1M0C U2jIJAH6U2hyYDhQx5hHZCZPza+lrrPKxOdJ3OucwfeBSaKk7vtlT73JWzff733hRIaZ d7kw== X-Gm-Message-State: APjAAAUBqrADLBcHTojLGahBENGUUF3Ap5sCOdrMpOnWcALG3T2tb35F I3oKpK7v0XdrnbLIPvykX3CKybb2WIA= X-Google-Smtp-Source: APXvYqyG3EJwtJx9NOnnivMD0WnzYLGYqNa8eE6w2SDDzHEseemT12liIhgOh9NcGtwmIsukpi/k8w== X-Received: by 2002:a9d:68d1:: with SMTP id i17mr95357138oto.367.1578283941257; Sun, 05 Jan 2020 20:12:21 -0800 (PST) Return-Path: Received: from localhost.localdomain ([69.212.114.66]) by smtp.gmail.com with ESMTPSA id w72sm21039214oie.49.2020.01.05.20.12.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2020 20:12:20 -0800 (PST) From: "MrChromebox" To: devel@edk2.groups.io Cc: Matt DeVillier Subject: [PATCH v3 2/3] MdeModulePkg/Usb/UsbMouse: Fix endpoint selection Date: Sun, 5 Jan 2020 22:12:06 -0600 Message-Id: <20200106041207.29728-3-matt.devillier@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200106041207.29728-1-matt.devillier@gmail.com> References: <20200106041207.29728-1-matt.devillier@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The endpoint selected by the driver needs to not only be an interrupt type, but have direction IN as required to set up an asynchronous interrupt transfer. Currently, the driver assumes that the first INT endpoint will be of type IN, but that is not true of all devices, and will silently fail on devices which have the OUT endpoint before the IN. Adjust the endpoint selection loop to explictly check for direction IN. Signed-off-by: Matt DeVillier --- MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c b/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c index 677815a8ad..143ff15eb0 100644 --- a/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c +++ b/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c @@ -203,7 +203,7 @@ USBMouseDriverBindingStart ( EndpointNumber = UsbMouseDevice->InterfaceDescriptor.NumEndpoints; // - // Traverse endpoints to find interrupt endpoint + // Traverse endpoints to find interrupt endpoint IN // Found = FALSE; for (Index = 0; Index < EndpointNumber; Index++) { @@ -213,7 +213,8 @@ USBMouseDriverBindingStart ( &EndpointDescriptor ); - if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) { + if (((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) && + ((EndpointDescriptor.EndpointAddress & USB_ENDPOINT_DIR_IN) != 0)) { // // We only care interrupt endpoint here // -- 2.20.1