Compare commits

..

No commits in common. "master" and "libevdev-1.13.3" have entirely different histories.

13 changed files with 97 additions and 377 deletions

View file

@ -4,7 +4,7 @@
# #
########################################
.templates_sha: &template_sha e195d80f35b45cc73668be3767b923fd76c70ed5 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
.templates_sha: &template_sha 9568e38927f9e9c48d4f586f84a071c3a4bdcd39 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
include:
- project: 'freedesktop/ci-templates'
@ -72,46 +72,46 @@ variables:
variables:
MESON_TEST_ARGS: '--no-suite=needs-uinput'
.fedora:40:
.fedora:38:
extends: .fdo.distribution-image@fedora
variables:
FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_VERSION: '40'
FDO_DISTRIBUTION_TAG: '2024-03-24.0'
FDO_DISTRIBUTION_VERSION: '38'
.fedora:41:
.fedora:39:
extends: .fdo.distribution-image@fedora
variables:
FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_VERSION: '41'
FDO_DISTRIBUTION_TAG: '2024-03-24.0'
FDO_DISTRIBUTION_VERSION: '39'
.ubuntu:24.10:
.ubuntu:23.04:
extends: .fdo.distribution-image@ubuntu
variables:
FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_VERSION: '24.10'
FDO_DISTRIBUTION_TAG: '2024-03-24.0'
FDO_DISTRIBUTION_VERSION: '23.04'
.debian:stable:
extends: .fdo.distribution-image@debian
variables:
FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_TAG: '2024-03-24.0'
FDO_DISTRIBUTION_VERSION: 'stable'
.debian:sid:
extends: .fdo.distribution-image@debian
variables:
FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_TAG: '2024-03-24.0'
FDO_DISTRIBUTION_VERSION: 'sid'
.arch:rolling:
extends: .fdo.distribution-image@arch
variables:
FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_TAG: '2024-03-24.0'
FDO_DISTRIBUTION_VERSION: 'rolling'
.alpine:latest:
extends: .fdo.distribution-image@alpine
variables:
FDO_DISTRIBUTION_TAG: '2024-11-25.0'
FDO_DISTRIBUTION_TAG: '2024-03-24.0'
FDO_DISTRIBUTION_VERSION: 'latest'
@ -144,7 +144,7 @@ check-commit:
- .fdo.ci-fairy
stage: prep
script:
- ci-fairy -vv check-commits --junit-xml=results.xml && exit 0 || true
- ci-fairy -vv check-commits --signed-off-by --junit-xml=results.xml && exit 0 || true
- echo "Error checking the commit message format. Please verify"
- exit 1
except:
@ -188,7 +188,7 @@ check-merge-request:
.arch.packages:
variables:
FDO_DISTRIBUTION_PACKAGES: 'git gc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen'
FDO_DISTRIBUTION_PACKAGES: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen'
.alpine.packages:
variables:
@ -197,9 +197,9 @@ check-merge-request:
# Pulls in the container from upstream or rebuilds it if missing
fedora:40@container-prep:
fedora:38@container-prep:
extends:
- .fedora:40
- .fedora:38
- .fedora.packages
- .fdo.container-build@fedora
stage: prep
@ -208,9 +208,9 @@ fedora:40@container-prep:
# Pulls in the container from upstream or rebuilds it if missing
fedora:41@container-prep:
fedora:39@container-prep:
extends:
- .fedora:41
- .fedora:39
- .fedora.packages
- .fdo.container-build@fedora
stage: prep
@ -219,9 +219,9 @@ fedora:41@container-prep:
# Pulls in the container from upstream or rebuilds it if missing
ubuntu:24.10@container-prep:
ubuntu:23.04@container-prep:
extends:
- .ubuntu:24.10
- .ubuntu:23.04
- .ubuntu.packages
- .fdo.container-build@ubuntu
stage: prep
@ -302,26 +302,26 @@ alpine:latest@container-prep:
only:
- schedules
### fedora 40
fedora:40@container-clean:
### fedora 38
fedora:38@container-clean:
extends:
- .fedora:40
- .fedora:38
- .container-clean
needs: ["fedora:40@container-prep"]
needs: ["fedora:38@container-prep"]
### fedora 41
fedora:41@container-clean:
### fedora 39
fedora:39@container-clean:
extends:
- .fedora:41
- .fedora:39
- .container-clean
needs: ["fedora:41@container-prep"]
needs: ["fedora:39@container-prep"]
### ubuntu 24.10
ubuntu:24.10@container-clean:
### ubuntu 23.04
ubuntu:23.04@container-clean:
extends:
- .ubuntu:24.10
- .ubuntu:23.04
- .container-clean
needs: ["ubuntu:24.10@container-prep"]
needs: ["ubuntu:23.04@container-prep"]
### debian stable
debian:stable@container-clean:
@ -373,49 +373,49 @@ alpine:latest@container-clean:
dependencies: []
fedora:40@autotools-build:
fedora:38@autotools-build:
extends:
- .fedora:40
- .fedora:38
- .autotools-build@template
stage: autotools
needs: ['fedora:40@container-prep']
needs: ['fedora:38@container-prep']
fedora:40@meson-build:
fedora:38@meson-build:
extends:
- .fedora:40
- .fedora:38
- .meson-build@template
stage: meson
needs: ['fedora:40@container-prep']
needs: ['fedora:38@container-prep']
fedora:41@autotools-build:
fedora:39@autotools-build:
extends:
- .fedora:41
- .fedora:39
- .autotools-build@template
stage: autotools
needs: ['fedora:41@container-prep']
needs: ['fedora:39@container-prep']
fedora:41@meson-build:
fedora:39@meson-build:
extends:
- .fedora:41
- .fedora:39
- .meson-build@template
stage: meson
needs: ['fedora:41@container-prep']
needs: ['fedora:39@container-prep']
ubuntu:24.10@autotools-build:
ubuntu:23.04@autotools-build:
extends:
- .ubuntu:24.10
- .ubuntu:23.04
- .autotools-build@template
stage: autotools
needs: ['ubuntu:24.10@container-prep']
needs: ['ubuntu:23.04@container-prep']
ubuntu:24.10@meson-build:
ubuntu:23.04@meson-build:
extends:
- .ubuntu:24.10
- .ubuntu:23.04
- .meson-build@template
stage: meson
needs: ['ubuntu:24.10@container-prep']
needs: ['ubuntu:23.04@container-prep']
debian:stable@autotools-build:
@ -484,10 +484,10 @@ alpine:latest@meson-build:
# because they're supposed to fail equally on all
.fedora-custom-build@autotools-template:
extends:
- .fedora:40
- .fedora:38
- .autotools-build@template
stage: build
needs: ['fedora:40@container-prep']
needs: ['fedora:38@container-prep']
no-valgrind:autotools:
extends: .fedora-custom-build@autotools-template
@ -526,10 +526,10 @@ enable-gcov:autotools:
.fedora-custom-build@meson-template:
extends:
- .fedora:40
- .fedora:38
- .meson-build@template
stage: build
needs: ['fedora:40@container-prep']
needs: ['fedora:38@container-prep']
no-valgrind:meson:
extends: .fedora-custom-build@meson-template
@ -580,7 +580,7 @@ static-build:meson:
soname:
extends:
- .fedora:40
- .fedora:38
stage: build
script:
- ./autogen.sh --prefix=$PWD/prefix-autotools/
@ -589,7 +589,7 @@ soname:
- meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/
- ninja -C "$MESON_BUILDDIR" install
- ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0
needs: ['fedora:40@container-prep']
needs: ['fedora:38@container-prep']
#################################################################
# #
@ -632,10 +632,10 @@ qemu:meson:
stage: VM
extends:
- .fdo.distribution-image@fedora
- .fedora:41
- .fedora:39
- .build-in-b2c@template
needs:
- "fedora:41@container-prep"
- "fedora:39@container-prep"
qemu:meson:valgrind:
extends:
@ -646,7 +646,7 @@ qemu:meson:valgrind:
meson-from-tarball:
extends:
- .fedora:41
- .fedora:39
stage: tarballs
script:
- export INSTALLDIR="$PWD/_inst"
@ -664,11 +664,11 @@ meson-from-tarball:
- ninja -C "$MESON_BUILDDIR" install
- popd > /dev/null
- ls -lR $INSTALLDIR
needs: ['fedora:41@container-prep']
needs: ['fedora:39@container-prep']
autotools-from-tarball:
extends:
- .fedora:41
- .fedora:39
stage: tarballs
script:
- export INSTALLDIR="$PWD/_inst"
@ -689,4 +689,4 @@ autotools-from-tarball:
variables:
LIBEVDEV_SKIP_ROOT_TESTS: 1
needs: ['fedora:41@container-prep']
needs: ['fedora:39@container-prep']

