public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2 0/6] USB keyboard improvements for asahi / desktop systems
@ 2024-03-17 11:07 Janne Grunau via B4 Relay
  2024-03-17 11:07 ` [PATCH v2 1/6] usb: xhci: refactor xhci_set_configuration Janne Grunau via B4 Relay
                   ` (6 more replies)
  0 siblings, 7 replies; 22+ messages in thread
From: Janne Grunau via B4 Relay @ 2024-03-17 11:07 UTC (permalink / raw)
  To: Bin Meng, Marek Vasut, Tom Rini, Simon Glass, Joe Hershberger
  Cc: u-boot, asahi, Janne Grunau

Apple USB Keyboards from 2021 need quirks to be useable. The boot HID
keyboard protocol is unfortunately not described in the first interface
descriptor but the second. This needs several changes. The USB keyboard
driver has to look at all (2) interface descriptors during probing.
Since I didn't want to rebuild the USB driver probe code the Apple
keyboards are bound to the keyboard driver via USB vendor and product
IDs.
To make the keyboards useable on Apple silicon devices the xhci driver
needs to initializes rings for the endpoints of the first two interface
descriptors. If this is causes concerns regarding regressions or memory
use the USB_MAX_ACTIVE_INTERFACES define could be turned into a CONFIG
option.
Even after this changes the keyboards still do not probe successfully
since they apparently do not behave HID standard compliant. They only
generate reports on key events. This leads the final check whether the
keyboard is operational to fail unless the user presses keys during the
probe. Skip this check for known keyboards.
Keychron seems to emulate Apple keyboards (some models even "re-use"
Apple's USB vendor ID) so apply this quirk as well.

Some devices like Yubikeys emulate a keyboard. since u-boot only binds a
single keyboard block this kind of devices from the USB keyboard driver.

Signed-off-by: Janne Grunau <j@jannau.net>
---
Changes in v2:
- rewritten commit message for "[PATCH 2/6] usb: xhci: Set up endpoints for the first 2 interfaces"
- Replaced the usb keyboard Yubikey block with an env based USB device blocklist
- Use "-EINVAL" as return value in "[PATCH 3/6] usb: xhci: Abort transfers with unallocated rings"
- added "Reviewed-by:" tags
- Link to v1: https://lore.kernel.org/r/20240221-asahi-keyboards-v1-0-814b2e741790@jannau.net

---
Janne Grunau (6):
      usb: xhci: refactor xhci_set_configuration
      usb: xhci: Set up endpoints for the first 2 interfaces
      usb: xhci: Abort transfers with unallocated rings
      usb: Add environment based device blocklist
      usb: kbd: support Apple Magic Keyboards (2021)
      usb: kbd: Add probe quirk for Apple and Keychron keyboards

 common/usb.c                 |  56 +++++++++++++++++++
 common/usb_kbd.c             |  61 +++++++++++++++++++--
 doc/usage/environment.rst    |  12 +++++
 drivers/usb/host/xhci-ring.c |   5 ++
 drivers/usb/host/xhci.c      | 126 +++++++++++++++++++++++++++----------------
 include/env_default.h        |  11 ++++
 include/usb.h                |   6 +++
 7 files changed, 227 insertions(+), 50 deletions(-)
---
base-commit: 37345abb97ef0dd9c50a03b2a72617612dcae585
change-id: 20240218-asahi-keyboards-f2ddaf0022b2

Best regards,
-- 
Janne Grunau <j@jannau.net>


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-03-21 23:47 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-17 11:07 [PATCH v2 0/6] USB keyboard improvements for asahi / desktop systems Janne Grunau via B4 Relay
2024-03-17 11:07 ` [PATCH v2 1/6] usb: xhci: refactor xhci_set_configuration Janne Grunau via B4 Relay
2024-03-17 11:07 ` [PATCH v2 2/6] usb: xhci: Set up endpoints for the first 2 interfaces Janne Grunau via B4 Relay
2024-03-17 11:07 ` [PATCH v2 3/6] usb: xhci: Abort transfers with unallocated rings Janne Grunau via B4 Relay
2024-03-17 16:06   ` Marek Vasut
2024-03-17 11:07 ` [PATCH v2 4/6] usb: Add environment based device blocklist Janne Grunau via B4 Relay
2024-03-17 11:34   ` Janne Grunau
2024-03-17 16:07     ` Marek Vasut
2024-03-17 16:18   ` Marek Vasut
2024-03-17 18:15     ` Janne Grunau
2024-03-18  5:06       ` Marek Vasut
2024-03-18  7:33         ` Janne Grunau
2024-03-18 14:17           ` Marek Vasut
2024-03-19 21:17             ` Janne Grunau
2024-03-21 23:47               ` Marek Vasut
2024-03-17 21:39   ` E Shattow
2024-03-18  7:39     ` Janne Grunau
2024-03-17 11:07 ` [PATCH v2 5/6] usb: kbd: support Apple Magic Keyboards (2021) Janne Grunau via B4 Relay
2024-03-17 16:20   ` Marek Vasut
2024-03-17 11:07 ` [PATCH v2 6/6] usb: kbd: Add probe quirk for Apple and Keychron keyboards Janne Grunau via B4 Relay
2024-03-17 16:21   ` Marek Vasut
2024-03-17 11:26 ` [PATCH v2 0/6] USB keyboard improvements for asahi / desktop systems Neal Gompa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox