lkml.org 
[lkml]   [2022]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.17 084/343] HID: apple: Report Magic Keyboard 2021 battery over USB
    Date
    From: José Expósito <jose.exposito89@gmail.com>

    [ Upstream commit 8ae5c16c9d421d43f32f66d2308031f1bd3f9336 ]

    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>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    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 7dc89dc6b0f0..18de4ccb0fb2 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.35.1


    \
     
     \ /
      Last update: 2022-04-12 11:28    [W:4.052 / U:0.192 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site