View file

@ -6,7 +6,7 @@
# #
########################################
.templates_sha: &template_sha e195d80f35b45cc73668be3767b923fd76c70ed5 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
.templates_sha: &template_sha 9568e38927f9e9c48d4f586f84a071c3a4bdcd39 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
include:
- project: 'freedesktop/ci-templates'
@ -115,7 +115,7 @@ check-commit:
- .fdo.ci-fairy
stage: prep
script:
- ci-fairy -vv check-commits --junit-xml=results.xml && exit 0 || true
- ci-fairy -vv check-commits --signed-off-by --junit-xml=results.xml && exit 0 || true
- echo "Error checking the commit message format. Please verify"
- exit 1
except:

View file

@ -3,7 +3,7 @@
#
# We're happy to rebuild all containers when one changes.
.default_tag: &default_tag '2024-11-25.0'
.default_tag: &default_tag '2024-03-24.0'
distributions:
- name: fedora
@ -12,8 +12,8 @@ distributions:
# only one distro for qemu tests
use_for_qemu_tests: true
versions:
- '40'
- '41'
- '38'
- '39'
packages:
- git
- gcc
@ -42,7 +42,7 @@ distributions:
- name: ubuntu
tag: *default_tag
versions:
- '24.10'
- '23.04'
packages:
- git
- gcc
@ -86,7 +86,7 @@ distributions:
- 'rolling'
packages:
- git
- gc
- gcc
- meson
- automake
- autoconf

