Skip to content

Commit ddc660b

Browse files
committed
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 00dc5a0 commit ddc660b

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
@@ -508,11 +508,16 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
508508
else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
509509
hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
510510
table = macbookair_fn_keys;
511-
else if (hid->vendor == SPI_VENDOR_ID_APPLE &&
512-
hid->product == SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020)
513-
table = apple_fn_keys_mbp13;
514-
else if (hid->vendor == SPI_VENDOR_ID_APPLE)
515-
table = apple_fn_keys_spi;
511+
else if (hid->bus == BUS_HOST || hid->bus == BUS_SPI)
512+
switch (hid->product) {
513+
case SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020:
514+
case HOST_DEVICE_ID_APPLE_MACBOOK_PRO13_2022:
515+
table = apple_fn_keys_mbp13;
516+
break;
517+
default:
518+
table = apple_fn_keys_spi;
519+
break;
520+
}
516521
else if (hid->product < 0x21d || hid->product >= 0x300)
517522
table = powerbook_fn_keys;
518523
else
@@ -867,7 +872,7 @@ static int apple_probe(struct hid_device *hdev,
867872
struct apple_sc *asc;
868873
int ret;
869874

870-
if (id->bus == BUS_SPI && id->vendor == SPI_VENDOR_ID_APPLE &&
875+
if ((id->bus == BUS_SPI || id->bus == BUS_HOST) && id->vendor == SPI_VENDOR_ID_APPLE &&
871876
hdev->type != HID_TYPE_SPI_KEYBOARD)
872877
return -ENODEV;
873878

@@ -1117,6 +1122,8 @@ static const struct hid_device_id apple_devices[] = {
11171122
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
11181123
{ HID_SPI_DEVICE(SPI_VENDOR_ID_APPLE, HID_ANY_ID),
11191124
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
1125+
{ HID_DEVICE(BUS_HOST, HID_GROUP_ANY, HOST_VENDOR_ID_APPLE, HID_ANY_ID),
1126+
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
11201127

11211128
{ }
11221129
};

0 commit comments

Comments
 (0)