Skip to content

Commit 04624f1

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 dfab64f commit 04624f1

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
@@ -517,11 +517,16 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
517517
else if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
518518
hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
519519
table = macbookair_fn_keys;
520-
else if (hid->vendor == SPI_VENDOR_ID_APPLE &&
521-
hid->product == SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020)
522-
table = apple_fn_keys_mbp13;
523-
else if (hid->vendor == SPI_VENDOR_ID_APPLE)
524-
table = apple_fn_keys_spi;
520+
else if (hid->bus == BUS_HOST || hid->bus == BUS_SPI)
521+
switch (hid->product) {
522+
case SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020:
523+
case HOST_DEVICE_ID_APPLE_MACBOOK_PRO13_2022:
524+
table = apple_fn_keys_mbp13;
525+
break;
526+
default:
527+
table = apple_fn_keys_spi;
528+
break;
529+
}
525530
else if (hid->product < 0x21d || hid->product >= 0x300)
526531
table = powerbook_fn_keys;
527532
else
@@ -876,7 +881,7 @@ static int apple_probe(struct hid_device *hdev,
876881
struct apple_sc *asc;
877882
int ret;
878883

879-
if (id->bus == BUS_SPI && id->vendor == SPI_VENDOR_ID_APPLE &&
884+
if ((id->bus == BUS_SPI || id->bus == BUS_HOST) && id->vendor == SPI_VENDOR_ID_APPLE &&
880885
hdev->type != HID_TYPE_SPI_KEYBOARD)
881886
return -ENODEV;
882887

@@ -1126,6 +1131,8 @@ static const struct hid_device_id apple_devices[] = {
11261131
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
11271132
{ HID_SPI_DEVICE(SPI_VENDOR_ID_APPLE, HID_ANY_ID),
11281133
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
1134+
{ HID_DEVICE(BUS_HOST, HID_GROUP_ANY, HOST_VENDOR_ID_APPLE, HID_ANY_ID),
1135+
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
11291136

11301137
{ }
11311138
};

0 commit comments

Comments
 (0)