From dc15a42d6cae4195d327253f6f05b65665eb3a93 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 30 Jan 2017 12:58:37 +1000 Subject: switch: for surface 3 tablets, write the lid open to the device These tablets only ever give us a close event, the open event is broken. So when we detect keyboard events, fix the kernel device's state by writing the event to the fd. We still sync the lid state manually, in case this fails and we don't get the SW_LID through the normal event sequence. If it works fine, the real open event will just be ignored. Signed-off-by: Peter Hutterer --- udev/90-libinput-model-quirks.hwdb | 24 ++++++++++++++++-------- udev/parse_hwdb.py | 4 ++-- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'udev') diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb index a5102d2..86eea0d 100644 --- a/udev/90-libinput-model-quirks.hwdb +++ b/udev/90-libinput-model-quirks.hwdb @@ -16,6 +16,15 @@ # # Sort by brand, model +########################################## +# Chassis types 9 (Laptop) and 10 +# (Notebook) are expected to have working +# lid switches +########################################## +libinput:name:*Lid Switch*:dmi:*:ct10:* +libinput:name:*Lid Switch*:dmi:*:ct9:* + LIBINPUT_ATTR_LID_SWITCH_RELIABILITY=reliable + ########################################## # ALPS ########################################## @@ -150,6 +159,13 @@ libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*:pvrThinkPadX1Carbon3rd libinput:name:*Logitech M570*:dmi:* LIBINPUT_MODEL_TRACKBALL=1 +########################################## +# Microsoft +########################################## +# Surface3 needs us to write the open lid switch event +libinput:name:*Lid Switch*:dmi:*svnMicrosoftCorporation:pnSurface3:* + LIBINPUT_ATTR_LID_SWITCH_RELIABILITY=write_open + ########################################## # Synaptics ########################################## @@ -188,11 +204,3 @@ libinput:touchpad:input:b0003v056Ap* libinput:name:*Trackball*:dmi:* LIBINPUT_MODEL_TRACKBALL=1 -########################################## -# Chassis types 9 (Laptop) and 10 -# (Notebook) are expected to have working -# lid switches -########################################## -libinput:name:*Lid Switch*:dmi:*:ct10:* -libinput:name:*Lid Switch*:dmi:*:ct9:* - LIBINPUT_ATTR_LID_SWITCH_RELIABILITY=reliable diff --git a/udev/parse_hwdb.py b/udev/parse_hwdb.py index 102ef6c..d079be2 100755 --- a/udev/parse_hwdb.py +++ b/udev/parse_hwdb.py @@ -102,10 +102,10 @@ def property_grammar(): size_props = [Literal(name)('NAME') - Suppress('=') - val('VALUE') for name, val in sz_props] - reliability_tags = (Literal("reliable")) + reliability_tags = Or(('reliable', 'write_open')) reliability = [Literal('LIBINPUT_ATTR_LID_SWITCH_RELIABILITY')('NAME') - Suppress('=') - - Group(OneOrMore(reliability_tags))('VALUE')] + reliability_tags('VALUE')] grammar = Or(model_props + size_props + reliability) -- cgit v1.2.3