diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2017-05-22 13:34:10 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2017-05-23 15:10:10 +1000 |
commit | 1cfa1f64cfd610d97643be32e92c67c0ecee23c8 (patch) | |
tree | fc27d686275f10e0702cb38246c070701bfb476d /udev | |
parent | 782a0661d110bf1cb348a4acf5858e385f0dc0f2 (diff) |
evdev: read LIBINPUT_ATTR_KEYBOARD_INTEGRATION property
We have heuristics for detecting whether a keyboard is internal or external,
but in some cases (e.g. Surface 3) these heuristics fail. Add a udev property
that we can apply to these cases so we have something that's reliable.
This will likely eventually become ID_INPUT_KEYBOARD_INTEGRATION as shipped by
systemd, similar to the touchpad property.
https://bugs.freedesktop.org/show_bug.cgi?id=101101
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'udev')
-rw-r--r-- | udev/90-libinput-model-quirks.hwdb | 12 | ||||
-rw-r--r-- | udev/90-libinput-model-quirks.rules.in | 4 | ||||
-rwxr-xr-x | udev/parse_hwdb.py | 9 |
3 files changed, 22 insertions, 3 deletions
diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb index 3f04809..229fb1d 100644 --- a/udev/90-libinput-model-quirks.hwdb +++ b/udev/90-libinput-model-quirks.hwdb @@ -26,6 +26,12 @@ libinput:name:*Lid Switch*:dmi:*:ct9:* LIBINPUT_ATTR_LID_SWITCH_RELIABILITY=reliable ########################################## +# Serial keyboards are internal +########################################## +libinput:keyboard:input:b0011v* + LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal + +########################################## # ALPS ########################################## libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:dmi:* @@ -45,7 +51,7 @@ libinput:touchpad:input:b0005v05ACp* LIBINPUT_ATTR_SIZE_HINT=104x75 libinput:name:*Apple Inc. Apple Internal Keyboard*:dmi:* - LIBINPUT_MODEL_APPLE_INTERNAL_KEYBOARD=1 + LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal libinput:mouse:input:b0005v05ACp030D* LIBINPUT_MODEL_APPLE_MAGICMOUSE=1 @@ -186,6 +192,10 @@ libinput:mouse:input:b0003v046DpC408* libinput:name:*Lid Switch*:dmi:*svnMicrosoftCorporation:pnSurface3:* LIBINPUT_ATTR_LID_SWITCH_RELIABILITY=write_open +# Surface 3 Type Cover keyboard +libinput:name:*Microsoft Surface Type Cover Keyboard*:dmi:*svnMicrosoftCorporation:pnSurface3:* + LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal + ########################################## # Synaptics ########################################## diff --git a/udev/90-libinput-model-quirks.rules.in b/udev/90-libinput-model-quirks.rules.in index 8bff192..ace2bf0 100644 --- a/udev/90-libinput-model-quirks.rules.in +++ b/udev/90-libinput-model-quirks.rules.in @@ -33,6 +33,10 @@ ENV{ID_INPUT_TOUCHPAD}=="1", \ ENV{ID_INPUT_MOUSE}=="1", \ IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:mouse:" +# libinput:touchpad:<modalias> +ENV{ID_INPUT_KEYBOARD}=="1", \ + IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:keyboard:" + # libinput:name:<name>:dmi:<dmi string> KERNELS=="input*", \ IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:$attr{[dmi/id]modalias}'" diff --git a/udev/parse_hwdb.py b/udev/parse_hwdb.py index b4f0b1b..8ac6401 100755 --- a/udev/parse_hwdb.py +++ b/udev/parse_hwdb.py @@ -60,7 +60,7 @@ REAL = Combine((INTEGER + Optional('.' + Optional(INTEGER))) ^ ('.' + INTEGER)) UDEV_TAG = Word(string.ascii_uppercase, alphanums + '_') TYPES = { - 'libinput': ('name', 'touchpad', 'mouse'), + 'libinput': ('name', 'touchpad', 'mouse', 'keyboard'), } @functools.lru_cache() @@ -117,8 +117,13 @@ def property_grammar(): Suppress('=') - Group(pressure_range('SETTINGS*')) ] + kbintegration_tags = Or(('internal', 'external')) + kbintegration = [Literal('LIBINPUT_ATTR_KEYBOARD_INTEGRATION')('NAME') - + Suppress('=') - + kbintegration_tags('VALUE')] + grammar = Or(model_props + size_props + reliability + tpkbcombo + - pressure_prop) + pressure_prop + kbintegration) return grammar |