On Sun, Mar 17, 2024 at 4:07 AM Janne Grunau via B4 Relay <[email protected]> wrote: > > 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 <[email protected]> > --- > 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/[email protected] > > --- > 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 >
Series LGTM. Thanks for this! :) Reviewed-by: Neal Gompa <[email protected]> -- 真実はいつも一つ!/ Always, there's only one truth!

