Skip to content

Commit 5fe172a

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 <[email protected]>
1 parent 9d8c9e8 commit 5fe172a

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
@@ -521,11 +521,16 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
521521
else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
522522
hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
523523
table = macbookair_fn_keys;
524-
else if (hid->vendor == SPI_VENDOR_ID_APPLE &&
525-
hid->product == SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020)
526-
table = apple_fn_keys_mbp13;
527-
else if (hid->vendor == SPI_VENDOR_ID_APPLE)
528-
table = apple_fn_keys_spi;
524+
else if (hid->bus == BUS_HOST || hid->bus == BUS_SPI)
525+
switch (hid->product) {
526+
case SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020:
527+
case HOST_DEVICE_ID_APPLE_MACBOOK_PRO13_2022:
528+
table = apple_fn_keys_mbp13;
529+
break;
530+
default:
531+
table = apple_fn_keys_spi;
532+
break;
533+
}
529534
else if (hid->product < 0x21d || hid->product >= 0x300)
530535
table = powerbook_fn_keys;
531536
else
@@ -880,7 +885,7 @@ static int apple_probe(struct hid_device *hdev,
880885
struct apple_sc *asc;
881886
int ret;
882887

883-
if (id->bus == BUS_SPI && id->vendor == SPI_VENDOR_ID_APPLE &&
888+
if ((id->bus == BUS_SPI || id->bus == BUS_HOST) && id->vendor == SPI_VENDOR_ID_APPLE &&
884889
hdev->type != HID_TYPE_SPI_KEYBOARD)
885890
return -ENODEV;
886891

@@ -1130,6 +1135,8 @@ static const struct hid_device_id apple_devices[] = {
11301135
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
11311136
{ HID_SPI_DEVICE(SPI_VENDOR_ID_APPLE, HID_ANY_ID),
11321137
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
1138+
{ HID_DEVICE(BUS_HOST, HID_GROUP_ANY, HOST_VENDOR_ID_APPLE, HID_ANY_ID),
1139+
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
11331140

11341141
{ }
11351142
};

0 commit comments

Comments
 (0)