mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-23 22:14:54 +00:00
usb: kbd: Add probe quirk for Apple and Keychron keyboards
Those keyboards do not return the current device state. Polling will timeout unless there are key presses. This is not a problem during operation but the initial device state query during probing will fail. Skip this step in usb_kbd_probe_dev() to make these devices useable. Not all Apple keyboards behave like this. A keyboard with USB vendor/product ID 05ac:0221 is reported to work with the current code. Unfortunately some Keychron keyboards "re-use" Apple's vendor ID and show the same behavior (Keychron C2, 05ac:024f for example). Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Neal Gompa <neal@gompa.dev> Signed-off-by: Janne Grunau <j@jannau.net>
This commit is contained in:
parent
575c68279c
commit
63f6a449bf
1 changed files with 22 additions and 0 deletions
|
@ -31,6 +31,10 @@
|
||||||
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 0x029a
|
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 0x029a
|
||||||
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021 0x029f
|
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021 0x029f
|
||||||
|
|
||||||
|
#define USB_VENDOR_ID_KEYCHRON 0x3434
|
||||||
|
|
||||||
|
#define USB_HID_QUIRK_POLL_NO_REPORT_IDLE BIT(0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If overwrite_console returns 1, the stdin, stderr and stdout
|
* If overwrite_console returns 1, the stdin, stderr and stdout
|
||||||
* are switched to the serial port, else the settings in the
|
* are switched to the serial port, else the settings in the
|
||||||
|
@ -474,6 +478,7 @@ static int usb_kbd_probe_dev(struct usb_device *dev, unsigned int ifnum)
|
||||||
struct usb_interface *iface;
|
struct usb_interface *iface;
|
||||||
struct usb_endpoint_descriptor *ep;
|
struct usb_endpoint_descriptor *ep;
|
||||||
struct usb_kbd_pdata *data;
|
struct usb_kbd_pdata *data;
|
||||||
|
unsigned int quirks = 0;
|
||||||
int epNum;
|
int epNum;
|
||||||
|
|
||||||
if (dev->descriptor.bNumConfigurations != 1)
|
if (dev->descriptor.bNumConfigurations != 1)
|
||||||
|
@ -506,6 +511,15 @@ static int usb_kbd_probe_dev(struct usb_device *dev, unsigned int ifnum)
|
||||||
|
|
||||||
debug("USB KBD: found interrupt EP: 0x%x\n", ep->bEndpointAddress);
|
debug("USB KBD: found interrupt EP: 0x%x\n", ep->bEndpointAddress);
|
||||||
|
|
||||||
|
switch (dev->descriptor.idVendor) {
|
||||||
|
case USB_VENDOR_ID_APPLE:
|
||||||
|
case USB_VENDOR_ID_KEYCHRON:
|
||||||
|
quirks |= USB_HID_QUIRK_POLL_NO_REPORT_IDLE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
data = malloc(sizeof(struct usb_kbd_pdata));
|
data = malloc(sizeof(struct usb_kbd_pdata));
|
||||||
if (!data) {
|
if (!data) {
|
||||||
printf("USB KBD: Error allocating private data\n");
|
printf("USB KBD: Error allocating private data\n");
|
||||||
|
@ -546,6 +560,14 @@ static int usb_kbd_probe_dev(struct usb_device *dev, unsigned int ifnum)
|
||||||
usb_set_idle(dev, iface->desc.bInterfaceNumber, 0, 0);
|
usb_set_idle(dev, iface->desc.bInterfaceNumber, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Apple and Keychron keyboards do not report the device state. Reports
|
||||||
|
* are only returned during key presses.
|
||||||
|
*/
|
||||||
|
if (quirks & USB_HID_QUIRK_POLL_NO_REPORT_IDLE) {
|
||||||
|
debug("USB KBD: quirk: skip testing device state\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
debug("USB KBD: enable interrupt pipe...\n");
|
debug("USB KBD: enable interrupt pipe...\n");
|
||||||
#ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
|
#ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
|
||||||
data->intq = create_int_queue(dev, data->intpipe, 1,
|
data->intq = create_int_queue(dev, data->intpipe, 1,
|
||||||
|
|
Loading…
Add table
Reference in a new issue