Skip to content

Commit dd5ea76

Browse files
jannaumarcan
authored andcommitted
HID: apple: add support for internal keyboards
Apple MacBook keyboards started using HID over SPI in 2015. With the addition of the SPI HID transport they can be supported by this driver. Support all product ids over with the Apple SPI vendor id for now. Individual product ids will have to be added for a correct Fn/function key mapping. Enable by default on the Apple Arm platform. Signed-off-by: Janne Grunau <[email protected]>
1 parent 37a9153 commit dd5ea76

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

drivers/hid/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ config HID_APPLE
129129
tristate "Apple {i,Power,Mac}Books"
130130
depends on LEDS_CLASS
131131
depends on NEW_LEDS
132-
default !EXPERT
132+
default !EXPERT || SPI_HID_APPLE
133133
help
134134
Support for some Apple devices which less or more break
135135
HID specification.
@@ -1019,7 +1019,7 @@ config HID_SONY
10191019
* Guitar Hero PS3 and PC guitar dongles
10201020

10211021
config SONY_FF
1022-
bool "Sony PS2/3/4 accessories force feedback support"
1022+
bool "Sony PS2/3/4 accessories force feedback support"
10231023
depends on HID_SONY
10241024
select INPUT_FF_MEMLESS
10251025
help

drivers/hid/hid-apple.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,10 @@ static int apple_probe(struct hid_device *hdev,
815815
struct apple_sc *asc;
816816
int ret;
817817

818+
if (id->bus == BUS_SPI && id->vendor == SPI_VENDOR_ID_APPLE &&
819+
hdev->type != HID_TYPE_SPI_KEYBOARD)
820+
return -ENODEV;
821+
818822
asc = devm_kzalloc(&hdev->dev, sizeof(*asc), GFP_KERNEL);
819823
if (asc == NULL) {
820824
hid_err(hdev, "can't alloc apple descriptor\n");
@@ -1056,6 +1060,8 @@ static const struct hid_device_id apple_devices[] = {
10561060
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY },
10571061
{ HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021),
10581062
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
1063+
{ HID_SPI_DEVICE(SPI_VENDOR_ID_APPLE, HID_ANY_ID),
1064+
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
10591065

10601066
{ }
10611067
};

0 commit comments

Comments
 (0)