Skip to content

Commit 61c7d97

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 becc071 commit 61c7d97

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
@@ -535,11 +535,16 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
535535
else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
536536
hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
537537
table = macbookair_fn_keys;
538-
else if (hid->vendor == SPI_VENDOR_ID_APPLE &&
539-
hid->product == SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020)
540-
table = apple_fn_keys_mbp13;
541-
else if (hid->vendor == SPI_VENDOR_ID_APPLE)
542-
table = apple_fn_keys_spi;
538+
else if (hid->bus == BUS_HOST || hid->bus == BUS_SPI)
539+
switch (hid->product) {
540+
case SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020:
541+
case HOST_DEVICE_ID_APPLE_MACBOOK_PRO13_2022:
542+
table = apple_fn_keys_mbp13;
543+
break;
544+
default:
545+
table = apple_fn_keys_spi;
546+
break;
547+
}
543548
else if (hid->product < 0x21d || hid->product >= 0x300)
544549
table = powerbook_fn_keys;
545550
else
@@ -954,7 +959,7 @@ static int apple_probe(struct hid_device *hdev,
954959
struct apple_sc *asc;
955960
int ret;
956961

957-
if (id->bus == BUS_SPI && id->vendor == SPI_VENDOR_ID_APPLE &&
962+
if ((id->bus == BUS_SPI || id->bus == BUS_HOST) && id->vendor == SPI_VENDOR_ID_APPLE &&
958963
hdev->type != HID_TYPE_SPI_KEYBOARD)
959964
return -ENODEV;
960965

@@ -1215,6 +1220,8 @@ static const struct hid_device_id apple_devices[] = {
12151220
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
12161221
{ HID_SPI_DEVICE(SPI_VENDOR_ID_APPLE, HID_ANY_ID),
12171222
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
1223+
{ HID_DEVICE(BUS_HOST, HID_GROUP_ANY, HOST_VENDOR_ID_APPLE, HID_ANY_ID),
1224+
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
12181225
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT),
12191226
.driver_data = APPLE_MAGIC_BACKLIGHT },
12201227

0 commit comments

Comments
 (0)