Skip to content

Commit

Permalink
HID: add device IDs for Apple SPI HID devices
Browse files Browse the repository at this point in the history
Apple Silicon based laptop use SPI as transport for HID. Add support for
SPI-based HID devices and and Apple keyboard and trackpad devices.
Intel based laptops using the keyboard input driver applespi use the
same HID over SPI protocol and can be supported later.

This requires SPI keyboard/mouse HID types since Apple's intenal
keyboards/trackpads use the same product id.

Signed-off-by: Janne Grunau <[email protected]>
  • Loading branch information
jannau authored and marcan committed Mar 11, 2022
1 parent 256cc7d commit dede648
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2219,6 +2219,9 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
case BUS_I2C:
bus = "I2C";
break;
case BUS_SPI:
bus = "SPI";
break;
case BUS_VIRTUAL:
bus = "VIRTUAL";
break;
Expand Down
5 changes: 5 additions & 0 deletions drivers/hid/hid-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@

#define USB_VENDOR_ID_APPLE 0x05ac
#define BT_VENDOR_ID_APPLE 0x004c
#define SPI_VENDOR_ID_APPLE 0x05ac
#define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304
#define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
#define USB_DEVICE_ID_APPLE_MAGICMOUSE2 0x0269
Expand Down Expand Up @@ -185,6 +186,10 @@
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 0x029c
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 0x029a
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021 0x029f
#define SPI_DEVICE_ID_APPLE_MACBOOK_AIR_2020 0x0281
#define SPI_DEVICE_ID_APPLE_MACBOOK_PRO13_2020 0x0341
#define SPI_DEVICE_ID_APPLE_MACBOOK_PRO14_2021 0x0342
#define SPI_DEVICE_ID_APPLE_MACBOOK_PRO16_2021 0x0343

#define USB_VENDOR_ID_ASUS 0x0486
#define USB_DEVICE_ID_ASUS_T91MT 0x0185
Expand Down
6 changes: 5 additions & 1 deletion include/linux/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,9 @@ struct hid_input {
enum hid_type {
HID_TYPE_OTHER = 0,
HID_TYPE_USBMOUSE,
HID_TYPE_USBNONE
HID_TYPE_USBNONE,
HID_TYPE_SPI_KEYBOARD,
HID_TYPE_SPI_MOUSE,
};

enum hid_battery_status {
Expand Down Expand Up @@ -715,6 +717,8 @@ struct hid_descriptor {
.bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod)
#define HID_I2C_DEVICE(ven, prod) \
.bus = BUS_I2C, .vendor = (ven), .product = (prod)
#define HID_SPI_DEVICE(ven, prod) \
.bus = BUS_SPI, .vendor = (ven), .product = (prod)

#define HID_REPORT_ID(rep) \
.report_type = (rep)
Expand Down

0 comments on commit dede648

Please sign in to comment.