AttrLidSwitchReliability quirk default unreliable->reliable

This commit is contained in:
Alexander Courtis 2022-04-26 01:55:22 +00:00 committed by Peter Hutterer
parent a423d7d326
commit e0813f4825
8 changed files with 18 additions and 24 deletions

View 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.

View 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.

View file

@ -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

View 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");
}

View 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);

View 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

View 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,
};

View 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);