From 048701fa5f6e83cea569a36b602b7b74ae9d625f Mon Sep 17 00:00:00 2001 From: Arthur Williams Date: Tue, 16 Mar 2021 04:23:33 -0500 Subject: [PATCH 1/2] Detect touch devices as touchscreen The Goodix Capacitive TouchScreen on the pinephone was being detected as a joystick instead of a touchscreen. This patch correctly marks it as a touchscreen and allows it to work out of the box with libinput --- udev_device.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/udev_device.c b/udev_device.c index deab6f1..c7987a1 100644 --- a/udev_device.c +++ b/udev_device.c @@ -434,7 +434,12 @@ static void udev_device_set_properties_from_evdev(struct udev_device *udev_devic else if (find_bit(ev_bits, ev_cnt, EV_ABS)) { if (find_bit(key_bits, key_cnt, BTN_SELECT) || find_bit(key_bits, key_cnt, BTN_TR) || find_bit(key_bits, key_cnt, BTN_START) || find_bit(key_bits, key_cnt, BTN_TL)) { - udev_list_entry_add(&udev_device->properties, "ID_INPUT_JOYSTICK", "1", 0); + if (find_bit(key_bits, key_cnt, BTN_TOUCH)) { + udev_list_entry_add(&udev_device->properties, "ID_INPUT_TOUCHSCREEN", "1", 0); + } + else { + udev_list_entry_add(&udev_device->properties, "ID_INPUT_JOYSTICK", "1", 0); + } } else if (find_bit(abs_bits, abs_cnt, ABS_Y) && find_bit(abs_bits, abs_cnt, ABS_X)) { if (find_bit(abs_bits, abs_cnt, ABS_Z) && !find_bit(ev_bits, ev_cnt, EV_KEY)) { From 3d188e78e860f781c158fdb9ec4bcd9212aaa6eb Mon Sep 17 00:00:00 2001 From: Arthur Williams Date: Sun, 2 May 2021 04:40:16 -0500 Subject: [PATCH 2/2] Treat devices with keys as keyboards Some keyboards have an absolute axis and would erroneously not be treated as a keyboard. Now any device with keys would have the ID_INPUT_KEY property set. --- udev_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev_device.c b/udev_device.c index c7987a1..92c1a41 100644 --- a/udev_device.c +++ b/udev_device.c @@ -461,7 +461,8 @@ static void udev_device_set_properties_from_evdev(struct udev_device *udev_devic } } } - else if (find_bit(ev_bits, ev_cnt, EV_KEY)) { + + if (find_bit(ev_bits, ev_cnt, EV_KEY)) { udev_list_entry_add(&udev_device->properties, "ID_INPUT_KEY", "1", 0); if (find_bit(key_bits, key_cnt, KEY_ENTER)) {