Commit a9ef4ba1 authored by Peter Hutterer's avatar Peter Hutterer

udev: drop the custom firmware detection code in favor of a modalias

This was overengineered. The separation between the model quirks file and the
udev hwdb matches allowed for more complex firmware detection. Except we never
used it anywhere but on ALPS and there we can, thankfully, just get it from
the version number in the input_id field exposed in the modalias.

So let's drop this and use that match instead. We just need an extra udev rule
to match on ID_INPUT_POINTINGSTICKs so we can differ between ALPS touchpads
and ALPS trackpoints.

https://bugs.freedesktop.org/show_bug.cgi?id=106323Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent cf6d7e8d
......@@ -13,7 +13,6 @@
# libinput:touchpad:<modalias>
# libinput:name:<name>:dmi:<dmi string>
# libinput:name:<name>:dt:<device-tree string>
# libinput:name:<name>:fwversion:<version>
#
# Sort by brand, model
......@@ -45,11 +44,21 @@ libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:dmi:*
libinput:name:*AlpsPS/2 ALPS GlidePoint:dmi:*
LIBINPUT_MODEL_ALPS_TOUCHPAD=1
libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:fwversion:800
libinput:name:*AlpsPS/2 ALPS GlidePoint:fwversion:800
# 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 */
libinput:touchpad:input:b0011v0002p0008e0800*
LIBINPUT_ATTR_SIZE_HINT=100x55
libinput:name:*AlpsPS/2 ALPS DualPoint Stick:fwversion:800
libinput:pointingstick:input:b0011v0002p0008e0800*
LIBINPUT_ATTR_TRACKPOINT_RANGE=160
##########################################
......
......@@ -11,23 +11,6 @@
ACTION!="add|change", GOTO="libinput_model_quirks_end"
KERNEL!="event*", GOTO="libinput_model_quirks_end"
# Firmware detection, two-stage process.
# First, run the program and import the LIBINPUT_MODEL_FIRMWARE_VERSION
# environment (if any)
KERNELS=="*input*", \
ENV{ID_INPUT_TOUCHPAD}=="1", \
ENV{.DETECT_FWVERSION}="1"
KERNELS=="*input*", \
ENV{ID_INPUT_POINTINGSTICK}=="1", \
ENV{.DETECT_FWVERSION}="1"
ENV{.DETECT_FWVERSION}!="1", GOTO="skip_fwversion"
IMPORT{program}="@UDEV_TEST_PATH@libinput-model-quirks %S%p"
ENV{LIBINPUT_MODEL_FIRMWARE_VERSION}!="", \
IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:fwversion:$env{LIBINPUT_MODEL_FIRMWARE_VERSION}'"
# End of touchpad firmware detection
LABEL="skip_fwversion"
# libinput:touchpad:<modalias>
ENV{ID_INPUT_TOUCHPAD}=="1", \
IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:touchpad:"
......@@ -40,6 +23,10 @@ ENV{ID_INPUT_TABLET}=="1", \
ENV{ID_INPUT_MOUSE}=="1", \
IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:mouse:"
# libinput:pointingstick:<modalias>
ENV{ID_INPUT_POINTINGSTICK}=="1", \
IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:pointingstick:"
# libinput:touchpad:<modalias>
ENV{ID_INPUT_KEYBOARD}=="1", \
IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:keyboard:"
......
......@@ -51,24 +51,6 @@ prop_value(struct udev_device *device,
return prop_value;
}
static void
handle_touchpad_alps(struct udev_device *device)
{
const char *product;
int bus, vid, pid, version;
product = prop_value(device, "PRODUCT");
if (!product)
return;
if (sscanf(product, "%x/%x/%x/%x", &bus, &vid, &pid, &version) != 4)
return;
/* ALPS' firmware version is the version */
if (version)
printf("LIBINPUT_MODEL_FIRMWARE_VERSION=%x\n", version);
}
static void
handle_touchpad_synaptics(struct udev_device *device)
{
......@@ -102,25 +84,10 @@ handle_touchpad(struct udev_device *device)
if (!name)
return;
if (strstr(name, "AlpsPS/2 ALPS") != NULL)
handle_touchpad_alps(device);
if (strstr(name, "Synaptics ") != NULL)
handle_touchpad_synaptics(device);
}
static void
handle_pointingstick(struct udev_device *device)
{
const char *name = NULL;
name = prop_value(device, "NAME");
if (!name)
return;
if (strstr(name, "AlpsPS/2 ALPS") != NULL)
handle_touchpad_alps(device);
}
/**
* For a non-zero fuzz on the x/y axes, print that fuzz as property and
* reset the kernel's fuzz to 0.
......@@ -200,8 +167,6 @@ int main(int argc, char **argv)
if (prop_value(device, "ID_INPUT_TOUCHPAD"))
handle_touchpad(device);
if (prop_value(device, "ID_INPUT_POINTINGSTICK"))
handle_pointingstick(device);
rc = 0;
......
......@@ -59,7 +59,7 @@ REAL = Combine((INTEGER + Optional('.' + Optional(INTEGER))) ^ ('.' + INTEGER))
UDEV_TAG = Word(string.ascii_uppercase, alphanums + '_')
TYPES = {
'libinput': ('name', 'touchpad', 'mouse', 'keyboard', 'tablet'),
'libinput': ('name', 'touchpad', 'mouse', 'keyboard', 'tablet', 'pointingstick'),
}
......@@ -110,8 +110,7 @@ def property_grammar():
('LIBINPUT_ATTR_PRESSURE_RANGE', Group(crange('SETTINGS*'))),
('LIBINPUT_ATTR_TOUCH_SIZE_RANGE', Group(crange('SETTINGS*'))),
('LIBINPUT_ATTR_TPKBCOMBO_LAYOUT', Or(('below'))),
('LIBINPUT_ATTR_LID_SWITCH_RELIABILITY',
Or(('reliable', 'write_open'))),
('LIBINPUT_ATTR_LID_SWITCH_RELIABILITY', Or(('reliable', 'write_open'))),
('LIBINPUT_ATTR_KEYBOARD_INTEGRATION', Or(('internal', 'external'))),
('LIBINPUT_ATTR_TRACKPOINT_RANGE', INTEGER('Y')),
('LIBINPUT_ATTR_THUMB_PRESSURE_THRESHOLD', INTEGER('Y')),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment