From nobody Wed May 8 13:47:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+52723+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+52723+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1578023017; cv=none; d=zohomail.com; s=zohoarc; b=gD43hzl6tx+aX7neu5ijWN+4/BVzdtMW8EpLeCP/FzcZlHYcLCDF4GV6hhMFK593QtF21FsQq5nYkhMpSFMhutFo9ZAZrLFgXpmlmloh8nMVcfnrusobpPCzRl0wngWmnBvIDa6zf81/J/+7homN4Bdr4jARmsEErz3IqV+5sDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578023017; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=1mW+1JeLEIBy3Y5srIRMRW5n9XztDa4mkQIqj/R173Q=; b=YgCHrqi8gcJJlK3+uSbvv6o+irzzcVChjj7LUvVHkcNeOutV17yYhzzkjuIGsPwXmZwU/ancwbQm1K/9R9imQsqZ5hmk1y9IeuxFem5ULYmVkHqCJiMPEV0zJVJnfE9qiItlwCKwALqDZGXcxV4ZO8VlGqqJskKL3YfeHfqCVbc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+52723+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1578023017009816.0028228413764; Thu, 2 Jan 2020 19:43:37 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id dd12YY1788612xzMMDJQg4Qr; Thu, 02 Jan 2020 19:43:36 -0800 X-Received: from mail-ot1-f66.google.com (mail-ot1-f66.google.com [209.85.210.66]) by mx.groups.io with SMTP id smtpd.web10.4018.1578023016163484101 for ; Thu, 02 Jan 2020 19:43:36 -0800 X-Received: by mail-ot1-f66.google.com with SMTP id p8so23092378oth.10 for ; Thu, 02 Jan 2020 19:43:36 -0800 (PST) X-Gm-Message-State: P4aueNmpmcNiedLuoyWxmxGNx1787277AA= X-Google-Smtp-Source: APXvYqz9SbfftX9azsYwhjV6HIOKOleL/a7LSuUhRDNByyj0QPnzI/5MZ+Nn3cCHL0E/59/qf8i2ng== X-Received: by 2002:a9d:7d09:: with SMTP id v9mr78934718otn.338.1578023015322; Thu, 02 Jan 2020 19:43:35 -0800 (PST) X-Received: from localhost.localdomain ([69.212.114.66]) by smtp.gmail.com with ESMTPSA id i2sm20028661oth.39.2020.01.02.19.43.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2020 19:43:34 -0800 (PST) From: "MrChromebox" To: devel@edk2.groups.io Cc: Matt DeVillier Subject: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/Usb/EfiKey: Fix endpoint selection Date: Thu, 2 Jan 2020 21:43:10 -0600 Message-Id: <20200103034310.23428-2-matt.devillier@gmail.com> In-Reply-To: <20200103034310.23428-1-matt.devillier@gmail.com> References: <20200103034310.23428-1-matt.devillier@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,matt.devillier@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1578023016; bh=LeJNessLMpHxAZNPhjPtBCsYq//rhPNf0fqzDMxZczo=; h=Cc:Date:From:Reply-To:Subject:To; b=hszriZaFkYq6QkXnrBZ7cM1wyt4riksetMsVpRFhM3qALjIZqmYHhFVcTilKtNfukNT 3hAFZLKXXYOodS4bf+CY5zOP3tt69Qfs4gUIEoGfvdzr30l8XHygfrE5K1pRuOZqcHFCq cGevWE0QxsxqiYq9rqlxKS0QKE6EBP0tINA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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. Test: detachable keyboard on Google Pixel Slate now works. Signed-off-by: Matt DeVillier --- MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c b/MdeModulePkg/Bus/Usb/= UsbKbDxe/EfiKey.c index 27685995c2..ccb389067a 100644 --- a/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c +++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c @@ -215,7 +215,7 @@ USBKeyboardDriverBindingStart ( EndpointNumber =3D UsbKeyboardDevice->InterfaceDescriptor.NumEndpoints; =20 // - // Traverse endpoints to find interrupt endpoint + // Traverse endpoints to find interrupt endpoint IN // Found =3D FALSE; for (Index =3D 0; Index < EndpointNumber; Index++) { @@ -226,7 +226,8 @@ USBKeyboardDriverBindingStart ( &EndpointDescriptor ); =20 - if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) =3D=3D USB_ENDPOIN= T_INTERRUPT) { + if (((EndpointDescriptor.Attributes & (BIT0 | BIT1)) =3D=3D USB_ENDPOI= NT_INTERRUPT) && + ((EndpointDescriptor.EndpointAddress & USB_ENDPOINT_DIR_IN) !=3D 0= )) { // // We only care interrupt endpoint here // --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#52723): https://edk2.groups.io/g/devel/message/52723 Mute This Topic: https://groups.io/mt/69392825/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-