View file

@ -7,7 +7,7 @@ AC_PREREQ([2.62])
# change meson version too
AC_INIT([libevdev],
[1.13.6],
[1.13.3],
[https://gitlab.freedesktop.org/libevdev/libevdev/issues/],
[libevdev],
[http://freedesktop.org/wiki/Software/libevdev/])

View file

@ -27,7 +27,6 @@
#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
#define INPUT_PROP_PRESSUREPAD 0x07 /* pressure triggers clicks */
#define INPUT_PROP_MAX 0x1f
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
@ -520,7 +519,6 @@
#define KEY_NOTIFICATION_CENTER 0x1bc /* Show/hide the notification center */
#define KEY_PICKUP_PHONE 0x1bd /* Answer incoming call */
#define KEY_HANGUP_PHONE 0x1be /* Decline incoming call */
#define KEY_LINK_PHONE 0x1bf /* AL Phone Syncing */
#define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1
@ -602,11 +600,6 @@
#define BTN_DPAD_LEFT 0x222
#define BTN_DPAD_RIGHT 0x223
#define BTN_GRIPL 0x224
#define BTN_GRIPR 0x225
#define BTN_GRIPL2 0x226
#define BTN_GRIPR2 0x227
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
#define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */
@ -631,18 +624,6 @@
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
/*
* Keycodes for hotkeys toggling the electronic privacy screen found on some
* laptops on/off. Note when the embedded-controller turns on/off the eprivacy
* screen itself then the state should be reported through drm connecter props:
* https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties
* Except when implementing the drm connecter properties API is not possible
* because e.g. the firmware does not allow querying the presence and/or status
* of the eprivacy screen at boot.
*/
#define KEY_EPRIVACY_SCREEN_ON 0x252
#define KEY_EPRIVACY_SCREEN_OFF 0x253
#define KEY_KBDINPUTASSIST_PREV 0x260
#define KEY_KBDINPUTASSIST_NEXT 0x261
#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
@ -783,9 +764,6 @@
#define KEY_KBD_LCD_MENU4 0x2bb
#define KEY_KBD_LCD_MENU5 0x2bc
/* Performance Boost key (Alienware)/G-Mode key (Dell) */
#define KEY_PERFORMANCE 0x2bd
#define BTN_TRIGGER_HAPPY 0x2c0
#define BTN_TRIGGER_HAPPY1 0x2c0
#define BTN_TRIGGER_HAPPY2 0x2c1
@ -946,8 +924,7 @@
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
#define SW_MACHINE_COVER 0x10 /* set = cover closed */
#define SW_USB_INSERT 0x11 /* set = USB audio device connected */
#define SW_MAX 0x11
#define SW_MAX 0x10
#define SW_CNT (SW_MAX+1)
/*

View file

@ -27,7 +27,6 @@
#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
#define INPUT_PROP_PRESSUREPAD 0x07 /* pressure triggers clicks */
#define INPUT_PROP_MAX 0x1f
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
@ -520,7 +519,6 @@
#define KEY_NOTIFICATION_CENTER 0x1bc /* Show/hide the notification center */
#define KEY_PICKUP_PHONE 0x1bd /* Answer incoming call */
#define KEY_HANGUP_PHONE 0x1be /* Decline incoming call */
#define KEY_LINK_PHONE 0x1bf /* AL Phone Syncing */
#define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1
@ -602,11 +600,6 @@
#define BTN_DPAD_LEFT 0x222
#define BTN_DPAD_RIGHT 0x223
#define BTN_GRIPL 0x224
#define BTN_GRIPR 0x225
#define BTN_GRIPL2 0x226
#define BTN_GRIPR2 0x227
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
#define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */
@ -631,18 +624,6 @@
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
/*
* Keycodes for hotkeys toggling the electronic privacy screen found on some
* laptops on/off. Note when the embedded-controller turns on/off the eprivacy
* screen itself then the state should be reported through drm connecter props:
* https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties
* Except when implementing the drm connecter properties API is not possible
* because e.g. the firmware does not allow querying the presence and/or status
* of the eprivacy screen at boot.
*/
#define KEY_EPRIVACY_SCREEN_ON 0x252
#define KEY_EPRIVACY_SCREEN_OFF 0x253
#define KEY_KBDINPUTASSIST_PREV 0x260
#define KEY_KBDINPUTASSIST_NEXT 0x261
#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
@ -783,9 +764,6 @@
#define KEY_KBD_LCD_MENU4 0x2bb
#define KEY_KBD_LCD_MENU5 0x2bc
/* Performance Boost key (Alienware)/G-Mode key (Dell) */
#define KEY_PERFORMANCE 0x2bd
#define BTN_TRIGGER_HAPPY 0x2c0
#define BTN_TRIGGER_HAPPY1 0x2c0
#define BTN_TRIGGER_HAPPY2 0x2c1
@ -946,8 +924,7 @@
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
#define SW_MACHINE_COVER 0x10 /* set = cover closed */
#define SW_USB_INSERT 0x11 /* set = USB audio device connected */
#define SW_MAX 0x11
#define SW_MAX 0x10
#define SW_CNT (SW_MAX+1)
/*

View file

@ -6,16 +6,14 @@
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#ifndef _UAPI_INPUT_H
#define _UAPI_INPUT_H
#ifndef _INPUT_H
#define _INPUT_H
#ifndef __KERNEL__
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <linux/types.h>
#endif
#include "input-event-codes.h"
@ -275,7 +273,6 @@ struct input_mask {
#define BUS_CEC 0x1E
#define BUS_INTEL_ISHTP 0x1F
#define BUS_AMD_SFH 0x20
#define BUS_SDW 0x21
/*
* MT_TOOL types
@ -429,24 +426,6 @@ struct ff_rumble_effect {
__u16 weak_magnitude;
};
/**
* struct ff_haptic_effect
* @hid_usage: hid_usage according to Haptics page (WAVEFORM_CLICK, etc.)
* @vendor_id: the waveform vendor ID if hid_usage is in the vendor-defined range
* @vendor_waveform_page: the vendor waveform page if hid_usage is in the vendor-defined range
* @intensity: strength of the effect as percentage
* @repeat_count: number of times to retrigger effect
* @retrigger_period: time before effect is retriggered (in ms)
*/
struct ff_haptic_effect {
__u16 hid_usage;
__u16 vendor_id;
__u8 vendor_waveform_page;
__u16 intensity;
__u16 repeat_count;
__u16 retrigger_period;
};
/**
* struct ff_effect - defines force feedback effect
* @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
@ -483,7 +462,6 @@ struct ff_effect {
struct ff_periodic_effect periodic;
struct ff_condition_effect condition[2]; /* One for each axis */
struct ff_rumble_effect rumble;
struct ff_haptic_effect haptic;
} u;
};
@ -491,7 +469,6 @@ struct ff_effect {
* Force feedback effect types
*/
#define FF_HAPTIC 0x4f
#define FF_RUMBLE 0x50
#define FF_PERIODIC 0x51
#define FF_CONSTANT 0x52
@ -501,7 +478,7 @@ struct ff_effect {
#define FF_INERTIA 0x56
#define FF_RAMP 0x57
#define FF_EFFECT_MIN FF_HAPTIC
#define FF_EFFECT_MIN FF_RUMBLE
#define FF_EFFECT_MAX FF_RAMP
/*
@ -536,4 +513,4 @@ struct ff_effect {
#define FF_MAX 0x7f
#define FF_CNT (FF_MAX+1)
#endif /* _UAPI_INPUT_H */
#endif /* _INPUT_H */

View file

@ -42,19 +42,19 @@ startswith(const char *str, size_t len, const char *prefix, size_t plen)
static inline int
bit_is_set(const unsigned long *array, int bit)
{
return !!(array[bit / LONG_BITS] & (1ULL << (bit % LONG_BITS)));
return !!(array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS)));
}
static inline void
set_bit(unsigned long *array, int bit)
{
array[bit / LONG_BITS] |= (1ULL << (bit % LONG_BITS));
array[bit / LONG_BITS] |= (1LL << (bit % LONG_BITS));
}
static inline void
clear_bit(unsigned long *array, int bit)
{
array[bit / LONG_BITS] &= ~(1ULL << (bit % LONG_BITS));
array[bit / LONG_BITS] &= ~(1LL << (bit % LONG_BITS));
}
static inline void

View file

@ -805,34 +805,23 @@ push_mt_sync_events(struct libevdev *dev,
int rc;
for (int slot = 0; slot < dev->num_slots; slot++) {
bool have_slot_event = false;
if (!bit_is_set(changes[slot].axes, ABS_MT_SLOT))
/* stopped touches were already terminated in
* terminate_slots */
if (changes[slot].state == TOUCH_STOPPED ||
!bit_is_set(changes[slot].axes, ABS_MT_SLOT))
continue;
queue_push_event(dev, EV_ABS, ABS_MT_SLOT, slot);
last_reported_slot = slot;
for (int axis = ABS_MT_MIN; axis <= ABS_MT_MAX; axis++) {
if (axis == ABS_MT_SLOT ||
!libevdev_has_event_code(dev, EV_ABS, axis))
continue;
if (bit_is_set(changes[slot].axes, axis)) {
/* We already sent the tracking id -1 in
* terminate_slots so don't do that again. There
* may be other axes like ABS_MT_TOOL_TYPE that
* need to be synced despite no touch being active */
if (axis == ABS_MT_TRACKING_ID &&
*slot_value(dev, slot, axis) == -1)
continue;
if (!have_slot_event) {
queue_push_event(dev, EV_ABS, ABS_MT_SLOT, slot);
last_reported_slot = slot;
have_slot_event = true;
}
if (bit_is_set(changes[slot].axes, axis))
queue_push_event(dev, EV_ABS, axis,
*slot_value(dev, slot, axis));
}
}
}

View file

@ -1563,7 +1563,8 @@ int libevdev_get_event_value(const struct libevdev *dev, unsigned int type, unsi
*
* @return 0 on success, or -1 on failure.
* @retval -1
* - the device does not have the event type or code enabled, or
* - the device does not have the event type or
* - code enabled, or the code is outside the, or
* - the code is outside the allowed limits for the given type, or
* - the type cannot be set, or
* - the value is not permitted for the given code.

View file

@ -1,5 +1,5 @@
project('libevdev', 'c',
version: '1.13.6', # change autotools version too
version: '1.13.3', # change autotools version too
license: 'MIT/Expat',
default_options: [ 'c_std=gnu99', 'warning_level=2' ],
meson_version: '>= 0.56.0')

View file

@ -158,7 +158,7 @@ START_TEST(test_code_sw_name)
ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_RFKILL_ALL), "SW_RFKILL_ALL");
ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_LINEIN_INSERT), "SW_LINEIN_INSERT");
ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_PEN_INSERTED), "SW_PEN_INSERTED");
ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_MAX), "SW_USB_INSERT");
ck_assert_str_eq(libevdev_event_code_get_name(EV_SW, SW_MAX), "SW_MACHINE_COVER");
}
END_TEST

