AttrLidSwitchReliability quirk default unreliable->reliable
authorAlexander Courtis <alex@courtis.org>
Tue, 26 Apr 2022 01:55:22 +0000 (01:55 +0000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 26 Apr 2022 01:55:22 +0000 (01:55 +0000)
doc/user/device-quirks.rst
doc/user/tools.rst
quirks/10-generic-lid.quirks [deleted file]
src/evdev.c
src/quirks.c
src/util-prop-parsers.c
src/util-prop-parsers.h
test/test-utils.c

index 3d4fe83..7c22028 100644 (file)
@@ -71,7 +71,7 @@ devices. ::
 
      $ libinput quirks list /dev/input/event19
      $ libinput quirks list /dev/input/event0
-     AttrLidSwitchReliability=reliable
+     AttrLidSwitchReliability=unreliable
 
 The device `event19` does not have any quirks assigned.
 
@@ -162,10 +162,11 @@ AttrPressureRange=N:M, AttrPalmPressureThreshold=O, AttrThumbPressureThreshold=P
     trigger a release (M), when a palm touch is triggered (O) and when a
     thumb touch is triggered (P). O > P > N > M. See
     :ref:`touchpad_pressure_hwdb` for more details.
-AttrLidSwitchReliability=reliable|write_open
-    Indicates the reliability of the lid switch. This is a string enum. Do not
-    use "reliable" for any specific device. Very few devices need this, if in
-    doubt do not set. See :ref:`switches_lid` for details.
+AttrLidSwitchReliability=reliable|unreliable|write_open
+    Indicates the reliability of the lid switch. This is a string enum.
+    Very few devices need this, if in doubt do not set. See :ref:`switches_lid`
+    for details. libinput 1.21.0 changed the default from unreliable to
+    reliable, which may be removed from local overrides.
 AttrKeyboardIntegration=internal|external
     Indicates the integration of the keyboard. This is a string enum.
     Generally only needed for USB keyboards.
index 602319a..85b207c 100644 (file)
@@ -326,7 +326,7 @@ Listing quirks assigned to a device
 The ``libinput quirks`` tool can show quirks applied for any given device. ::
 
      $ libinput quirks list /dev/input/event0
-     AttrLidSwitchReliability=reliable
+     AttrLidSwitchReliability=unreliable
 
 If the tool's output is empty, no quirk is applied. See :ref:`device-quirks`
 for more information.
diff --git a/quirks/10-generic-lid.quirks b/quirks/10-generic-lid.quirks
deleted file mode 100644 (file)
index 1c20acd..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# Do not edit this file, it will be overwritten on update
-
-[Lid Switch Ct9]
-MatchName=*Lid Switch*
-MatchDMIModalias=dmi:*:ct9:*
-AttrLidSwitchReliability=reliable
-
-[Lid Switch Ct10]
-MatchName=*Lid Switch*
-MatchDMIModalias=dmi:*:ct10:*
-AttrLidSwitchReliability=reliable
index 3c31b59..38a0f2f 100644 (file)
@@ -1007,13 +1007,13 @@ evdev_read_switch_reliability_prop(struct evdev_device *device)
        quirks = evdev_libinput_context(device)->quirks;
        q = quirks_fetch_for_device(quirks, device->udev_device);
        if (!q || !quirks_get_string(q, QUIRK_ATTR_LID_SWITCH_RELIABILITY, &prop)) {
-               r = RELIABILITY_UNKNOWN;
+               r = RELIABILITY_RELIABLE;
        } else if (!parse_switch_reliability_property(prop, &r)) {
                evdev_log_error(device,
                                "%s: switch reliability set to unknown value '%s'\n",
                                device->devname,
                                prop);
-               r = RELIABILITY_UNKNOWN;
+               r = RELIABILITY_RELIABLE;
        } else if (r == RELIABILITY_WRITE_OPEN) {
                evdev_log_info(device, "will write switch open events\n");
        }
index 9c5efaa..a5eb2e7 100644 (file)
@@ -728,7 +728,8 @@ parse_attr(struct quirks_context *ctx,
        } else if (streq(key, quirk_get_name(QUIRK_ATTR_LID_SWITCH_RELIABILITY))) {
                p->id = QUIRK_ATTR_LID_SWITCH_RELIABILITY;
                if (!streq(value, "reliable") &&
-                   !streq(value, "write_open"))
+                   !streq(value, "write_open") &&
+                   !streq(value, "unreliable"))
                        goto out;
                p->type = PT_STRING;
                p->value.s = safe_strdup(value);
index 598e40c..20d301f 100644 (file)
@@ -209,12 +209,14 @@ parse_switch_reliability_property(const char *prop,
                                  enum switch_reliability *reliability)
 {
        if (!prop) {
-               *reliability = RELIABILITY_UNKNOWN;
+               *reliability = RELIABILITY_RELIABLE;
                return true;
        }
 
        if (streq(prop, "reliable"))
                *reliability = RELIABILITY_RELIABLE;
+       else if (streq(prop, "unreliable"))
+               *reliability = RELIABILITY_UNRELIABLE;
        else if (streq(prop, "write_open"))
                *reliability = RELIABILITY_WRITE_OPEN;
        else
index 8fbeacd..7178914 100644 (file)
@@ -49,8 +49,8 @@ bool parse_tpkbcombo_layout_poperty(const char *prop,
                                    enum tpkbcombo_layout *layout);
 
 enum switch_reliability {
-       RELIABILITY_UNKNOWN,
        RELIABILITY_RELIABLE,
+       RELIABILITY_UNRELIABLE,
        RELIABILITY_WRITE_OPEN,
 };
 
index 46444d8..0ae3668 100644 (file)
@@ -402,7 +402,8 @@ START_TEST(reliability_prop_parser)
                enum switch_reliability reliability;
        } tests[] = {
                { "reliable", true, RELIABILITY_RELIABLE },
-               { "unreliable", false, 0 },
+               { "unreliable", true, RELIABILITY_UNRELIABLE },
+               { "write_open", true, RELIABILITY_WRITE_OPEN },
                { "", false, 0 },
                { "0", false, 0 },
                { "1", false, 0 },
@@ -424,7 +425,7 @@ START_TEST(reliability_prop_parser)
 
        success = parse_switch_reliability_property(NULL, &r);
        ck_assert(success == true);
-       ck_assert_int_eq(r, RELIABILITY_UNKNOWN);
+       ck_assert_int_eq(r, RELIABILITY_RELIABLE);
 
        success = parse_switch_reliability_property("foo", NULL);
        ck_assert(success == false);