All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] HID: apple: Report Magic Keyboard 2021 battery over USB
@ 2022-02-08 18:50 José Expósito
  2022-02-16 15:50 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: José Expósito @ 2022-02-08 18:50 UTC (permalink / raw)
  To: jikos
  Cc: benjamin.tissoires, linux-input, linux-kernel, José Expósito

Like the Apple Magic Keyboard 2015, when connected over USB, the 2021
version registers 2 different interfaces. One of them is used to report
the battery level.

However, unlike when connected over Bluetooth, the battery level is not
reported automatically and it is required to fetch it manually.

Add the APPLE_RDESC_BATTERY quirk to fix the battery report descriptor
and manually fetch the battery level.

Tested with the ANSI, ISO and JIS variants of the keyboard.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>

---

v2: Rebased on master, it was for-next
---
 drivers/hid/hid-apple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 24802a4a636e..ce88f8645155 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -748,7 +748,7 @@ static const struct hid_device_id apple_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021),
-		.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
+		.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY },
 	{ HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021),
 		.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021),
-- 
2.25.1


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

* Re: [PATCH v2] HID: apple: Report Magic Keyboard 2021 battery over USB
  2022-02-08 18:50 [PATCH v2] HID: apple: Report Magic Keyboard 2021 battery over USB José Expósito
@ 2022-02-16 15:50 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2022-02-16 15:50 UTC (permalink / raw)
  To: José Expósito; +Cc: benjamin.tissoires, linux-input, linux-kernel

On Tue, 8 Feb 2022, José Expósito wrote:

> Like the Apple Magic Keyboard 2015, when connected over USB, the 2021
> version registers 2 different interfaces. One of them is used to report
> the battery level.
> 
> However, unlike when connected over Bluetooth, the battery level is not
> reported automatically and it is required to fetch it manually.
> 
> Add the APPLE_RDESC_BATTERY quirk to fix the battery report descriptor
> and manually fetch the battery level.
> 
> Tested with the ANSI, ISO and JIS variants of the keyboard.
> 
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>

Applied.

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2022-02-16 15:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08 18:50 [PATCH v2] HID: apple: Report Magic Keyboard 2021 battery over USB José Expósito
2022-02-16 15:50 ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.