From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f67.google.com (mail-ot1-f67.google.com [209.85.210.67]) by mx.groups.io with SMTP id smtpd.web10.4051.1578023192701779048 for ; Thu, 02 Jan 2020 19:46:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WsCzcbuz; spf=pass (domain: gmail.com, ip: 209.85.210.67, mailfrom: matt.devillier@gmail.com) Received: by mail-ot1-f67.google.com with SMTP id d7so55100403otf.5 for ; Thu, 02 Jan 2020 19:46:32 -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=eNfWbHTt2+Hv6HgGPupwf94c/ETKHUTd5pKHKaABSpY=; b=WsCzcbuzkB5calZcBQA1DqDc/ez0F7eGlR3EmKcEsvkRwYHiTv+wzMuCE8NrWjcKN+ eq4zlvy9Q2i8Fh+mS7XzTkGj9cWzpDLN9HvXemHPiyriIBthwKt2gsYtoWBjqrRxcZVb t92r+8YGNzu/cdOW1XtQiXjiDmnutq4HTgXHptz+hmgF+r54BqFrwJScQk43F73t4/rD hrqSezv/C61hf4V1NRUu9ngOuYY9l35niYk3pO52c6zgzZ7S+LRKsnv9Lkysjg3gBFIg LYlXDsxrA0TcBhqeER6cjr3L3UwT+OGCxOLalZA6DuIh/NSWs5QvRzw6YeCzkh+q2UpF zELQ== 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=eNfWbHTt2+Hv6HgGPupwf94c/ETKHUTd5pKHKaABSpY=; b=VpLqLTGiDJo0CUHqKvgwBd3sSmvQFCAThr7hAlcpJQ8mcqtjSWLg6rgtYyzkoFdrkY xQYrVLCL1Ltg3IvfU82DGeXjfUD7yHXB3YGtEehZUNXjQDwCHsox7qJV5gMxDloQ8Cp2 2Tuhle3aJTiecxdGHJ6We87UdVk3nyaSyw+N5bNLFBvRnp0L339NUFW9nYDQsA6ALT/n 3fT6khgT6rKRKm2UywUMgB7R6cyoKWWmxBcaGTXU7K4cuCfiZc2Iwm+4C/ZntZYqbMZm B6mPOF7WxF5luM3JY/PnYQ4k45YAetfwjofueoGHSTdJ8wZe2Snp2kJoTTOGRDUu2llE pg3w== X-Gm-Message-State: APjAAAXYYOgHX1ZXUN+5E/ifG6v5ZBX0iKi9AKXO/51qW02s5Yb+btuk Q+Abojlijzu7z+PvOaJX/49xT5g3eeQ= X-Google-Smtp-Source: APXvYqw4SqLHjdcH15NDg3M5Cn0Mv6amxbsyT+W1I7SBgarnpSqmg/0sHKNDDXNwaADPBo2S33+l7Q== X-Received: by 2002:a9d:6c92:: with SMTP id c18mr81049536otr.157.1578023191868; Thu, 02 Jan 2020 19:46:31 -0800 (PST) Return-Path: Received: from localhost.localdomain ([69.212.114.66]) by smtp.gmail.com with ESMTPSA id p24sm20106031oth.28.2020.01.02.19.46.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2020 19:46:31 -0800 (PST) From: "MrChromebox" To: devel@edk2.groups.io Cc: Matt DeVillier Subject: [PATCH v2 2/2] MdeModulePkg/Usb/UsbMouse: Fix endpoint selection Date: Thu, 2 Jan 2020 21:46:22 -0600 Message-Id: <20200103034622.24045-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 --- 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