From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f66.google.com (mail-ot1-f66.google.com [209.85.210.66]) by mx.groups.io with SMTP id smtpd.web09.1537.1578283943276887039 for ; Sun, 05 Jan 2020 20:12:23 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=glPHRr1s; spf=pass (domain: gmail.com, ip: 209.85.210.66, mailfrom: matt.devillier@gmail.com) Received: by mail-ot1-f66.google.com with SMTP id i15so2252565oto.2 for ; Sun, 05 Jan 2020 20:12:23 -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=BMOWcjoze0XPxQGpXyAJC+Ir2teERVALpl1wJ1XNSMc=; b=glPHRr1s2mKTdHPjdaTXocdQJPu/fp/tb5WEQ3g3qOyPAx7SsOlqgoTZ8XMSqOfY0G Mne84nqdh/n0NovJih0jgNWRaxD3hvi0d2DiYoYgNDhtlXnUfmPvCj+PMNkA7JnQreyv f943wa76//rgT6jOmIX9UZv7jlepMhTZV5dO9HE9GIgVUsEl48FF90iMt2APtOXXq1UB wfoB1CJQfKz5Cb/42DUqf9wC3jW6aJBEu2UXlr5IaLmAqNP5saYIovIkDdbHcXRycMYt D4J2j2N4PFG5cz59bYUBq2X2cVz1N5LVI/cw8ZqpsYIEOrzBvZ2IkmR4NcvjsBSQ1nyk YN6w== 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=BMOWcjoze0XPxQGpXyAJC+Ir2teERVALpl1wJ1XNSMc=; b=Z1+zN30MQLHp3WJLJQaA+rYYHM2qlwtIH7eOOWghgaY4AEygoh9mO9WK++kJPo/+h2 0+AomKiYhtORQklAQva33G9VXiQRuH8jFoGr3JpThUXeCgJf/gtatcr0oGtnviqTTSME VtdRJurtGbZUyHbo0yGUcCbDsWHAiWe4jlB8n+3/W3+44M0pfFCnVUry1roNr9LGIr8P /K5VKguqvwlrgS0zexyqZ4GXqLYMyB4jOG09MJs5580MdIRgxQGqf6G7PbYERhVke+sH N83dwyWks4nX580vIIWVpAYo7TlkXFsuTmAy+hSTRFlDCn9cVuoe3HheX2Qp9HK4NqkL aLFA== X-Gm-Message-State: APjAAAUNUQqY8VbcXzBTe5f/3nr/pnvAcp/m3hvMZCaA3+UzxObPXM4Z 5al5L4ou8uuxC1+MSqAbC3V4attmFN8= X-Google-Smtp-Source: APXvYqwEcvzoPqHA5BYBHae72+OfpPlBmFEL3katAs0Kq2RMNS7ZME8Y7eR9F8NTgKWDPr+VagMbTw== X-Received: by 2002:a9d:5c10:: with SMTP id o16mr3765279otk.286.1578283942099; Sun, 05 Jan 2020 20:12:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2020 20:12:21 -0800 (PST) From: "MrChromebox" To: devel@edk2.groups.io Cc: Matt DeVillier Subject: [PATCH v3 3/3] MdeModulePkg/UsbMouseAbsolutePointer: Fix endpoint selection Date: Sun, 5 Jan 2020 22:12:07 -0600 Message-Id: <20200106041207.29728-4-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/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