View file

@ -617,12 +617,12 @@ START_TEST(test_syn_delta_sw)
EV_SYN, SYN_DROPPED,
EV_SW, SW_HEADPHONE_INSERT,
EV_SW, SW_MICROPHONE_INSERT,
EV_SW, SW_MACHINE_COVER, /* Replace with SW_MAX once runners are on 6.16 */
EV_SW, SW_MAX,
-1);
uinput_device_event(uidev, EV_SW, SW_HEADPHONE_INSERT, 1);
uinput_device_event(uidev, EV_SW, SW_MICROPHONE_INSERT, 1);
uinput_device_event(uidev, EV_SW, SW_MACHINE_COVER, 1);
uinput_device_event(uidev, EV_SW, SW_MAX, 1);
uinput_device_event(uidev, EV_SYN, SYN_REPORT, 0);
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_FORCE_SYNC, &ev);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SYNC);
@ -635,7 +635,7 @@ START_TEST(test_syn_delta_sw)
assert_event(&ev, EV_SW, SW_MICROPHONE_INSERT, 1);
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_SYNC, &ev);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SYNC);
assert_event(&ev, EV_SW, SW_MACHINE_COVER, 1);
assert_event(&ev, EV_SW, SW_MAX, 1);
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_SYNC, &ev);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SYNC);
assert_event(&ev, EV_SYN, SYN_REPORT, 0);
@ -644,7 +644,7 @@ START_TEST(test_syn_delta_sw)
ck_assert_int_eq(libevdev_get_event_value(dev, EV_SW, SW_HEADPHONE_INSERT), 1);
ck_assert_int_eq(libevdev_get_event_value(dev, EV_SW, SW_MICROPHONE_INSERT), 1);
ck_assert_int_eq(libevdev_get_event_value(dev, EV_SW, SW_MACHINE_COVER), 1);
ck_assert_int_eq(libevdev_get_event_value(dev, EV_SW, SW_MAX), 1);
uinput_device_free(uidev);
libevdev_free(dev);
@ -1008,206 +1008,6 @@ START_TEST(test_syn_delta_tracking_ids_btntool)
}
END_TEST
START_TEST(test_syn_delta_mt_tool_type)
{
struct uinput_device* uidev;
struct libevdev *dev;
int rc;
struct input_event ev;
int i;
const int num_slots = 15;
int slot = -1;
unsigned long terminated[NLONGS(num_slots)];
struct input_absinfo abs[7] = {
{ .value = ABS_X, .maximum = 1000 },
{ .value = ABS_Y, .maximum = 1000 },
{ .value = ABS_MT_POSITION_X, .maximum = 1000 },
{ .value = ABS_MT_POSITION_Y, .maximum = 1000 },
{ .value = ABS_MT_TOOL_TYPE, .maximum = MT_TOOL_PALM },
{ .value = ABS_MT_SLOT, .maximum = num_slots },
{ .value = ABS_MT_TRACKING_ID, .minimum = -1, .maximum = 0xff },
};
test_create_abs_device(&uidev, &dev,
ARRAY_LENGTH(abs), abs,
EV_SYN, SYN_REPORT,
-1);
for (i = num_slots; i >= 0; i--) {
int tool_type = MT_TOOL_FINGER;
switch (i) {
case 0:
case 1:
case 2:
case 3:
tool_type = MT_TOOL_FINGER;
break;
case 4:
case 5:
case 6:
case 7:
tool_type = MT_TOOL_PALM;
break;
}
uinput_device_event_multiple(uidev,
EV_ABS, ABS_MT_SLOT, i,
EV_ABS, ABS_MT_TRACKING_ID, i,
EV_ABS, ABS_X, 100 + i,
EV_ABS, ABS_Y, 500 + i,
EV_ABS, ABS_MT_POSITION_X, 100 + i,
EV_ABS, ABS_MT_POSITION_Y, 500 + i,
EV_ABS, ABS_MT_TOOL_TYPE, tool_type,
EV_SYN, SYN_REPORT, 0,
-1, -1);
do {
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_NORMAL, &ev);
ck_assert_int_ne(rc, LIBEVDEV_READ_STATUS_SYNC);
} while (rc >= 0);
}
/* we have a bunch of touches now, and libevdev knows it. Change all
* touches */
for (i = num_slots; i >= 0; i--) {
uinput_device_event(uidev, EV_ABS, ABS_MT_SLOT, i);
switch (i) {
/* Slot 0 is a finger and stays a finger */
case 0:
/* Slot 4 is a palm and stays a palm */
case 4:
uinput_device_event_multiple(uidev,
EV_ABS, ABS_X, 200 + i,
EV_ABS, ABS_Y, 700 + i,
EV_ABS, ABS_MT_POSITION_X, 200 + i,
EV_ABS, ABS_MT_POSITION_Y, 700 + i,
-1, -1);
break;
/* Slot 1 is a finger and changes active touch to palm */
case 1:
uinput_device_event(uidev, EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_PALM);
break;
/* Slot 2 is a finger and terminates */
case 2:
/* Slot 6 is a palm and terminates */
case 6:
uinput_device_event(uidev, EV_ABS, ABS_MT_TRACKING_ID, -1);
break;
/* Slot 3 is a finger and restarts as finger */
case 3:
/* Slot 5 is a palm and restarts as finger */
case 5:
uinput_device_event_multiple(uidev,
EV_ABS, ABS_MT_TRACKING_ID, num_slots + i,
EV_ABS, ABS_X, 200 + i,
EV_ABS, ABS_Y, 700 + i,
EV_ABS, ABS_MT_POSITION_X, 200 + i,
EV_ABS, ABS_MT_POSITION_Y, 700 + i,
EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_FINGER,
-1, -1);
break;
/* Slot 7 is a palm and restarts and terminates again as finger */
case 7:
uinput_device_event(uidev, EV_ABS, ABS_MT_TRACKING_ID, -1);
uinput_device_event(uidev, EV_SYN, SYN_REPORT, 0);
uinput_device_event_multiple(uidev,
EV_ABS, ABS_MT_TRACKING_ID, num_slots + i,
EV_ABS, ABS_X, 200 + i,
EV_ABS, ABS_Y, 700 + i,
EV_ABS, ABS_MT_POSITION_X, 200 + i,
EV_ABS, ABS_MT_POSITION_Y, 700 + i,
EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_FINGER,
-1, -1);
uinput_device_event(uidev, EV_ABS, ABS_MT_TRACKING_ID, -1);
uinput_device_event(uidev, EV_SYN, SYN_REPORT, 0);
break;
}
uinput_device_event(uidev, EV_SYN, SYN_REPORT, 0);
}
/* Force sync */
rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_FORCE_SYNC, &ev);
ck_assert_int_eq(rc, LIBEVDEV_READ_STATUS_SYNC);
/* now check for the right tracking IDs */
memset(terminated, 0, sizeof(terminated));
slot = -1;
while ((rc = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_SYNC, &ev)) != -EAGAIN) {
if (libevdev_event_is_code(&ev, EV_SYN, SYN_REPORT))
continue;
if (libevdev_event_is_code(&ev, EV_ABS, ABS_MT_SLOT)) {
slot = ev.value;
continue;
}
if (libevdev_event_is_code(&ev, EV_ABS, ABS_X) ||
libevdev_event_is_code(&ev, EV_ABS, ABS_Y))
continue;
ck_assert_int_ne(slot, -1);
if (libevdev_event_is_code(&ev, EV_ABS, ABS_MT_TRACKING_ID)) {
switch (slot) {
case 0:
case 1:
case 4:
ck_abort_msg("No ABS_MT_TRACKING_ID expected for this slot");
break;
case 2:
case 6:
case 7:
ck_assert_int_eq(ev.value, -1);
break;
case 3:
case 5:
if (!bit_is_set(terminated, slot)) {
ck_assert_int_eq(ev.value, -1);
set_bit(terminated, slot);
} else {
ck_assert_int_eq(ev.value, num_slots + slot);
}
break;
}
continue;
}
if (libevdev_event_is_code(&ev, EV_ABS, ABS_MT_TOOL_TYPE)) {
switch (slot) {
case 0:
case 2:
case 3:
case 4:
case 6:
ck_abort_msg("No ABS_MT_TOOL_TYPE expected for this slot");
break;
case 1:
ck_assert_int_eq(ev.value, MT_TOOL_PALM);
break;
case 5:
case 7:
ck_assert_int_eq(ev.value, MT_TOOL_FINGER);
break;
}
continue;
}
switch(ev.code) {
case ABS_MT_POSITION_X:
ck_assert_int_eq(ev.value, 200 + slot);
break;
case ABS_MT_POSITION_Y:
ck_assert_int_eq(ev.value, 700 + slot);
break;
default:
ck_abort();
}
}
uinput_device_free(uidev);
libevdev_free(dev);
}
END_TEST
START_TEST(test_syn_delta_late_sync)
{
struct uinput_device* uidev;
@ -2260,7 +2060,6 @@ TEST_SUITE_ROOT_PRIVILEGES(libevdev_events)
add_test(s, test_syn_delta_late_sync);
add_test(s, test_syn_delta_tracking_ids);
add_test(s, test_syn_delta_tracking_ids_btntool);
add_test(s, test_syn_delta_mt_tool_type);
add_test(s, test_skipped_sync);
add_test(s, test_incomplete_sync);