214 lines
7.2 KiB
Diff
214 lines
7.2 KiB
Diff
From da530d630f78bc208a35fd1a6912397253f8db87 Mon Sep 17 00:00:00 2001
|
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Date: Thu, 16 Jul 2015 15:59:01 +1000
|
|
Subject: [PATCH libinput 2/4] evdev: allow for multiple LIBINPUT_MODEL_* flags
|
|
per device
|
|
|
|
On some devices we need to set more than one flag, i.e. make it into actual
|
|
flags.
|
|
|
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Hallelujah-expressed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
|
|
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
|
|
(cherry picked from commit aacf40341dc13761d564ecf910dc833073ae39ae)
|
|
---
|
|
src/evdev-mt-touchpad-buttons.c | 17 +++++++----------
|
|
src/evdev-mt-touchpad.c | 12 ++++--------
|
|
src/evdev.c | 11 ++++++-----
|
|
src/evdev.h | 22 +++++++++++-----------
|
|
udev/90-libinput-model-quirks.rules.in | 10 ++--------
|
|
5 files changed, 30 insertions(+), 42 deletions(-)
|
|
|
|
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
|
|
index 5ecdccd..6852758 100644
|
|
--- a/src/evdev-mt-touchpad-buttons.c
|
|
+++ b/src/evdev-mt-touchpad-buttons.c
|
|
@@ -641,22 +641,19 @@ static enum libinput_config_click_method
|
|
tp_click_get_default_method(struct tp_dispatch *tp)
|
|
{
|
|
struct evdev_device *device = tp->device;
|
|
+ uint32_t clickfinger_models = EVDEV_MODEL_CHROMEBOOK |
|
|
+ EVDEV_MODEL_SYSTEM76_BONOBO |
|
|
+ EVDEV_MODEL_SYSTEM76_GALAGO |
|
|
+ EVDEV_MODEL_SYSTEM76_KUDU |
|
|
+ EVDEV_MODEL_CLEVO_W740SU;
|
|
|
|
if (!tp->buttons.is_clickpad)
|
|
return LIBINPUT_CONFIG_CLICK_METHOD_NONE;
|
|
else if (libevdev_get_id_vendor(tp->device->evdev) == VENDOR_ID_APPLE)
|
|
return LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
|
|
|
|
- switch (device->model) {
|
|
- case EVDEV_MODEL_CHROMEBOOK:
|
|
- case EVDEV_MODEL_SYSTEM76_BONOBO:
|
|
- case EVDEV_MODEL_SYSTEM76_GALAGO:
|
|
- case EVDEV_MODEL_SYSTEM76_KUDU:
|
|
- case EVDEV_MODEL_CLEVO_W740SU:
|
|
+ if (device->model_flags & clickfinger_models)
|
|
return LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
|
|
- default:
|
|
- break;
|
|
- }
|
|
|
|
return LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
|
}
|
|
@@ -688,7 +685,7 @@ tp_init_middlebutton_emulation(struct tp_dispatch *tp,
|
|
if (!libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE)) {
|
|
enable_by_default = true;
|
|
want_config_option = false;
|
|
- } else if (device->model == EVDEV_MODEL_ALPS_TOUCHPAD) {
|
|
+ } else if (device->model_flags & EVDEV_MODEL_ALPS_TOUCHPAD) {
|
|
enable_by_default = true;
|
|
want_config_option = true;
|
|
} else
|
|
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
|
|
index 80827da..c5c54bb 100644
|
|
--- a/src/evdev-mt-touchpad.c
|
|
+++ b/src/evdev-mt-touchpad.c
|
|
@@ -1228,7 +1228,7 @@ evdev_tag_touchpad(struct evdev_device *device,
|
|
*/
|
|
bustype = libevdev_get_id_bustype(device->evdev);
|
|
if (bustype == BUS_USB) {
|
|
- if (device->model == EVDEV_MODEL_APPLE_TOUCHPAD)
|
|
+ if (device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD)
|
|
device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
|
|
} else if (bustype != BUS_BLUETOOTH)
|
|
device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
|
|
@@ -1354,14 +1354,10 @@ tp_init_accel(struct tp_dispatch *tp, double diagonal)
|
|
tp->accel.x_scale_coeff = (DEFAULT_MOUSE_DPI/25.4) / res_x;
|
|
tp->accel.y_scale_coeff = (DEFAULT_MOUSE_DPI/25.4) / res_y;
|
|
|
|
- switch (tp->device->model) {
|
|
- case EVDEV_MODEL_LENOVO_X230:
|
|
+ if (tp->device->model_flags & EVDEV_MODEL_LENOVO_X230)
|
|
profile = touchpad_lenovo_x230_accel_profile;
|
|
- break;
|
|
- default:
|
|
+ else
|
|
profile = touchpad_accel_profile_linear;
|
|
- break;
|
|
- }
|
|
|
|
if (evdev_device_init_pointer_acceleration(tp->device, profile) == -1)
|
|
return -1;
|
|
@@ -1464,7 +1460,7 @@ tp_init_palmdetect(struct tp_dispatch *tp,
|
|
|
|
/* Wacom doesn't have internal touchpads,
|
|
* Apple touchpads are always big enough to warrant palm detection */
|
|
- if (device->model == EVDEV_MODEL_WACOM_TOUCHPAD)
|
|
+ if (device->model_flags & EVDEV_MODEL_WACOM_TOUCHPAD)
|
|
return 0;
|
|
|
|
/* Enable palm detection on touchpads >= 70 mm. Anything smaller
|
|
diff --git a/src/evdev.c b/src/evdev.c
|
|
index 950b334..2e757d8 100644
|
|
--- a/src/evdev.c
|
|
+++ b/src/evdev.c
|
|
@@ -1521,8 +1521,8 @@ evdev_read_dpi_prop(struct evdev_device *device)
|
|
return dpi;
|
|
}
|
|
|
|
-static inline enum evdev_device_model
|
|
-evdev_read_model(struct evdev_device *device)
|
|
+static inline uint32_t
|
|
+evdev_read_model_flags(struct evdev_device *device)
|
|
{
|
|
const struct model_map {
|
|
const char *property;
|
|
@@ -1540,15 +1540,16 @@ evdev_read_model(struct evdev_device *device)
|
|
{ NULL, EVDEV_MODEL_DEFAULT },
|
|
};
|
|
const struct model_map *m = model_map;
|
|
+ uint32_t model_flags = 0;
|
|
|
|
while (m->property) {
|
|
if (!!udev_device_get_property_value(device->udev_device,
|
|
m->property))
|
|
- break;
|
|
+ model_flags |= m->model;
|
|
m++;
|
|
}
|
|
|
|
- return m->model;
|
|
+ return model_flags;
|
|
}
|
|
|
|
static inline int
|
|
@@ -2142,7 +2143,7 @@ evdev_device_create(struct libinput_seat *seat,
|
|
device->scroll.direction = 0;
|
|
device->scroll.wheel_click_angle =
|
|
evdev_read_wheel_click_prop(device);
|
|
- device->model = evdev_read_model(device);
|
|
+ device->model_flags = evdev_read_model_flags(device);
|
|
device->dpi = DEFAULT_MOUSE_DPI;
|
|
|
|
/* at most 5 SYN_DROPPED log-messages per 30s */
|
|
diff --git a/src/evdev.h b/src/evdev.h
|
|
index 77db1b4..363f93b 100644
|
|
--- a/src/evdev.h
|
|
+++ b/src/evdev.h
|
|
@@ -95,16 +95,16 @@ enum evdev_middlebutton_event {
|
|
};
|
|
|
|
enum evdev_device_model {
|
|
- EVDEV_MODEL_DEFAULT,
|
|
- EVDEV_MODEL_LENOVO_X230,
|
|
- EVDEV_MODEL_CHROMEBOOK,
|
|
- EVDEV_MODEL_SYSTEM76_BONOBO,
|
|
- EVDEV_MODEL_SYSTEM76_GALAGO,
|
|
- EVDEV_MODEL_SYSTEM76_KUDU,
|
|
- EVDEV_MODEL_CLEVO_W740SU,
|
|
- EVDEV_MODEL_APPLE_TOUCHPAD,
|
|
- EVDEV_MODEL_WACOM_TOUCHPAD,
|
|
- EVDEV_MODEL_ALPS_TOUCHPAD,
|
|
+ EVDEV_MODEL_DEFAULT = 0,
|
|
+ EVDEV_MODEL_LENOVO_X230 = (1 << 0),
|
|
+ EVDEV_MODEL_CHROMEBOOK = (1 << 1),
|
|
+ EVDEV_MODEL_SYSTEM76_BONOBO = (1 << 2),
|
|
+ EVDEV_MODEL_SYSTEM76_GALAGO = (1 << 3),
|
|
+ EVDEV_MODEL_SYSTEM76_KUDU = (1 << 4),
|
|
+ EVDEV_MODEL_CLEVO_W740SU = (1 << 5),
|
|
+ EVDEV_MODEL_APPLE_TOUCHPAD = (1 << 6),
|
|
+ EVDEV_MODEL_WACOM_TOUCHPAD = (1 << 7),
|
|
+ EVDEV_MODEL_ALPS_TOUCHPAD = (1 << 8),
|
|
};
|
|
|
|
struct mt_slot {
|
|
@@ -221,7 +221,7 @@ struct evdev_device {
|
|
int dpi; /* HW resolution */
|
|
struct ratelimit syn_drop_limit; /* ratelimit for SYN_DROPPED logging */
|
|
|
|
- enum evdev_device_model model;
|
|
+ uint32_t model_flags;
|
|
};
|
|
|
|
#define EVDEV_UNHANDLED_DEVICE ((struct evdev_device *) 1)
|
|
diff --git a/udev/90-libinput-model-quirks.rules.in b/udev/90-libinput-model-quirks.rules.in
|
|
index d834155..5b07726 100644
|
|
--- a/udev/90-libinput-model-quirks.rules.in
|
|
+++ b/udev/90-libinput-model-quirks.rules.in
|
|
@@ -25,18 +25,12 @@ KERNELS=="*input*", \
|
|
IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:fwversion:$env{LIBINPUT_MODEL_FIRMWARE_VERSION}'"
|
|
# End of touchpad firmware detection
|
|
|
|
-# Matches below are exclusive, if one matches we skip the rest
|
|
-# hwdb matches:
|
|
-#
|
|
# libinput:touchpad:<modalias>
|
|
ENV{ID_INPUT_TOUCHPAD}=="1", \
|
|
- IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:touchpad:", \
|
|
- GOTO="libinput_model_quirks_end"
|
|
+ IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:touchpad:"
|
|
|
|
# libinput:name:<name>:dmi:<dmi string>
|
|
KERNELS=="input*", \
|
|
- IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:$attr{[dmi/id]modalias}'", \
|
|
- GOTO="libinput_model_quirks_end"
|
|
-
|
|
+ IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:$attr{[dmi/id]modalias}'"
|
|
|
|
LABEL="libinput_model_quirks_end"
|
|
--
|
|
2.4.3
|
|
|