From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f196.google.com (mail-oi1-f196.google.com [209.85.167.196]) by mx.groups.io with SMTP id smtpd.web11.6216.1578069630554559492 for ; Fri, 03 Jan 2020 08:40:30 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=p5gTTvfk; spf=pass (domain: gmail.com, ip: 209.85.167.196, mailfrom: matt.devillier@gmail.com) Received: by mail-oi1-f196.google.com with SMTP id 18so13851464oin.9 for ; Fri, 03 Jan 2020 08:40:30 -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:mime-version :content-transfer-encoding; bh=ZBdqz4jPctCCJgpa6f5o4raKySEvBOY6cSp8yWoVdd8=; b=p5gTTvfk0DD22+ObIOXospQwC977iuqINkyylcI+L+6pIocV0x8PLrRV2y/sLLMAzp DkHLhk7/p27Cz/7tcjYRq+p+L32dCBMlrQoPeQWYgnG6BD7zbpMu7OqC3gXENP8YWnB6 nAcl4kVQ7R6T5JXEjVt5txg1YmAjiI8NAdt8kXnpZF3X9+1HQlKkanyXBtbLgbXBs3G0 nHcxdN5EBfCvGJS2DzU7adOf7XAS1qdUzbCp0Xwypwcp1SDMayW9pCGZm2+3tLHJ7PnR Iuwrs8xq953kRcqP/GUFRUKkF68z2+tF3uxZGGyMUE1z7MGU0LQVdWVjmPWgR/iS7ctK KbBA== 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:mime-version :content-transfer-encoding; bh=ZBdqz4jPctCCJgpa6f5o4raKySEvBOY6cSp8yWoVdd8=; b=uKNOPLMIOapTqOu/QGAEIyHoecTxAyos2JLSvkttOdQbFsdae5RcXZgAuFQT05sfGe O1HrGivcSWGHIDUEfYg0LsnvXAfFRhjfcwSzeAWmN2ANkWWhUe2szPc32UdsQaLp8ZBb KQfr3fuuUQE/Mf56HYN4PCy8fSoOJ9y8e+eVWDoKaVXg1iRmIKDIBMEHuPCYiL2pHSna MwSvyLO5bFiAE82MmOVsbdiYjw1IPPXrVz0U5yVfcvrMagZli/NfrPyxgSNin8+ARM5B W9j26stlO7q5Ji2ejrjpY3sMqAQwEzh5rIkJDGxqbbgAoDz3UFemMe0jCRvH0omIutAL 9Hlg== X-Gm-Message-State: APjAAAWGjY26Liy/pN1s9De0LRd4gE6gzTIgKemPbpGG7wtKSUO5jrMl G+Kz6LlH8ljsPwhHqrYnGOEhH52nV6U= X-Google-Smtp-Source: APXvYqwqcMB4X9h2ht7faA/wQ+C8IvUBX0wnqz9MNh5A7b0ptXeKNlvpa15990E0GLhmqupCBMSmVA== X-Received: by 2002:aca:cf50:: with SMTP id f77mr4460320oig.60.1578069629651; Fri, 03 Jan 2020 08:40:29 -0800 (PST) Return-Path: Received: from localhost.localdomain ([69.212.114.66]) by smtp.gmail.com with ESMTPSA id u75sm14255611oie.15.2020.01.03.08.40.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 08:40:29 -0800 (PST) From: "MrChromebox" To: devel@edk2.groups.io Cc: Matt DeVillier Subject: [PATCH 3/3] MdeModulePkg/UsbMouseAbsolutePointer: Fix endpoint selection Date: Fri, 3 Jan 2020 10:39:41 -0600 Message-Id: <20200103163941.9072-1-matt.devillier@gmail.com> X-Mailer: git-send-email 2.20.1 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 --- .../Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointer.c b/MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointer.c index 8953e7031c..9cd0e4cd53 100644 --- a/MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointer.c +++ b/MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointer.c @@ -203,7 +203,7 @@ USBMouseAbsolutePointerDriverBindingStart ( EndpointNumber = UsbMouseAbsolutePointerDevice->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 @@ USBMouseAbsolutePointerDriverBindingStart ( &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