From nobody Sat Apr 20 09:17:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1598941916; cv=none; d=zohomail.com; s=zohoarc; b=OZqbzCyDUlDCszyyCop1zJ8ypfkTdKdZ4DNYQfjDczZxjW0P3NKLRvP2OFuoVFKyEarY4/LiuMp3GGd9L2ggofL6ufHq5t5mfze1ZkM56ZOMdztlswQDqEgEYYHMa/g+pK9FhaulJVBJkv3RJSDoYVX6+NttcQtS28KEsOqCQac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598941916; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Subject:To; bh=ieuHmSAFQ2QxL9zFsKEy8HjJKaZ/RnCy/tomG3QMlcw=; b=Ata2k4wHU9VMOAZpvtMu+/Zs+INzoQXtXsL/FNY1l4cSNL1v/5pLN/eywOqnhetXACGiuWzhvJl5Mzf7SjRhMp4GN2atefJ3gkf/DQSg2MsTNxOXdYkkiJxpHzJbXRXYt/wiznL3+5BHYkRJu5uAGmmkZ9ndd3HNZrTVN4IlJl0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1598941916683211.20052700631868; Mon, 31 Aug 2020 23:31:56 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 1EAD610C0055; Tue, 1 Sep 2020 06:31:50 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id B292E10C0040 for ; Tue, 1 Sep 2020 06:31:29 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) for ; Mon, 31 Aug 2020 23:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=bmyIHZOonrRFIOd9yUyE6ksWoIe5BvFz/Qkk5G8DX0Y=; b=r4l+WtgnaZai2bCYqVmUzzH3ESQha76q1dh8v1Ji+FSCP2aVmpZx5b4V3k5i2GT64p q9XyAeMWTxj8nbBsKyo2BUwOFxfuIdByX+0lhKvrMGCwir12BAsUq9PenNSUCCYY+1bv dLme/1tG+24Jg7Q3IMKxBPat4PHrIUlFledh/iXJEfFThnek3iktLugEJxdJOVSTjpp2 EI7nRhCq9f+xNiD8GZgDv3y7zXxY1wO3q1lIP/DyYagaT/O0Y8sdS7SNIkE5YZFR+Aaj 8WwTA1E9K7kW5Z8dOCwXHnJKvHH/iFJ5R1iYPu2tpeU0udD8SOEzZNRyxBCKrcMMDjpR YzWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=bmyIHZOonrRFIOd9yUyE6ksWoIe5BvFz/Qkk5G8DX0Y=; b=CSyTBeWBmJMluP7kPoC8xJryoelxyhiUlM4r1xX1DvtGz7Ik8ksVnGziOTcgdSyWl7 R8MUNs92Vd5se+skDn9pIOfeLBkT0Ew9A+4FhREV5AKw4fatF12gm4FAfQTYMsXCxk+b yqsCSstZukXcIzq3y0Q0Q8OmsifD6WG/She4GzWiCQ2+gQAH4gk39PVQUdO9Q5Me2Sak aoFQYXGauQ++AFqF1s4/avAKlSaOGEr0olhxabJZRBhq9vH8QX4Z60Y3Fnj3H0OAzMEU Zrz5mdg9zL2JQqKcnschWGcZbnra3eFYJYWXO/9rWG8qYxBWgHW7YyAecQr2eisfFN6l 5lmQ== X-Gm-Message-State: AOAM533r7U+8Eb8M7eREE3qHXYvg1JvT51965HZoNvF8wyEuGT3MdCyh oKPMyMS1+v6OioHPzas0WjqdP1qZrpDj6WEDgEMb367DsGjU2w== X-Google-Smtp-Source: ABdhPJzYOqd4sgcv6Ru9LkF4rMs/OfN/jDrKxwXxikHu/+xAxXqWjuaP0NZ190E6JpL8JaZT1pl5ZJvqctZ8d3ppaus= X-Received: by 2002:adf:ca06:: with SMTP id o6mr84842wrh.181.1598941888898; Mon, 31 Aug 2020 23:31:28 -0700 (PDT) MIME-Version: 1.0 From: Matt DeVillier Date: Tue, 1 Sep 2020 01:31:18 -0500 Message-ID: To: seabios Message-ID-Hash: XBOJSSWHKZUMYIQD5JUHUE5SBCKEXIAE X-Message-ID-Hash: XBOJSSWHKZUMYIQD5JUHUE5SBCKEXIAE X-MailFrom: matt.devillier@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [SEABIOS] [PATCH] usb-hid: Fix keyboards using non-primary interface descriptor List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From 9e408a5441330b120a477324c017c0525cb5b365 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Tue, 1 Sep 2020 01:21:23 -0500 Subject: [PATCH] usb-hid: Fix keyboards using non-primary interface descrip= tor A fair number of USB keyboards use an interface descriptor other than the first available, making them non-functional currently. To correct this, iterate through all available interface descriptors until one with the correct class/subclass is found, then call usb_hid_setup= (). Tested on an ultimate hacking keyboard (UHK 60) Signed-off-by: Matt DeVillier --- src/hw/usb-hid.c | 9 ++------- src/hw/usb.c | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/hw/usb-hid.c b/src/hw/usb-hid.c index a22765b..c1ceaba 100644 --- a/src/hw/usb-hid.c +++ b/src/hw/usb-hid.c @@ -138,11 +138,6 @@ usb_hid_setup(struct usbdevice_s *usbdev) return -1; dprintf(2, "usb_hid_setup %p\n", usbdev->defpipe); - struct usb_interface_descriptor *iface =3D usbdev->iface; - if (iface->bInterfaceSubClass !=3D USB_INTERFACE_SUBCLASS_BOOT) - // Doesn't support boot protocol. - return -1; - // Find intr in endpoint. struct usb_endpoint_descriptor *epdesc =3D usb_find_desc( usbdev, USB_ENDPOINT_XFER_INT, USB_DIR_IN); @@ -151,9 +146,9 @@ usb_hid_setup(struct usbdevice_s *usbdev) return -1; } - if (iface->bInterfaceProtocol =3D=3D USB_INTERFACE_PROTOCOL_KEYBOARD) + if (usbdev->iface->bInterfaceProtocol =3D=3D USB_INTERFACE_PROTOCOL_KE= YBOARD) return usb_kbd_setup(usbdev, epdesc); - if (iface->bInterfaceProtocol =3D=3D USB_INTERFACE_PROTOCOL_MOUSE) + if (usbdev->iface->bInterfaceProtocol =3D=3D USB_INTERFACE_PROTOCOL_MO= USE) return usb_mouse_setup(usbdev, epdesc); return -1; } diff --git a/src/hw/usb.c b/src/hw/usb.c index 4f9a852..aea70a5 100644 --- a/src/hw/usb.c +++ b/src/hw/usb.c @@ -391,8 +391,21 @@ configure_usb_device(struct usbdevice_s *usbdev) ret =3D usb_msc_setup(usbdev); if (iface->bInterfaceProtocol =3D=3D US_PR_UAS) ret =3D usb_uas_setup(usbdev); - } else - ret =3D usb_hid_setup(usbdev); + } else { + // Some keyboards use an interface other than the first one + // so iterate through all available + for (int i=3D0; ibNumInterfaces; i++) { + if (iface->bInterfaceClass =3D=3D USB_CLASS_HID && + iface->bInterfaceSubClass =3D=3D USB_INTERFACE_SUBCLASS_BOOT) { + usbdev->iface =3D iface; + ret =3D usb_hid_setup(usbdev); + break; + } else { + iface =3D (void*)iface + iface->bLength; + ret =3D -1; + } + } + } if (ret) goto fail; --=20 2.20.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org