Skip to content

Commit 4f34280

Browse files
marcanjannau
authored andcommitted
hid: apple: Bind to HOST devices for MTP
We use BUS_HOST for MTP HID subdevices Signed-off-by: Hector Martin <marcan@marcan.st>
1 parent e52ccd3 commit 4f34280

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

drivers/hid/hid-apple.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,16 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
498498
else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
499499
hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
500500
table = macbookair_fn_keys;
501-
else if (hid->vendor == SPI_VENDOR_ID_APPLE &&
502-
hid->product == SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020)
503-
table = macbookpro_dedicated_esc_fn_keys;
504-
else if (hid->vendor == SPI_VENDOR_ID_APPLE)
505-
table = apple2021_fn_keys;
501+
else if (hid->bus == BUS_HOST || hid->bus == BUS_SPI)
502+
switch (hid->product) {
503+
case SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020:
504+
case HOST_DEVICE_ID_APPLE_MACBOOK_PRO13_2022:
505+
table = macbookpro_dedicated_esc_fn_keys;
506+
break;
507+
default:
508+
table = apple2021_fn_keys;
509+
break;
510+
}
506511
else if (hid->product < 0x21d || hid->product >= 0x300)
507512
table = powerbook_fn_keys;
508513
else
@@ -915,7 +920,7 @@ static int apple_probe(struct hid_device *hdev,
915920
struct apple_sc *asc;
916921
int ret;
917922

918-
if (id->bus == BUS_SPI && id->vendor == SPI_VENDOR_ID_APPLE &&
923+
if ((id->bus == BUS_SPI || id->bus == BUS_HOST) && id->vendor == SPI_VENDOR_ID_APPLE &&
919924
hdev->type != HID_TYPE_SPI_KEYBOARD)
920925
return -ENODEV;
921926

@@ -1180,6 +1185,8 @@ static const struct hid_device_id apple_devices[] = {
11801185
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
11811186
{ HID_SPI_DEVICE(SPI_VENDOR_ID_APPLE, HID_ANY_ID),
11821187
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
1188+
{ HID_DEVICE(BUS_HOST, HID_GROUP_ANY, HOST_VENDOR_ID_APPLE, HID_ANY_ID),
1189+
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
11831190
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT),
11841191
.driver_data = APPLE_MAGIC_BACKLIGHT },
11851192

0 commit comments

Comments
 (0)