Skip to content

Commit da8fb0b

Browse files
committed
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 d35a466 commit da8fb0b

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

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

@@ -1113,6 +1118,8 @@ static const struct hid_device_id apple_devices[] = {
11131118
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
11141119
{ HID_SPI_DEVICE(SPI_VENDOR_ID_APPLE, HID_ANY_ID),
11151120
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
1121+
{ HID_DEVICE(BUS_HOST, HID_GROUP_ANY, HOST_VENDOR_ID_APPLE, HID_ANY_ID),
1122+
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
11161123

11171124
{ }
11181125
};

0 commit comments

Comments
 (0)