From cb7c9e596f21df2295d68625d82563bebda72165 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 14 Jun 2018 11:36:44 +1000 Subject: [PATCH 1/8] data: re-add the IBM X41 quirk Was merged while the config branch was ongoing and got lost in the process. Signed-off-by: Peter Hutterer --- data/50-system-lenovo.quirks | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/50-system-lenovo.quirks b/data/50-system-lenovo.quirks index b365fc3c..fba8af1a 100644 --- a/data/50-system-lenovo.quirks +++ b/data/50-system-lenovo.quirks @@ -76,3 +76,8 @@ ModelTabletModeNoSuspend=1 MatchName=Synaptics TM3288-010 MatchDMIModalias=dmi:*svnLenovo:*pvrThinkPadX1Carbon6th:* ModelLenovoCarbonX16th=1 + +[Lenovo X41 Tablet] +MatchName=AT Translated Set 2 keyboard +MatchDMIModalias=dmi:*svnIBM:*pvrThinkPadX41Tablet:* +ModelTabletModeNoSuspend=1 From a57d35a1aae9c561c5c9d781ced2f494fbe009ed Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 14 Jun 2018 11:42:27 +1000 Subject: [PATCH 2/8] quirks: add MatchVersion in addition to VID/PID Needed for the ALPS firmware detection in #39 https://gitlab.freedesktop.org/libinput/libinput/issues/39 Signed-off-by: Peter Hutterer --- src/quirks.c | 22 ++++++++++++++-- test/test-quirks.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 2 deletions(-) diff --git a/src/quirks.c b/src/quirks.c index 3f133015..b1be3d57 100644 --- a/src/quirks.c +++ b/src/quirks.c @@ -85,8 +85,9 @@ enum match_flags { M_DMI = (1 << 4), M_UDEV_TYPE = (1 << 5), M_DT = (1 << 6), + M_VERSION = (1 << 7), - M_LAST = M_DT, + M_LAST = M_VERSION, }; enum bustype { @@ -121,6 +122,7 @@ struct match { enum bustype bus; uint32_t vendor; uint32_t product; + uint32_t version; char *dmi; /* dmi modalias with preceding "dmi:" */ @@ -275,6 +277,7 @@ matchflagname(enum match_flags f) case M_BUS: return "MatchBus"; break; case M_VID: return "MatchVendor"; break; case M_PID: return "MatchProduct"; break; + case M_VERSION: return "MatchVersion"; break; case M_DMI: return "MatchDMIModalias"; break; case M_UDEV_TYPE: return "MatchUdevType"; break; case M_DT: return "MatchDeviceTree"; break; @@ -489,6 +492,16 @@ parse_match(struct quirks_context *ctx, goto out; s->match.product = product; + } else if (streq(key, "MatchVersion")) { + unsigned int version; + + check_set_bit(s, M_VERSION); + if (!strneq(value, "0x", 2) || + !safe_atou_base(value, &version, 16) || + version > 0xFFFF) + goto out; + + s->match.version = version; } else if (streq(key, "MatchDMIModalias")) { check_set_bit(s, M_DMI); if (!strneq(value, "dmi:", 4)) { @@ -1147,7 +1160,8 @@ match_fill_bus_vid_pid(struct match *m, m->product = product; m->vendor = vendor; - m->bits |= M_PID|M_VID; + m->version = version; + m->bits |= M_PID|M_VID|M_VERSION; switch (bus) { case BUS_USB: m->bus = BT_USB; @@ -1295,6 +1309,10 @@ quirk_match_section(struct quirks_context *ctx, if (m->product == s->match.product) matched_flags |= flag; break; + case M_VERSION: + if (m->version == s->match.version) + matched_flags |= flag; + break; case M_DMI: if (fnmatch(s->match.dmi, m->dmi, 0) == 0) matched_flags |= flag; diff --git a/test/test-quirks.c b/test/test-quirks.c index 16bbacf0..be488a7e 100644 --- a/test/test-quirks.c +++ b/test/test-quirks.c @@ -578,6 +578,67 @@ START_TEST(quirks_parse_product_invalid) } END_TEST +START_TEST(quirks_parse_version) +{ + struct quirks_context *ctx; + const char quirks_file[] = + "[Section name]\n" + "MatchVersion=0x0000\n" + "ModelAppleTouchpad=1\n" + "\n" + "[Section name]\n" + "MatchVersion=0x0001\n" + "ModelAppleTouchpad=1\n" + "\n" + "[Section name]\n" + "MatchVersion=0x2343\n" + "ModelAppleTouchpad=1\n"; + struct data_dir dd = make_data_dir(quirks_file); + + ctx = quirks_init_subsystem(dd.dirname, + NULL, + log_handler, + NULL, + QLOG_CUSTOM_LOG_PRIORITIES); + ck_assert_notnull(ctx); + quirks_context_unref(ctx); + cleanup_data_dir(dd); +} +END_TEST + +START_TEST(quirks_parse_version_invalid) +{ + struct quirks_context *ctx; + const char *quirks_file[] = { + "[Section name]\n" + "MatchVersion=-1\n" + "ModelAppleTouchpad=1\n", + "[Section name]\n" + "MatchVersion=abc\n" + "ModelAppleTouchpad=1\n", + "[Section name]\n" + "MatchVersion=0xFFFFF\n" + "ModelAppleTouchpad=1\n", + "[Section name]\n" + "MatchVersion=123\n" + "ModelAppleTouchpad=1\n", + }; + const char **qf; + + ARRAY_FOR_EACH(quirks_file, qf) { + struct data_dir dd = make_data_dir(*qf); + + ctx = quirks_init_subsystem(dd.dirname, + NULL, + log_handler, + NULL, + QLOG_CUSTOM_LOG_PRIORITIES); + ck_assert(ctx == NULL); + cleanup_data_dir(dd); + } +} +END_TEST + START_TEST(quirks_parse_name) { struct quirks_context *ctx; @@ -939,6 +1000,8 @@ TEST_COLLECTION(quirks) litest_add_for_device("quirks:parsing", quirks_parse_vendor_invalid, LITEST_MOUSE); litest_add_for_device("quirks:parsing", quirks_parse_product, LITEST_MOUSE); litest_add_for_device("quirks:parsing", quirks_parse_product_invalid, LITEST_MOUSE); + litest_add_for_device("quirks:parsing", quirks_parse_version, LITEST_MOUSE); + litest_add_for_device("quirks:parsing", quirks_parse_version_invalid, LITEST_MOUSE); litest_add_for_device("quirks:parsing", quirks_parse_name, LITEST_MOUSE); litest_add_for_device("quirks:parsing", quirks_parse_name_invalid, LITEST_MOUSE); litest_add_for_device("quirks:parsing", quirks_parse_udev, LITEST_MOUSE); From 31e349fb5bc447e177a90c03f50b08fc5ca1483c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 14 Jun 2018 11:44:48 +1000 Subject: [PATCH 3/8] data: switch alps touchpad matching to the bus/vid/pid matching PSMOUSE_ALPS is 0x8 https://gitlab.freedesktop.org/libinput/libinput/issues/30 Signed-off-by: Peter Hutterer --- data/30-vendor-alps.quirks | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/data/30-vendor-alps.quirks b/data/30-vendor-alps.quirks index 706a3f7a..fd1dde45 100644 --- a/data/30-vendor-alps.quirks +++ b/data/30-vendor-alps.quirks @@ -1,9 +1,6 @@ -[AlpsTouchpadDualPoint] +[ALPS Serial Touchpads] MatchUdevType=touchpad -MatchName=*AlpsPS/2 ALPS DualPoint TouchPad -ModelALPSTouchpad=1 - -[AlpsTouchpadGlidePoint] -MatchUdevType=touchpad -MatchName=*AlpsPS/2 ALPS GlidePoint +MatchBus=ps2 +MatchVendor=0x0002 +MatchProduct=0x0008 ModelALPSTouchpad=1 From 21ece0ce792e809aca44b37ed710cfb6611946fa Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 14 Jun 2018 11:47:50 +1000 Subject: [PATCH 4/8] data: re-add the ALPS v8 size hint Got lost in the udev to quirks file conversion Signed-off-by: Peter Hutterer --- data/30-vendor-alps.quirks | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/data/30-vendor-alps.quirks b/data/30-vendor-alps.quirks index fd1dde45..5d22fcef 100644 --- a/data/30-vendor-alps.quirks +++ b/data/30-vendor-alps.quirks @@ -4,3 +4,11 @@ MatchBus=ps2 MatchVendor=0x0002 MatchProduct=0x0008 ModelALPSTouchpad=1 + +[ALPS v8 Touchpads] +MatchUdevType=touchpad +MatchBus=ps2 +MatchVendor=0x0002 +MatchProduct=0x0008 +MatchVersion=0x0800 +AttrSizeHint=100x55 From d3633aac24ede02569b3cc2a5a9675e7c145f893 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 14 Jun 2018 11:48:33 +1000 Subject: [PATCH 5/8] data: add ALPS v8 trackpoint range Got lost in the hwdb to quirks conversion Signed-off-by: Peter Hutterer --- data/30-vendor-alps.quirks | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/data/30-vendor-alps.quirks b/data/30-vendor-alps.quirks index 5d22fcef..50be76ad 100644 --- a/data/30-vendor-alps.quirks +++ b/data/30-vendor-alps.quirks @@ -12,3 +12,11 @@ MatchVendor=0x0002 MatchProduct=0x0008 MatchVersion=0x0800 AttrSizeHint=100x55 + +[ALPS v8 Trackpoint] +MatchUdevType=pointingstick +MatchBus=ps2 +MatchVendor=0x0002 +MatchProduct=0x0008 +MatchVersion=0x0800 +AttrTrackpointRange=160 From 0bb30e5d3e041fda0d218c7e4113bfbd27d3a141 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 14 Jun 2018 11:54:52 +1000 Subject: [PATCH 6/8] data: put a 'do not edit' warning into all data files Signed-off-by: Peter Hutterer --- data/10-generic-keyboard.quirks | 2 ++ data/10-generic-lid.quirks | 2 ++ data/10-generic-trackball.quirks | 2 ++ data/30-vendor-aiptek.quirks | 2 ++ data/30-vendor-alps.quirks | 2 ++ data/30-vendor-cyapa.quirks | 2 ++ data/30-vendor-elantech.quirks | 2 ++ data/30-vendor-huion.quirks | 2 ++ data/30-vendor-ibm.quirks | 2 ++ data/30-vendor-logitech.quirks | 2 ++ data/30-vendor-microsoft.quirks | 2 ++ data/30-vendor-razer.quirks | 2 ++ data/30-vendor-synaptics.quirks | 2 ++ data/30-vendor-wacom.quirks | 2 ++ data/50-system-apple.quirks | 2 ++ data/50-system-asus.quirks | 2 ++ data/50-system-chicony.quirks | 2 ++ data/50-system-cyborg.quirks | 2 ++ data/50-system-dell.quirks | 2 ++ data/50-system-google.quirks | 2 ++ data/50-system-hp.quirks | 2 ++ data/50-system-lenovo.quirks | 2 ++ data/50-system-system76.quirks | 2 ++ 23 files changed, 46 insertions(+) diff --git a/data/10-generic-keyboard.quirks b/data/10-generic-keyboard.quirks index 3063dad6..103d05a6 100644 --- a/data/10-generic-keyboard.quirks +++ b/data/10-generic-keyboard.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Serial Keyboards] MatchUdevType=keyboard MatchBus=ps2 diff --git a/data/10-generic-lid.quirks b/data/10-generic-lid.quirks index f3748e16..1c20acd2 100644 --- a/data/10-generic-lid.quirks +++ b/data/10-generic-lid.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Lid Switch Ct9] MatchName=*Lid Switch* MatchDMIModalias=dmi:*:ct9:* diff --git a/data/10-generic-trackball.quirks b/data/10-generic-trackball.quirks index a554a44d..eba32afd 100644 --- a/data/10-generic-trackball.quirks +++ b/data/10-generic-trackball.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Trackball] MatchName=*Trackball* ModelTrackball=1 diff --git a/data/30-vendor-aiptek.quirks b/data/30-vendor-aiptek.quirks index 24abb134..e5319d5a 100644 --- a/data/30-vendor-aiptek.quirks +++ b/data/30-vendor-aiptek.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Aiptek No Tilt Tablet] MatchUdevType=tablet MatchBus=usb diff --git a/data/30-vendor-alps.quirks b/data/30-vendor-alps.quirks index 50be76ad..ed2b1243 100644 --- a/data/30-vendor-alps.quirks +++ b/data/30-vendor-alps.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [ALPS Serial Touchpads] MatchUdevType=touchpad MatchBus=ps2 diff --git a/data/30-vendor-cyapa.quirks b/data/30-vendor-cyapa.quirks index b58a5541..9d89a0ec 100644 --- a/data/30-vendor-cyapa.quirks +++ b/data/30-vendor-cyapa.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Cyapa Touchpads] MatchName=*Cypress APA Trackpad ?cyapa? AttrPressureRange=10:8 diff --git a/data/30-vendor-elantech.quirks b/data/30-vendor-elantech.quirks index 59a8157f..e49c3415 100644 --- a/data/30-vendor-elantech.quirks +++ b/data/30-vendor-elantech.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Elantech Touchpads] MatchName=*Elantech Touchpad* AttrResolutionHint=31x31 diff --git a/data/30-vendor-huion.quirks b/data/30-vendor-huion.quirks index 65f3b2c1..0e46d208 100644 --- a/data/30-vendor-huion.quirks +++ b/data/30-vendor-huion.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + # HUION PenTablet device. Some of these devices send a BTN_TOOL_PEN event # with value 1 on the first event received by the device but never send the # matching BTN_TOOL_PEN value 0 event. The device appears as if it was diff --git a/data/30-vendor-ibm.quirks b/data/30-vendor-ibm.quirks index 195fc21a..988d2a90 100644 --- a/data/30-vendor-ibm.quirks +++ b/data/30-vendor-ibm.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + # IBM/Lenovo Scrollpoint mouse. Instead of a scroll wheel these mice # feature trackpoint-like sticks which generate a huge amount of scroll # events that need to be handled differently than scroll wheel events diff --git a/data/30-vendor-logitech.quirks b/data/30-vendor-logitech.quirks index ebbc9cc2..12b48e4b 100644 --- a/data/30-vendor-logitech.quirks +++ b/data/30-vendor-logitech.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Logitech M570] MatchName=*Logitech M570* ModelTrackball=1 diff --git a/data/30-vendor-microsoft.quirks b/data/30-vendor-microsoft.quirks index c38f30dd..286b902e 100644 --- a/data/30-vendor-microsoft.quirks +++ b/data/30-vendor-microsoft.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Microsoft Surface 3 Lid Switch] MatchName=*Lid Switch* MatchDMIModalias=dmi:*svnMicrosoftCorporation:pnSurface3:* diff --git a/data/30-vendor-razer.quirks b/data/30-vendor-razer.quirks index f69e1e54..b3cd8170 100644 --- a/data/30-vendor-razer.quirks +++ b/data/30-vendor-razer.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Razer Blade Keyboard] MatchUdevType=keyboard MatchBus=usb diff --git a/data/30-vendor-synaptics.quirks b/data/30-vendor-synaptics.quirks index ffb7cd58..3cdeb45d 100644 --- a/data/30-vendor-synaptics.quirks +++ b/data/30-vendor-synaptics.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Synaptics Serial Touchpads] MatchUdevType=touchpad MatchBus=ps2 diff --git a/data/30-vendor-wacom.quirks b/data/30-vendor-wacom.quirks index 87a2eeca..2613d0d2 100644 --- a/data/30-vendor-wacom.quirks +++ b/data/30-vendor-wacom.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Wacom Touchpads] MatchUdevType=touchpad MatchBus=usb diff --git a/data/50-system-apple.quirks b/data/50-system-apple.quirks index 0b1552a0..fbbb1be0 100644 --- a/data/50-system-apple.quirks +++ b/data/50-system-apple.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Apple Touchpads USB] MatchVendor=0x05AC MatchBus=usb diff --git a/data/50-system-asus.quirks b/data/50-system-asus.quirks index ad120df5..8d7fca54 100644 --- a/data/50-system-asus.quirks +++ b/data/50-system-asus.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Asus X555LAB] MatchName=*ETPS/2 Elantech Touchpad* MatchDMIModalias=dmi:*svnASUSTeKCOMPUTERINC.:pnX555LAB:* diff --git a/data/50-system-chicony.quirks b/data/50-system-chicony.quirks index 808427f5..8f71e92f 100644 --- a/data/50-system-chicony.quirks +++ b/data/50-system-chicony.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + # Acer Hawaii Keyboard, uses Chicony VID [Acer Hawaii Keyboard] MatchUdevType=touchpad diff --git a/data/50-system-cyborg.quirks b/data/50-system-cyborg.quirks index 06137ae9..d999dc82 100644 --- a/data/50-system-cyborg.quirks +++ b/data/50-system-cyborg.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Saitek Cyborg RAT5] MatchUdevType=mouse MatchBus=usb diff --git a/data/50-system-dell.quirks b/data/50-system-dell.quirks index 083fcdd3..c3026495 100644 --- a/data/50-system-dell.quirks +++ b/data/50-system-dell.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Dell Touchpads] MatchName=* Touchpad MatchDMIModalias=dmi:*svnDellInc.:* diff --git a/data/50-system-google.quirks b/data/50-system-google.quirks index 14f727d0..cd312973 100644 --- a/data/50-system-google.quirks +++ b/data/50-system-google.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Google Chromebook R13 CB5-312T] MatchName=*Elan Touchpad* MatchDeviceTree=*Chromebook R13 CB5-312T* diff --git a/data/50-system-hp.quirks b/data/50-system-hp.quirks index 0d127dcd..19a91a75 100644 --- a/data/50-system-hp.quirks +++ b/data/50-system-hp.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [HP Compaq 6910p] MatchName=*SynPS/2 Synaptics TouchPad MatchDMIModalias=dmi:*svnHewlett-Packard:*pnHPCompaq6910p* diff --git a/data/50-system-lenovo.quirks b/data/50-system-lenovo.quirks index fba8af1a..794517ae 100644 --- a/data/50-system-lenovo.quirks +++ b/data/50-system-lenovo.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [Lenovo Thinkpad Touchpad] MatchName=*Synaptics* MatchDMIModalias=dmi:*svnLENOVO:*:pvrThinkPad*:* diff --git a/data/50-system-system76.quirks b/data/50-system-system76.quirks index 15dd6108..2e8eb800 100644 --- a/data/50-system-system76.quirks +++ b/data/50-system-system76.quirks @@ -1,3 +1,5 @@ +# Do not edit this file, it will be overwritten on update + [System76 Bonobo Professional] MatchName=SynPS/2 Synaptics TouchPad MatchDMIModalias=dmi:*svnSystem76*pvrbonp5* From b20f6c233040bcc19ccd426f3361c3a61fe8d458 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 14 Jun 2018 11:57:42 +1000 Subject: [PATCH 7/8] data: add the alps firmware version LUT Just in case we need it Signed-off-by: Peter Hutterer --- data/30-vendor-alps.quirks | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/data/30-vendor-alps.quirks b/data/30-vendor-alps.quirks index ed2b1243..2f020d1e 100644 --- a/data/30-vendor-alps.quirks +++ b/data/30-vendor-alps.quirks @@ -1,5 +1,17 @@ # Do not edit this file, it will be overwritten on update +# ALPS firmware versions: +# V1 = 0x100 +# V2 = 0x200 +# V3 = 0x300 +# V3_RUSHMORE = 0x310 +# V4 = 0x400 +# V5 = 0x500 +# V6 = 0x600 +# V7 = 0x700 /* t3btl t4s */ +# V8 = 0x800 /* SS4btl SS4s */ +# V9 = 0x900 /* ss3btl */ + [ALPS Serial Touchpads] MatchUdevType=touchpad MatchBus=ps2 From d3cb40e914cf0cbd83843371d5474d35e985e5e4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 14 Jun 2018 11:33:41 +1000 Subject: [PATCH 8/8] data: don't disable the keyboard on any Thinkpad Yoga models These (probably) all disable the mechanical keyboard anyway, so let's keep it enabled to be able to access the screen keys, if any. https://gitlab.freedesktop.org/libinput/libinput/issues/39 Signed-off-by: Peter Hutterer --- data/50-system-lenovo.quirks | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/data/50-system-lenovo.quirks b/data/50-system-lenovo.quirks index 794517ae..a59e97a5 100644 --- a/data/50-system-lenovo.quirks +++ b/data/50-system-lenovo.quirks @@ -66,11 +66,13 @@ MatchName=*ALPS TrackPoint* MatchDMIModalias=dmi:*svnLENOVO:*:pvrThinkPadX280:* AttrTrackpointRange=70 -# Lenovo Thinkpad X1 Yoga disables the keyboard anyway but has the same device -# use a windows key on the screen and volume rocker on the side (#103749) -[Lenovo Thinkpad X1 Yoga] +# Lenovo Thinkpad Yoga (not the consumer versions) disables the keyboard +# mechanically. We must not disable the keyboard because some keys are +# still accessible on the screen and volume rocker. +# Initially #103749 and extended by #106799 comment 7 +[Lenovo Thinkpad Yoga] MatchName=AT Translated Set 2 keyboard -MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPadX1Yoga1st:* +MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPad*Yoga*:* ModelTabletModeNoSuspend=1 # Lenovo Carbon X1 6th gen (RMI4 only, PS/2 is broken on this device)