Skip to content

Commit 66e0c6a

Browse files
committed
HID: transport: spi: apple: Use distinctive names input devices
Kwin uses the tripple Vendor ID, Product ID, Name to identify input devices. If the same name ("Apple Internal Keyboard / Trackpad") is used for both keyboard and trackpad actions like disabling the touchpad have confusing effects. On the next login the keyboard will be disabled as well since it shares all identifiers. Signed-off-by: Janne Grunau <j@jannau.net>
1 parent e707483 commit 66e0c6a

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

drivers/hid/spi-hid/spi-hid-apple-core.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,7 @@ static int spihid_register_hid_device(struct spihid_apple *spihid,
903903
struct spihid_interface *iface, u8 device)
904904
{
905905
int ret;
906+
char *suffix;
906907
struct hid_device *hid;
907908

908909
iface->id = device;
@@ -911,7 +912,16 @@ static int spihid_register_hid_device(struct spihid_apple *spihid,
911912
if (IS_ERR(hid))
912913
return PTR_ERR(hid);
913914

914-
strscpy(hid->name, spihid->product, sizeof(hid->name));
915+
/*
916+
* Use 'Apple SPI Keyboard' and 'Apple SPI Trackpad' as input device
917+
* names. The device names need to be distinct since at least Kwin uses
918+
* the tripple Vendor ID, Product ID, Name to identify devices.
919+
*/
920+
snprintf(hid->name, sizeof(hid->name), "Apple SPI %s", iface->name);
921+
// strip ' / Boot' suffix from the name
922+
suffix = strstr(hid->name, " / Boot");
923+
if (suffix)
924+
suffix[0] = '\0';
915925
snprintf(hid->phys, sizeof(hid->phys), "%s (%hhx)",
916926
dev_name(&spihid->spidev->dev), device);
917927
strscpy(hid->uniq, spihid->serial, sizeof(hid->uniq));

0 commit comments

Comments
 (0)