Compare commits

...

38 commits
main ... 1.8.4

Author SHA1 Message Date
Peter Hutterer
48e54894b3 configure.ac: libinput 1.8.4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-30 11:34:03 +10:00
Peter Hutterer
9f1e8a032c fallback: fix lid switch event listener being initialized twice
Once the lid is closed, the keyboard event listener is set up to open the lid
for us on keyboard events. With the right sequence, we can trigger the
listener to be added to the list multiple times, triggering an assert in the
list test code (or an infinite loop in the 1.8 branch).

Conditions:
* SW_LID value 1 - sets up the keyboard listener
* keyboard event - sets lid_is_closed to false
* SW_LID value 0 - is ignored because we're already open
* SW_LID value 1 - sets up the keyboard listener again

https://bugs.freedesktop.org/show_bug.cgi?id=103298

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 41a70bbe92)
2017-10-30 11:32:31 +10:00
Benjamin Tissoires
368e6fa8d3 udev: drop the version field in device groups
The version field is a per device information. We have
no guarantees a touchscreen and a tablet device will share
the same version of the firmware (especially if both
firmwares are from different vendors).

Fixes the touch arbitration for the Dell Canvas 27

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 57c5a409d6)
2017-10-30 09:42:28 +10:00
Peter Hutterer
7cfb0c7e29 meson: require GTK 3.20
For GDK_SEAT_CAPABILITY_ALL_POINTING

https://bugs.freedesktop.org/show_bug.cgi?id=103462

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 8edae4feb6)
2017-10-30 09:42:28 +10:00
Peter Hutterer
eea8888153 touchpad: cap the edge palm detection zones at 8mm
The main purpose of the edge zone is to detect palms in the area where we
cannot assume a full finger size and thus cannot use any other palm detection
mechanism. 8mm should be large enough that a finger should be detected based
on other properties (size, pressure, ...).

https://bugs.freedesktop.org/show_bug.cgi?id=103330

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ed52002c8d)
2017-10-30 09:42:28 +10:00
Peter Hutterer
5521837aaf util: add an extra assert for list_insert()
If we're adding an element that's not null or not a freshly initialized list,
chances are we haven't removed it from a previous list.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
(cherry picked from commit 28ef7456d3)
2017-10-30 09:42:28 +10:00
Peter Hutterer
520789925c test: unref the litest device *after* removing it from the path interface
Our own reference may be the last one that's still alive if the context is
currently suspended (litest_suspend()). If we unref before removing it from
the path interface, we access already freed memory.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 40144321b234f8cee0059cf5bada8c0845065851)
2017-10-30 09:42:28 +10:00
Peter Hutterer
b87487f808 tools: restore default permissions for a source file
This was accidentally made 755 as part of e9fc59efc8

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit c7b2fcd2c947b795039326583f15d29cc42a5fc5)
2017-10-30 09:42:28 +10:00
Peter Hutterer
1d5c60ccf3 Fix meson options default values
The keyword is 'value', not 'default'. With meson 0.43 this now stops
building.

https://bugs.freedesktop.org/show_bug.cgi?id=103162

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 4bb5ce5b74)
2017-10-30 09:42:27 +10:00
Peter Hutterer
d6c757f8e9 evdev: fix a coverity warning
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 26c4e31bd0f99a2a2be2ed92af8431e720abb0b6)
2017-10-09 11:30:42 +10:00
Peter Hutterer
307f7c6344 lid: mark the write return value as unused
Coverity doesn't understand the (void)write() bit and complains about the
unused value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-09 11:29:47 +10:00
Peter Hutterer
9d96f50c4d test: silence a coverity warning
Value set but overwritten before use.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 1cf7c88ae6)
2017-10-09 11:14:27 +10:00
Peter Hutterer
04287cb3b7 configure.ac: libinput 1.8.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-04 12:56:10 +10:00
Peter Hutterer
87556848ff Fix make distcheck for missing input-event-codes.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-04 12:56:10 +10:00
Peter Hutterer
77231f1aea test: fix the 'all codes' keyboard device
The ...create() method returned the wrong device, so this one was never
actually used. Once we start using, we get test case failures related to the
device having BTN_foo events as well. For now, just disable those codes so we
have a keyboard with all keys and pass the tests. The rest needs better
fixing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 4c4d400bcb)
2017-10-04 10:49:44 +10:00
Peter Hutterer
622e891354 evdev: update key type check for new key defines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 0c6b5c045b)
2017-10-04 10:49:44 +10:00
Peter Hutterer
d8a838f965 include: sync linux kernel header files with 4.12
To get the new key defines

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 9da2d07409)
2017-10-04 10:49:44 +10:00
Peter Hutterer
318f7fffb3 touchpad: don't resume a disabled touchpad
A touchpad that was disabled by toggling the sendevents option would come back
normally after a lid resume, despite still being nominally disabled.

https://bugzilla.redhat.com/show_bug.cgi?id=1448962

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 53d53dd18e)
2017-10-04 10:48:58 +10:00
Peter Hutterer
a8c40cc29a evdev: accept accelerometers if they are tagged as other devices too
Devices tagged as accelerometers may also be other devices like tablet pads.
Only ignore pure accelerometer devices but disable the accelerometer axes for
devices that have multiple types.

https://bugs.freedesktop.org/show_bug.cgi?id=102100

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
(cherry picked from commit 7d97bb0087)
2017-10-04 10:48:55 +10:00
Peter Hutterer
ed7ef90534 test: fix pad ring test for small pad ranges
The current tests worked because all rings had the same range, so our error
margin covered for that. With the upcoming MobileStudio Pro 16 pad device, the
range is half and our error margins don't work anymore. Switch to a more
reliable approach that tests every integer value the wheel can send, even
though it relies on kernel filtering.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit e3e6406c4f)
2017-10-03 18:14:19 +10:00
Peter Hutterer
62a9db6ddf test: remove leftover sleep() for debugging in lid switch test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 34f28a329b)
2017-10-03 18:06:17 +10:00
Peter Hutterer
859e09cb79 tools: remove a leftover debug printf statement
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit e242ad219a)
2017-09-19 15:11:54 +10:00
Peter Hutterer
0df61c76fe configure.ac: libinput 1.8.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-07 16:54:32 +10:00
Peter Hutterer
05c287c16c test: add the gpio-keys device to the Makefile
Fixes distcheck

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-07 16:54:32 +10:00
Peter Hutterer
3d83026c37 gestures: don't try to pinch for nfingers > slots
We don't know the position of the third finger on 2-slot touchpads, differing
between swipe and pinch is reliable. Simply disable 3-finger pinch and always
use swipe; 3fg pinch is uncommon anyway and it's better to have one of the
gestures working reliably than both unreliably.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 6d435cda06)
2017-09-06 19:40:24 +10:00
Peter Hutterer
a57d0d458f lid: disable all types but EV_SYN and EV_SW
The lid dispatch interface is a one-trick pony and can only handle SW_LID. It
ignores other switches but crashes on any event type other than EV_SW and
EV_SYN. Disable those types so we just ignore the event instead of asserting.

https://bugs.freedesktop.org/show_bug.cgi?id=101853

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
(cherry picked from commit 6bb05c594a)
2017-09-06 19:39:34 +10:00
Peter Hutterer
582ce30d27 timer: always restart the timer loop when we called one of them
If a timer_func causes the removal or addition of a different timer, our tmp
pointer from the list_for_each_safe may not be valid anymore.

This was triggered by having the debounce code trigger a middle button state
change, which caused that timer to be cancelled.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 6d0edf9d07)
2017-09-06 19:38:49 +10:00
Peter Hutterer
cfb0a39aba timer: if a timer is inactive, do not call the timer func
Race conditions may happen where code that cancels a timer is called just
as that timer triggers. If we cancel a timer, we assume that we've put the
code into a state where the timer firing will trigger a bug.

This could be observed with the middle button code if the release event was
held back just long enough. The button release code cancelled the timer, set
the state back to idle and then complained when the timeout handling sent a
'timeout' event while being in idle.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 696fdff247)
2017-09-06 19:38:43 +10:00
Peter Hutterer
1e89ceb93c evdev: recover from a lost button count
If the kernel sends us a button press for a button that is thought to be down
we have lost track of the state of the button. Ignore the button press event,
in the hope that the next release makes things right again.

A release event may be masked if another process grabs the device for some
period of time, e.g. libinput debug-events --grab.

https://bugs.freedesktop.org/show_bug.cgi?id=101796

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 399c50dbeb)
2017-09-06 19:38:41 +10:00
Philip Withnall
2d8b79877f build: Add -Iinclude to unit tests
It seems the unit tests rely on another part of <linux/input.h> which I
missed in the previous commit (5cf4b35b).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-21 12:00:36 +10:00
Philip Withnall
1cfae5a4a5 build: Add -Iinclude to libinput and its tools
Various files use #include <linux/input.h> and, if the system input.h is
too old, will fail to compile. Use the internal copy by adding -Iinclude
to the build command lines. This was the case in the old autotools build
system.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-21 12:00:34 +10:00
Jussi Kukkonen
3dffe36854 tools: Fix race in (autotools) install
exec/data distinction is done based on install dir so compat scripts
must be moved in exec hook.

This should fix this occasional failure:
| install: cannot change permissions of
| ‘/usr/bin/libinput-debug-events.compat’: No such file or directory

Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-15 09:46:52 +02:00
Peter Hutterer
cc9a4debd3 configure.ac: libinput 1.8.1 2017-07-19 10:01:03 +10:00
Peter Hutterer
c75e052ad4 touchpad: set keyboard to non-active when the keyboard is removed
If the keyboard is removed while dwt thinks it is in active state, that state
is never reset and subsequent touches are ignored.

https://bugs.freedesktop.org/show_bug.cgi?id=101743

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 9e5d1df4bb)
2017-07-13 15:08:34 +10:00
Peter Hutterer
429fc47bb1 Add support for CircleCI
This isn't currently hooked up to the fdo repo but it's hooked up to my
github mirror. I had SemaphoreCI hooked up to that before but it only
supports ubuntu 14.04 and the recent meson switch made it a bit hard to setup.

CircleCI supports running docker containers, so let's do that and run against
the most recent released Fedora and a recent Ubuntu. I'm not bothering with
rawhide, it's likely to increase the work for little gain when it's in a
semi-broken state.

Run the default build with a few permutations to test meson options. Run
scan-build too but that's just for the logs, eventually this may turn into a
hard failure.

Ubuntu 17.04's meson is too old, so we have to clone that from git. Install
arguments are taken from the meson.deb package.

Most of this effort was done by Benjamin Tissoires.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com>
(cherry picked from commit eb36957625)
2017-07-10 15:17:18 +10:00
Peter Hutterer
b6ce9c0f3b doc: expand on the meson build instructions
https://bugs.freedesktop.org/show_bug.cgi?id=101686

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 7b98f8ef47)
2017-07-10 15:16:43 +10:00
Peter Hutterer
40439b7347 meson: fix build with --libwacom=false
Triggered an error because we still used dep_libwacom unconditionally:
	Meson encountered an error in file meson.build, line 76, column 0:
	Unknown variable "dep_libwacom".

https://bugs.freedesktop.org/show_bug.cgi?id=101693

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit c6e0c96e74)
2017-07-10 15:16:39 +10:00
Peter Hutterer
d1a575c8e5 touchpad: increase palm edge zones to 8%
Most modern touchpads are around 100mm wide, so this provides a ca 8mm edge
zone on each side. The extra 3mm should provide for more reliable palm
detection, a few touches happen to be just on the edge of the 5mm mark.

https://bugs.freedesktop.org/show_bug.cgi?id=101433

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 381cce8ddd)
2017-07-10 15:16:37 +10:00
31 changed files with 1677 additions and 1098 deletions

151
circle.yml Normal file
View file

@ -0,0 +1,151 @@
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0:
libinput_jobs:
default_settings: &default_settings
working_directory: ~/libinput
# Define a couple of standardized build targets
# that we call from every build container
build_and_test_default: &build_and_test_default
name: Build
command: |
rm -rf build
meson build ${MESON_PARAMS}
mesonconf build
ninja -v -C build ${NINJA_ARGS}
environment:
MESON_PARAMS: --prefix=/opt/libinput
build_and_test: &build_and_test
run:
<<: *build_and_test_default
build_no_libwacom: &build_no_libwacom
run:
<<: *build_and_test_default
name: Build - No libwacom
environment:
MESON_PARAMS: -Dlibwacom=false
build_no_debug_gui: &build_no_debug_gui
run:
<<: *build_and_test_default
name: Build - No debug-gui
environment:
MESON_PARAMS: -Ddebug-gui=false
build_no_tests: &build_no_tests
run:
<<: *build_and_test_default
name: Build - No tests
environment:
MESON_PARAMS: -Dtests=false
build_no_docs: &build_no_docs
run:
<<: *build_and_test_default
name: Build - No docs
environment:
MESON_PARAMS: -Ddocumentation=false
ninja_scan_build: &ninja_scan_build
run:
<<: *build_and_test_default
name: Ninja scan-build
environment:
NINJA_ARGS: scan-build
install: &install
run:
name: Installing
command: ninja -v -C build install
export_logs: &export_logs
store_artifacts:
path: ~/libinput/build/meson-logs
# Ubuntu's meson is too old, these instructions are
# meson-specific
meson_from_git: &meson_from_git
run:
name: Install meson from git
environment:
MESON_VERSION: 0.41.0
command: |
git clone https://github.com/mesonbuild/meson
pushd meson
git checkout -f ${MESON_VERSION}
python3 ./setup.py install --prefix=/usr --install-layout=deb --install-lib=/usr/share/meson --install-scripts=/usr/share/meson
popd
rm -rf meson
fedora_install: &fedora_install
run:
name: Install prerequisites
command: |
dnf install -y git gcc gcc-c++ meson check-devel libudev-devel libevdev-devel doxygen graphviz valgrind binutils libwacom-devel cairo-devel gtk3-devel glib2-devel mtdev-devel
fedora_build_all: &fedora_build_all
<<: *default_settings
steps:
- *fedora_install
- checkout
- *build_and_test
- *install
- *export_logs
- *build_no_libwacom
- *build_no_debug_gui
- *build_no_tests
- *build_no_docs
ubuntu_install: &ubuntu_install
run:
name: Install prerequisites
command: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository universe
apt-get update
apt-get install -y git gcc g++ meson check libudev-dev libevdev-dev doxygen graphviz valgrind binutils libwacom-dev libcairo2-dev libgtk-3-dev libglib2.0-dev libmtdev-dev
ubuntu_build_all: &ubuntu_build_all
<<: *default_settings
steps:
- *ubuntu_install
- *meson_from_git # meson version not recent enough
- checkout
- *build_and_test
- *install
- *export_logs
- *build_no_libwacom
- *build_no_debug_gui
- *build_no_tests
- *build_no_docs
scan_build_run: &scan_build_run
<<: *default_settings
steps:
- *fedora_install
- run:
name: Install clang and find
command: dnf install -y clang-analyzer findutils
- checkout
- *ninja_scan_build
- *export_logs
- run:
name: Check scan-build results
command: test ! -d ~/libinput/build/meson-logs/scanbuild || test $(find ~/libinput/build/meson-logs/scanbuild -maxdepth 0 ! -empty -exec echo "not empty" \; | wc -l) -eq 0 || (echo "Check scan-build results" && false)
version: 2
jobs:
fedora_latest:
<<: *fedora_build_all
docker:
- image: fedora:latest
ubuntu_17_04:
<<: *ubuntu_build_all
docker:
- image: ubuntu:zesty
scan_build:
<<: *scan_build_run
docker:
- image: fedora:latest
workflows:
version: 2
compile:
jobs:
- fedora_latest
- scan_build
- ubuntu_17_04

View file

@ -2,7 +2,7 @@ AC_PREREQ([2.64])
m4_define([libinput_major_version], [1]) m4_define([libinput_major_version], [1])
m4_define([libinput_minor_version], [8]) m4_define([libinput_minor_version], [8])
m4_define([libinput_micro_version], [0]) m4_define([libinput_micro_version], [4])
m4_define([libinput_version], m4_define([libinput_version],
[libinput_major_version.libinput_minor_version.libinput_micro_version]) [libinput_major_version.libinput_minor_version.libinput_micro_version])

View file

@ -26,15 +26,29 @@ $> sudo ninja -C builddir/ install
$> sudo udevadm hwdb --update $> sudo udevadm hwdb --update
@endcode @endcode
The ```prefix``` option or other options can be changed later with the Additional options may also be specified. For example:
```mesonconf``` command.
@code @code
$> mesonconf builddir/ -Dprefix=/some/other/prefix $> meson --prefix=/usr -Ddocumentation=false -Dlibwacom=false builddir/
@endcode
The ```prefix``` or other options can be changed later with the
```mesonconf``` command. For example:
@code
$> mesonconf builddir/ -Dprefix=/some/other/prefix -Ddocumentation=true
$> ninja -C builddir $> ninja -C builddir
$> sudo ninja -C builddir/ install $> sudo ninja -C builddir/ install
@endcode @endcode
Running ``mesonconf builddir/`` with no other arguments lists all
configurable options meson provides.
To rebuild from scratch, simply remove the build directory and run meson
again:
@code
$> rm -r builddir/
$> meson --prefix=....
@endcode
@subsection building_autotools Building with automake @subsection building_autotools Building with automake
libinput currently also provides the autotools build system, but this will libinput currently also provides the autotools build system, but this will

View file

@ -0,0 +1,838 @@
/*
* Input event codes
*
* *** IMPORTANT ***
* This file is not only included from C-code but also from devicetree source
* files. As such this file MUST only contain comments and defines.
*
* Copyright (c) 1999-2002 Vojtech Pavlik
* Copyright (c) 2015 Hans de Goede <hdegoede@redhat.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#ifndef _UAPI_INPUT_EVENT_CODES_H
#define _UAPI_INPUT_EVENT_CODES_H
/*
* Device properties and quirks
*/
#define INPUT_PROP_POINTER 0x00 /* needs a pointer */
#define INPUT_PROP_DIRECT 0x01 /* direct input devices */
#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */
#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */
#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_MAX 0x1f
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
/*
* Event types
*/
#define EV_SYN 0x00
#define EV_KEY 0x01
#define EV_REL 0x02
#define EV_ABS 0x03
#define EV_MSC 0x04
#define EV_SW 0x05
#define EV_LED 0x11
#define EV_SND 0x12
#define EV_REP 0x14
#define EV_FF 0x15
#define EV_PWR 0x16
#define EV_FF_STATUS 0x17
#define EV_MAX 0x1f
#define EV_CNT (EV_MAX+1)
/*
* Synchronization events.
*/
#define SYN_REPORT 0
#define SYN_CONFIG 1
#define SYN_MT_REPORT 2
#define SYN_DROPPED 3
#define SYN_MAX 0xf
#define SYN_CNT (SYN_MAX+1)
/*
* Keys and buttons
*
* Most of the keys/buttons are modeled after USB HUT 1.12
* (see http://www.usb.org/developers/hidpage).
* Abbreviations in the comments:
* AC - Application Control
* AL - Application Launch Button
* SC - System Control
*/
#define KEY_RESERVED 0
#define KEY_ESC 1
#define KEY_1 2
#define KEY_2 3
#define KEY_3 4
#define KEY_4 5
#define KEY_5 6
#define KEY_6 7
#define KEY_7 8
#define KEY_8 9
#define KEY_9 10
#define KEY_0 11
#define KEY_MINUS 12
#define KEY_EQUAL 13
#define KEY_BACKSPACE 14
#define KEY_TAB 15
#define KEY_Q 16
#define KEY_W 17
#define KEY_E 18
#define KEY_R 19
#define KEY_T 20
#define KEY_Y 21
#define KEY_U 22
#define KEY_I 23
#define KEY_O 24
#define KEY_P 25
#define KEY_LEFTBRACE 26
#define KEY_RIGHTBRACE 27
#define KEY_ENTER 28
#define KEY_LEFTCTRL 29
#define KEY_A 30
#define KEY_S 31
#define KEY_D 32
#define KEY_F 33
#define KEY_G 34
#define KEY_H 35
#define KEY_J 36
#define KEY_K 37
#define KEY_L 38
#define KEY_SEMICOLON 39
#define KEY_APOSTROPHE 40
#define KEY_GRAVE 41
#define KEY_LEFTSHIFT 42
#define KEY_BACKSLASH 43
#define KEY_Z 44
#define KEY_X 45
#define KEY_C 46
#define KEY_V 47
#define KEY_B 48
#define KEY_N 49
#define KEY_M 50
#define KEY_COMMA 51
#define KEY_DOT 52
#define KEY_SLASH 53
#define KEY_RIGHTSHIFT 54
#define KEY_KPASTERISK 55
#define KEY_LEFTALT 56
#define KEY_SPACE 57
#define KEY_CAPSLOCK 58
#define KEY_F1 59
#define KEY_F2 60
#define KEY_F3 61
#define KEY_F4 62
#define KEY_F5 63
#define KEY_F6 64
#define KEY_F7 65
#define KEY_F8 66
#define KEY_F9 67
#define KEY_F10 68
#define KEY_NUMLOCK 69
#define KEY_SCROLLLOCK 70
#define KEY_KP7 71
#define KEY_KP8 72
#define KEY_KP9 73
#define KEY_KPMINUS 74
#define KEY_KP4 75
#define KEY_KP5 76
#define KEY_KP6 77
#define KEY_KPPLUS 78
#define KEY_KP1 79
#define KEY_KP2 80
#define KEY_KP3 81
#define KEY_KP0 82
#define KEY_KPDOT 83
#define KEY_ZENKAKUHANKAKU 85
#define KEY_102ND 86
#define KEY_F11 87
#define KEY_F12 88
#define KEY_RO 89
#define KEY_KATAKANA 90
#define KEY_HIRAGANA 91
#define KEY_HENKAN 92
#define KEY_KATAKANAHIRAGANA 93
#define KEY_MUHENKAN 94
#define KEY_KPJPCOMMA 95
#define KEY_KPENTER 96
#define KEY_RIGHTCTRL 97
#define KEY_KPSLASH 98
#define KEY_SYSRQ 99
#define KEY_RIGHTALT 100
#define KEY_LINEFEED 101
#define KEY_HOME 102
#define KEY_UP 103
#define KEY_PAGEUP 104
#define KEY_LEFT 105
#define KEY_RIGHT 106
#define KEY_END 107
#define KEY_DOWN 108
#define KEY_PAGEDOWN 109
#define KEY_INSERT 110
#define KEY_DELETE 111
#define KEY_MACRO 112
#define KEY_MUTE 113
#define KEY_VOLUMEDOWN 114
#define KEY_VOLUMEUP 115
#define KEY_POWER 116 /* SC System Power Down */
#define KEY_KPEQUAL 117
#define KEY_KPPLUSMINUS 118
#define KEY_PAUSE 119
#define KEY_SCALE 120 /* AL Compiz Scale (Expose) */
#define KEY_KPCOMMA 121
#define KEY_HANGEUL 122
#define KEY_HANGUEL KEY_HANGEUL
#define KEY_HANJA 123
#define KEY_YEN 124
#define KEY_LEFTMETA 125
#define KEY_RIGHTMETA 126
#define KEY_COMPOSE 127
#define KEY_STOP 128 /* AC Stop */
#define KEY_AGAIN 129
#define KEY_PROPS 130 /* AC Properties */
#define KEY_UNDO 131 /* AC Undo */
#define KEY_FRONT 132
#define KEY_COPY 133 /* AC Copy */
#define KEY_OPEN 134 /* AC Open */
#define KEY_PASTE 135 /* AC Paste */
#define KEY_FIND 136 /* AC Search */
#define KEY_CUT 137 /* AC Cut */
#define KEY_HELP 138 /* AL Integrated Help Center */
#define KEY_MENU 139 /* Menu (show menu) */
#define KEY_CALC 140 /* AL Calculator */
#define KEY_SETUP 141
#define KEY_SLEEP 142 /* SC System Sleep */
#define KEY_WAKEUP 143 /* System Wake Up */
#define KEY_FILE 144 /* AL Local Machine Browser */
#define KEY_SENDFILE 145
#define KEY_DELETEFILE 146
#define KEY_XFER 147
#define KEY_PROG1 148
#define KEY_PROG2 149
#define KEY_WWW 150 /* AL Internet Browser */
#define KEY_MSDOS 151
#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */
#define KEY_SCREENLOCK KEY_COFFEE
#define KEY_ROTATE_DISPLAY 153 /* Display orientation for e.g. tablets */
#define KEY_DIRECTION KEY_ROTATE_DISPLAY
#define KEY_CYCLEWINDOWS 154
#define KEY_MAIL 155
#define KEY_BOOKMARKS 156 /* AC Bookmarks */
#define KEY_COMPUTER 157
#define KEY_BACK 158 /* AC Back */
#define KEY_FORWARD 159 /* AC Forward */
#define KEY_CLOSECD 160
#define KEY_EJECTCD 161
#define KEY_EJECTCLOSECD 162
#define KEY_NEXTSONG 163
#define KEY_PLAYPAUSE 164
#define KEY_PREVIOUSSONG 165
#define KEY_STOPCD 166
#define KEY_RECORD 167
#define KEY_REWIND 168
#define KEY_PHONE 169 /* Media Select Telephone */
#define KEY_ISO 170
#define KEY_CONFIG 171 /* AL Consumer Control Configuration */
#define KEY_HOMEPAGE 172 /* AC Home */
#define KEY_REFRESH 173 /* AC Refresh */
#define KEY_EXIT 174 /* AC Exit */
#define KEY_MOVE 175
#define KEY_EDIT 176
#define KEY_SCROLLUP 177
#define KEY_SCROLLDOWN 178
#define KEY_KPLEFTPAREN 179
#define KEY_KPRIGHTPAREN 180
#define KEY_NEW 181 /* AC New */
#define KEY_REDO 182 /* AC Redo/Repeat */
#define KEY_F13 183
#define KEY_F14 184
#define KEY_F15 185
#define KEY_F16 186
#define KEY_F17 187
#define KEY_F18 188
#define KEY_F19 189
#define KEY_F20 190
#define KEY_F21 191
#define KEY_F22 192
#define KEY_F23 193
#define KEY_F24 194
#define KEY_PLAYCD 200
#define KEY_PAUSECD 201
#define KEY_PROG3 202
#define KEY_PROG4 203
#define KEY_DASHBOARD 204 /* AL Dashboard */
#define KEY_SUSPEND 205
#define KEY_CLOSE 206 /* AC Close */
#define KEY_PLAY 207
#define KEY_FASTFORWARD 208
#define KEY_BASSBOOST 209
#define KEY_PRINT 210 /* AC Print */
#define KEY_HP 211
#define KEY_CAMERA 212
#define KEY_SOUND 213
#define KEY_QUESTION 214
#define KEY_EMAIL 215
#define KEY_CHAT 216
#define KEY_SEARCH 217
#define KEY_CONNECT 218
#define KEY_FINANCE 219 /* AL Checkbook/Finance */
#define KEY_SPORT 220
#define KEY_SHOP 221
#define KEY_ALTERASE 222
#define KEY_CANCEL 223 /* AC Cancel */
#define KEY_BRIGHTNESSDOWN 224
#define KEY_BRIGHTNESSUP 225
#define KEY_MEDIA 226
#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video
outputs (Monitor/LCD/TV-out/etc) */
#define KEY_KBDILLUMTOGGLE 228
#define KEY_KBDILLUMDOWN 229
#define KEY_KBDILLUMUP 230
#define KEY_SEND 231 /* AC Send */
#define KEY_REPLY 232 /* AC Reply */
#define KEY_FORWARDMAIL 233 /* AC Forward Msg */
#define KEY_SAVE 234 /* AC Save */
#define KEY_DOCUMENTS 235
#define KEY_BATTERY 236
#define KEY_BLUETOOTH 237
#define KEY_WLAN 238
#define KEY_UWB 239
#define KEY_UNKNOWN 240
#define KEY_VIDEO_NEXT 241 /* drive next video source */
#define KEY_VIDEO_PREV 242 /* drive previous video source */
#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
#define KEY_BRIGHTNESS_AUTO 244 /* Set Auto Brightness: manual
brightness control is off,
rely on ambient */
#define KEY_BRIGHTNESS_ZERO KEY_BRIGHTNESS_AUTO
#define KEY_DISPLAY_OFF 245 /* display device to off state */
#define KEY_WWAN 246 /* Wireless WAN (LTE, UMTS, GSM, etc.) */
#define KEY_WIMAX KEY_WWAN
#define KEY_RFKILL 247 /* Key that controls all radios */
#define KEY_MICMUTE 248 /* Mute / unmute the microphone */
/* Code 255 is reserved for special needs of AT keyboard driver */
#define BTN_MISC 0x100
#define BTN_0 0x100
#define BTN_1 0x101
#define BTN_2 0x102
#define BTN_3 0x103
#define BTN_4 0x104
#define BTN_5 0x105
#define BTN_6 0x106
#define BTN_7 0x107
#define BTN_8 0x108
#define BTN_9 0x109
#define BTN_MOUSE 0x110
#define BTN_LEFT 0x110
#define BTN_RIGHT 0x111
#define BTN_MIDDLE 0x112
#define BTN_SIDE 0x113
#define BTN_EXTRA 0x114
#define BTN_FORWARD 0x115
#define BTN_BACK 0x116
#define BTN_TASK 0x117
#define BTN_JOYSTICK 0x120
#define BTN_TRIGGER 0x120
#define BTN_THUMB 0x121
#define BTN_THUMB2 0x122
#define BTN_TOP 0x123
#define BTN_TOP2 0x124
#define BTN_PINKIE 0x125
#define BTN_BASE 0x126
#define BTN_BASE2 0x127
#define BTN_BASE3 0x128
#define BTN_BASE4 0x129
#define BTN_BASE5 0x12a
#define BTN_BASE6 0x12b
#define BTN_DEAD 0x12f
#define BTN_GAMEPAD 0x130
#define BTN_SOUTH 0x130
#define BTN_A BTN_SOUTH
#define BTN_EAST 0x131
#define BTN_B BTN_EAST
#define BTN_C 0x132
#define BTN_NORTH 0x133
#define BTN_X BTN_NORTH
#define BTN_WEST 0x134
#define BTN_Y BTN_WEST
#define BTN_Z 0x135
#define BTN_TL 0x136
#define BTN_TR 0x137
#define BTN_TL2 0x138
#define BTN_TR2 0x139
#define BTN_SELECT 0x13a
#define BTN_START 0x13b
#define BTN_MODE 0x13c
#define BTN_THUMBL 0x13d
#define BTN_THUMBR 0x13e
#define BTN_DIGI 0x140
#define BTN_TOOL_PEN 0x140
#define BTN_TOOL_RUBBER 0x141
#define BTN_TOOL_BRUSH 0x142
#define BTN_TOOL_PENCIL 0x143
#define BTN_TOOL_AIRBRUSH 0x144
#define BTN_TOOL_FINGER 0x145
#define BTN_TOOL_MOUSE 0x146
#define BTN_TOOL_LENS 0x147
#define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */
#define BTN_TOUCH 0x14a
#define BTN_STYLUS 0x14b
#define BTN_STYLUS2 0x14c
#define BTN_TOOL_DOUBLETAP 0x14d
#define BTN_TOOL_TRIPLETAP 0x14e
#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
#define BTN_WHEEL 0x150
#define BTN_GEAR_DOWN 0x150
#define BTN_GEAR_UP 0x151
#define KEY_OK 0x160
#define KEY_SELECT 0x161
#define KEY_GOTO 0x162
#define KEY_CLEAR 0x163
#define KEY_POWER2 0x164
#define KEY_OPTION 0x165
#define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */
#define KEY_TIME 0x167
#define KEY_VENDOR 0x168
#define KEY_ARCHIVE 0x169
#define KEY_PROGRAM 0x16a /* Media Select Program Guide */
#define KEY_CHANNEL 0x16b
#define KEY_FAVORITES 0x16c
#define KEY_EPG 0x16d
#define KEY_PVR 0x16e /* Media Select Home */
#define KEY_MHP 0x16f
#define KEY_LANGUAGE 0x170
#define KEY_TITLE 0x171
#define KEY_SUBTITLE 0x172
#define KEY_ANGLE 0x173
#define KEY_ZOOM 0x174
#define KEY_MODE 0x175
#define KEY_KEYBOARD 0x176
#define KEY_SCREEN 0x177
#define KEY_PC 0x178 /* Media Select Computer */
#define KEY_TV 0x179 /* Media Select TV */
#define KEY_TV2 0x17a /* Media Select Cable */
#define KEY_VCR 0x17b /* Media Select VCR */
#define KEY_VCR2 0x17c /* VCR Plus */
#define KEY_SAT 0x17d /* Media Select Satellite */
#define KEY_SAT2 0x17e
#define KEY_CD 0x17f /* Media Select CD */
#define KEY_TAPE 0x180 /* Media Select Tape */
#define KEY_RADIO 0x181
#define KEY_TUNER 0x182 /* Media Select Tuner */
#define KEY_PLAYER 0x183
#define KEY_TEXT 0x184
#define KEY_DVD 0x185 /* Media Select DVD */
#define KEY_AUX 0x186
#define KEY_MP3 0x187
#define KEY_AUDIO 0x188 /* AL Audio Browser */
#define KEY_VIDEO 0x189 /* AL Movie Browser */
#define KEY_DIRECTORY 0x18a
#define KEY_LIST 0x18b
#define KEY_MEMO 0x18c /* Media Select Messages */
#define KEY_CALENDAR 0x18d
#define KEY_RED 0x18e
#define KEY_GREEN 0x18f
#define KEY_YELLOW 0x190
#define KEY_BLUE 0x191
#define KEY_CHANNELUP 0x192 /* Channel Increment */
#define KEY_CHANNELDOWN 0x193 /* Channel Decrement */
#define KEY_FIRST 0x194
#define KEY_LAST 0x195 /* Recall Last */
#define KEY_AB 0x196
#define KEY_NEXT 0x197
#define KEY_RESTART 0x198
#define KEY_SLOW 0x199
#define KEY_SHUFFLE 0x19a
#define KEY_BREAK 0x19b
#define KEY_PREVIOUS 0x19c
#define KEY_DIGITS 0x19d
#define KEY_TEEN 0x19e
#define KEY_TWEN 0x19f
#define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */
#define KEY_GAMES 0x1a1 /* Media Select Games */
#define KEY_ZOOMIN 0x1a2 /* AC Zoom In */
#define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */
#define KEY_ZOOMRESET 0x1a4 /* AC Zoom */
#define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */
#define KEY_EDITOR 0x1a6 /* AL Text Editor */
#define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */
#define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */
#define KEY_PRESENTATION 0x1a9 /* AL Presentation App */
#define KEY_DATABASE 0x1aa /* AL Database App */
#define KEY_NEWS 0x1ab /* AL Newsreader */
#define KEY_VOICEMAIL 0x1ac /* AL Voicemail */
#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */
#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */
#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
#define KEY_BRIGHTNESS_TOGGLE KEY_DISPLAYTOGGLE
#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
#define KEY_LOGOFF 0x1b1 /* AL Logoff */
#define KEY_DOLLAR 0x1b2
#define KEY_EURO 0x1b3
#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
#define KEY_FRAMEFORWARD 0x1b5
#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
#define KEY_IMAGES 0x1ba /* AL Image Browser */
#define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1
#define KEY_INS_LINE 0x1c2
#define KEY_DEL_LINE 0x1c3
#define KEY_FN 0x1d0
#define KEY_FN_ESC 0x1d1
#define KEY_FN_F1 0x1d2
#define KEY_FN_F2 0x1d3
#define KEY_FN_F3 0x1d4
#define KEY_FN_F4 0x1d5
#define KEY_FN_F5 0x1d6
#define KEY_FN_F6 0x1d7
#define KEY_FN_F7 0x1d8
#define KEY_FN_F8 0x1d9
#define KEY_FN_F9 0x1da
#define KEY_FN_F10 0x1db
#define KEY_FN_F11 0x1dc
#define KEY_FN_F12 0x1dd
#define KEY_FN_1 0x1de
#define KEY_FN_2 0x1df
#define KEY_FN_D 0x1e0
#define KEY_FN_E 0x1e1
#define KEY_FN_F 0x1e2
#define KEY_FN_S 0x1e3
#define KEY_FN_B 0x1e4
#define KEY_BRL_DOT1 0x1f1
#define KEY_BRL_DOT2 0x1f2
#define KEY_BRL_DOT3 0x1f3
#define KEY_BRL_DOT4 0x1f4
#define KEY_BRL_DOT5 0x1f5
#define KEY_BRL_DOT6 0x1f6
#define KEY_BRL_DOT7 0x1f7
#define KEY_BRL_DOT8 0x1f8
#define KEY_BRL_DOT9 0x1f9
#define KEY_BRL_DOT10 0x1fa
#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */
#define KEY_NUMERIC_1 0x201 /* and other keypads */
#define KEY_NUMERIC_2 0x202
#define KEY_NUMERIC_3 0x203
#define KEY_NUMERIC_4 0x204
#define KEY_NUMERIC_5 0x205
#define KEY_NUMERIC_6 0x206
#define KEY_NUMERIC_7 0x207
#define KEY_NUMERIC_8 0x208
#define KEY_NUMERIC_9 0x209
#define KEY_NUMERIC_STAR 0x20a
#define KEY_NUMERIC_POUND 0x20b
#define KEY_NUMERIC_A 0x20c /* Phone key A - HUT Telephony 0xb9 */
#define KEY_NUMERIC_B 0x20d
#define KEY_NUMERIC_C 0x20e
#define KEY_NUMERIC_D 0x20f
#define KEY_CAMERA_FOCUS 0x210
#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */
#define KEY_TOUCHPAD_ON 0x213
#define KEY_TOUCHPAD_OFF 0x214
#define KEY_CAMERA_ZOOMIN 0x215
#define KEY_CAMERA_ZOOMOUT 0x216
#define KEY_CAMERA_UP 0x217
#define KEY_CAMERA_DOWN 0x218
#define KEY_CAMERA_LEFT 0x219
#define KEY_CAMERA_RIGHT 0x21a
#define KEY_ATTENDANT_ON 0x21b
#define KEY_ATTENDANT_OFF 0x21c
#define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */
#define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */
#define BTN_DPAD_UP 0x220
#define BTN_DPAD_DOWN 0x221
#define BTN_DPAD_LEFT 0x222
#define BTN_DPAD_RIGHT 0x223
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
#define KEY_JOURNAL 0x242 /* AL Log/Journal/Timecard */
#define KEY_CONTROLPANEL 0x243 /* AL Control Panel */
#define KEY_APPSELECT 0x244 /* AL Select Task/Application */
#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
#define KEY_KBDINPUTASSIST_PREV 0x260
#define KEY_KBDINPUTASSIST_NEXT 0x261
#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
#define KEY_KBDINPUTASSIST_NEXTGROUP 0x263
#define KEY_KBDINPUTASSIST_ACCEPT 0x264
#define KEY_KBDINPUTASSIST_CANCEL 0x265
/* Diagonal movement keys */
#define KEY_RIGHT_UP 0x266
#define KEY_RIGHT_DOWN 0x267
#define KEY_LEFT_UP 0x268
#define KEY_LEFT_DOWN 0x269
#define KEY_ROOT_MENU 0x26a /* Show Device's Root Menu */
/* Show Top Menu of the Media (e.g. DVD) */
#define KEY_MEDIA_TOP_MENU 0x26b
#define KEY_NUMERIC_11 0x26c
#define KEY_NUMERIC_12 0x26d
/*
* Toggle Audio Description: refers to an audio service that helps blind and
* visually impaired consumers understand the action in a program. Note: in
* some countries this is referred to as "Video Description".
*/
#define KEY_AUDIO_DESC 0x26e
#define KEY_3D_MODE 0x26f
#define KEY_NEXT_FAVORITE 0x270
#define KEY_STOP_RECORD 0x271
#define KEY_PAUSE_RECORD 0x272
#define KEY_VOD 0x273 /* Video on Demand */
#define KEY_UNMUTE 0x274
#define KEY_FASTREVERSE 0x275
#define KEY_SLOWREVERSE 0x276
/*
* Control a data application associated with the currently viewed channel,
* e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.)
*/
#define KEY_DATA 0x277
#define KEY_ONSCREEN_KEYBOARD 0x278
#define BTN_TRIGGER_HAPPY 0x2c0
#define BTN_TRIGGER_HAPPY1 0x2c0
#define BTN_TRIGGER_HAPPY2 0x2c1
#define BTN_TRIGGER_HAPPY3 0x2c2
#define BTN_TRIGGER_HAPPY4 0x2c3
#define BTN_TRIGGER_HAPPY5 0x2c4
#define BTN_TRIGGER_HAPPY6 0x2c5
#define BTN_TRIGGER_HAPPY7 0x2c6
#define BTN_TRIGGER_HAPPY8 0x2c7
#define BTN_TRIGGER_HAPPY9 0x2c8
#define BTN_TRIGGER_HAPPY10 0x2c9
#define BTN_TRIGGER_HAPPY11 0x2ca
#define BTN_TRIGGER_HAPPY12 0x2cb
#define BTN_TRIGGER_HAPPY13 0x2cc
#define BTN_TRIGGER_HAPPY14 0x2cd
#define BTN_TRIGGER_HAPPY15 0x2ce
#define BTN_TRIGGER_HAPPY16 0x2cf
#define BTN_TRIGGER_HAPPY17 0x2d0
#define BTN_TRIGGER_HAPPY18 0x2d1
#define BTN_TRIGGER_HAPPY19 0x2d2
#define BTN_TRIGGER_HAPPY20 0x2d3
#define BTN_TRIGGER_HAPPY21 0x2d4
#define BTN_TRIGGER_HAPPY22 0x2d5
#define BTN_TRIGGER_HAPPY23 0x2d6
#define BTN_TRIGGER_HAPPY24 0x2d7
#define BTN_TRIGGER_HAPPY25 0x2d8
#define BTN_TRIGGER_HAPPY26 0x2d9
#define BTN_TRIGGER_HAPPY27 0x2da
#define BTN_TRIGGER_HAPPY28 0x2db
#define BTN_TRIGGER_HAPPY29 0x2dc
#define BTN_TRIGGER_HAPPY30 0x2dd
#define BTN_TRIGGER_HAPPY31 0x2de
#define BTN_TRIGGER_HAPPY32 0x2df
#define BTN_TRIGGER_HAPPY33 0x2e0
#define BTN_TRIGGER_HAPPY34 0x2e1
#define BTN_TRIGGER_HAPPY35 0x2e2
#define BTN_TRIGGER_HAPPY36 0x2e3
#define BTN_TRIGGER_HAPPY37 0x2e4
#define BTN_TRIGGER_HAPPY38 0x2e5
#define BTN_TRIGGER_HAPPY39 0x2e6
#define BTN_TRIGGER_HAPPY40 0x2e7
/* We avoid low common keys in module aliases so they don't get huge. */
#define KEY_MIN_INTERESTING KEY_MUTE
#define KEY_MAX 0x2ff
#define KEY_CNT (KEY_MAX+1)
/*
* Relative axes
*/
#define REL_X 0x00
#define REL_Y 0x01
#define REL_Z 0x02
#define REL_RX 0x03
#define REL_RY 0x04
#define REL_RZ 0x05
#define REL_HWHEEL 0x06
#define REL_DIAL 0x07
#define REL_WHEEL 0x08
#define REL_MISC 0x09
#define REL_MAX 0x0f
#define REL_CNT (REL_MAX+1)
/*
* Absolute axes
*/
#define ABS_X 0x00
#define ABS_Y 0x01
#define ABS_Z 0x02
#define ABS_RX 0x03
#define ABS_RY 0x04
#define ABS_RZ 0x05
#define ABS_THROTTLE 0x06
#define ABS_RUDDER 0x07
#define ABS_WHEEL 0x08
#define ABS_GAS 0x09
#define ABS_BRAKE 0x0a
#define ABS_HAT0X 0x10
#define ABS_HAT0Y 0x11
#define ABS_HAT1X 0x12
#define ABS_HAT1Y 0x13
#define ABS_HAT2X 0x14
#define ABS_HAT2Y 0x15
#define ABS_HAT3X 0x16
#define ABS_HAT3Y 0x17
#define ABS_PRESSURE 0x18
#define ABS_DISTANCE 0x19
#define ABS_TILT_X 0x1a
#define ABS_TILT_Y 0x1b
#define ABS_TOOL_WIDTH 0x1c
#define ABS_VOLUME 0x20
#define ABS_MISC 0x28
#define ABS_MT_SLOT 0x2f /* MT slot being modified */
#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
#define ABS_MT_POSITION_X 0x35 /* Center X touch position */
#define ABS_MT_POSITION_Y 0x36 /* Center Y touch position */
#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
#define ABS_MT_TOOL_X 0x3c /* Center X tool position */
#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */
#define ABS_MAX 0x3f
#define ABS_CNT (ABS_MAX+1)
/*
* Switch events
*/
#define SW_LID 0x00 /* set = lid shut */
#define SW_TABLET_MODE 0x01 /* set = tablet mode */
#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */
#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any"
set = radio enabled */
#define SW_RADIO SW_RFKILL_ALL /* deprecated */
#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */
#define SW_DOCK 0x05 /* set = plugged into dock */
#define SW_LINEOUT_INSERT 0x06 /* set = inserted */
#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */
#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */
#define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */
#define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */
#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */
#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */
#define SW_LINEIN_INSERT 0x0d /* set = inserted */
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
#define SW_MAX 0x0f
#define SW_CNT (SW_MAX+1)
/*
* Misc events
*/
#define MSC_SERIAL 0x00
#define MSC_PULSELED 0x01
#define MSC_GESTURE 0x02
#define MSC_RAW 0x03
#define MSC_SCAN 0x04
#define MSC_TIMESTAMP 0x05
#define MSC_MAX 0x07
#define MSC_CNT (MSC_MAX+1)
/*
* LEDs
*/
#define LED_NUML 0x00
#define LED_CAPSL 0x01
#define LED_SCROLLL 0x02
#define LED_COMPOSE 0x03
#define LED_KANA 0x04
#define LED_SLEEP 0x05
#define LED_SUSPEND 0x06
#define LED_MUTE 0x07
#define LED_MISC 0x08
#define LED_MAIL 0x09
#define LED_CHARGING 0x0a
#define LED_MAX 0x0f
#define LED_CNT (LED_MAX+1)
/*
* Autorepeat values
*/
#define REP_DELAY 0x00
#define REP_PERIOD 0x01
#define REP_MAX 0x01
#define REP_CNT (REP_MAX+1)
/*
* Sounds
*/
#define SND_CLICK 0x00
#define SND_BELL 0x01
#define SND_TONE 0x02
#define SND_MAX 0x07
#define SND_CNT (SND_MAX+1)
#endif

View file

@ -13,6 +13,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <linux/types.h> #include <linux/types.h>
#include "input-event-codes.h"
/* /*
* The event structure itself * The event structure itself
*/ */
@ -56,9 +58,14 @@ struct input_id {
* Note that input core does not clamp reported values to the * Note that input core does not clamp reported values to the
* [minimum, maximum] limits, such task is left to userspace. * [minimum, maximum] limits, such task is left to userspace.
* *
* Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in * The default resolution for main axes (ABS_X, ABS_Y, ABS_Z)
* units per millimeter (units/mm), resolution for rotational axes * is reported in units per millimeter (units/mm), resolution
* (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian. * for rotational axes (ABS_RX, ABS_RY, ABS_RZ) is reported
* in units per radian.
* When INPUT_PROP_ACCELEROMETER is set the resolution changes.
* The main axes (ABS_X, ABS_Y, ABS_Z) are then reported in
* in units per g (units/g) and in units per degree per second
* (units/deg/s) for rotational axes (ABS_RX, ABS_RY, ABS_RZ).
*/ */
struct input_absinfo { struct input_absinfo {
__s32 value; __s32 value;
@ -93,6 +100,12 @@ struct input_keymap_entry {
__u8 scancode[32]; __u8 scancode[32];
}; };
struct input_mask {
__u32 type;
__u32 codes_size;
__u64 codes_ptr;
};
#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */
#define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */
@ -143,795 +156,68 @@ struct input_keymap_entry {
#define EVIOCGABS(abs) _IOR('E', 0x40 + (abs), struct input_absinfo) /* get abs value/limits */ #define EVIOCGABS(abs) _IOR('E', 0x40 + (abs), struct input_absinfo) /* get abs value/limits */
#define EVIOCSABS(abs) _IOW('E', 0xc0 + (abs), struct input_absinfo) /* set abs value/limits */ #define EVIOCSABS(abs) _IOW('E', 0xc0 + (abs), struct input_absinfo) /* set abs value/limits */
#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */ #define EVIOCSFF _IOW('E', 0x80, struct ff_effect) /* send a force effect to a force feedback device */
#define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ #define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */
#define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */ #define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */
#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
#define EVIOCREVOKE _IOW('E', 0x91, int) /* Revoke device access */ #define EVIOCREVOKE _IOW('E', 0x91, int) /* Revoke device access */
#define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */ /**
* EVIOCGMASK - Retrieve current event mask
/*
* Device properties and quirks
*/
#define INPUT_PROP_POINTER 0x00 /* needs a pointer */
#define INPUT_PROP_DIRECT 0x01 /* direct input devices */
#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */
#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */
#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_MAX 0x1f
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
/*
* Event types
*/
#define EV_SYN 0x00
#define EV_KEY 0x01
#define EV_REL 0x02
#define EV_ABS 0x03
#define EV_MSC 0x04
#define EV_SW 0x05
#define EV_LED 0x11
#define EV_SND 0x12
#define EV_REP 0x14
#define EV_FF 0x15
#define EV_PWR 0x16
#define EV_FF_STATUS 0x17
#define EV_MAX 0x1f
#define EV_CNT (EV_MAX+1)
/*
* Synchronization events.
*/
#define SYN_REPORT 0
#define SYN_CONFIG 1
#define SYN_MT_REPORT 2
#define SYN_DROPPED 3
#define SYN_MAX 0xf
#define SYN_CNT (SYN_MAX+1)
/*
* Keys and buttons
* *
* Most of the keys/buttons are modeled after USB HUT 1.12 * This ioctl allows user to retrieve the current event mask for specific
* (see http://www.usb.org/developers/hidpage). * event type. The argument must be of type "struct input_mask" and
* Abbreviations in the comments: * specifies the event type to query, the address of the receive buffer and
* AC - Application Control * the size of the receive buffer.
* AL - Application Launch Button *
* SC - System Control * The event mask is a per-client mask that specifies which events are
* forwarded to the client. Each event code is represented by a single bit
* in the event mask. If the bit is set, the event is passed to the client
* normally. Otherwise, the event is filtered and will never be queued on
* the client's receive buffer.
*
* Event masks do not affect global state of the input device. They only
* affect the file descriptor they are applied to.
*
* The default event mask for a client has all bits set, i.e. all events
* are forwarded to the client. If the kernel is queried for an unknown
* event type or if the receive buffer is larger than the number of
* event codes known to the kernel, the kernel returns all zeroes for those
* codes.
*
* At maximum, codes_size bytes are copied.
*
* This ioctl may fail with ENODEV in case the file is revoked, EFAULT
* if the receive-buffer points to invalid memory, or EINVAL if the kernel
* does not implement the ioctl.
*/ */
#define EVIOCGMASK _IOR('E', 0x92, struct input_mask) /* Get event-masks */
#define KEY_RESERVED 0 /**
#define KEY_ESC 1 * EVIOCSMASK - Set event mask
#define KEY_1 2 *
#define KEY_2 3 * This ioctl is the counterpart to EVIOCGMASK. Instead of receiving the
#define KEY_3 4 * current event mask, this changes the client's event mask for a specific
#define KEY_4 5 * type. See EVIOCGMASK for a description of event-masks and the
#define KEY_5 6 * argument-type.
#define KEY_6 7 *
#define KEY_7 8 * This ioctl provides full forward compatibility. If the passed event type
#define KEY_8 9 * is unknown to the kernel, or if the number of event codes specified in
#define KEY_9 10 * the mask is bigger than what is known to the kernel, the ioctl is still
#define KEY_0 11 * accepted and applied. However, any unknown codes are left untouched and
#define KEY_MINUS 12 * stay cleared. That means, the kernel always filters unknown codes
#define KEY_EQUAL 13 * regardless of what the client requests. If the new mask doesn't cover
#define KEY_BACKSPACE 14 * all known event-codes, all remaining codes are automatically cleared and
#define KEY_TAB 15 * thus filtered.
#define KEY_Q 16 *
#define KEY_W 17 * This ioctl may fail with ENODEV in case the file is revoked. EFAULT is
#define KEY_E 18 * returned if the receive-buffer points to invalid memory. EINVAL is returned
#define KEY_R 19 * if the kernel does not implement the ioctl.
#define KEY_T 20
#define KEY_Y 21
#define KEY_U 22
#define KEY_I 23
#define KEY_O 24
#define KEY_P 25
#define KEY_LEFTBRACE 26
#define KEY_RIGHTBRACE 27
#define KEY_ENTER 28
#define KEY_LEFTCTRL 29
#define KEY_A 30
#define KEY_S 31
#define KEY_D 32
#define KEY_F 33
#define KEY_G 34
#define KEY_H 35
#define KEY_J 36
#define KEY_K 37
#define KEY_L 38
#define KEY_SEMICOLON 39
#define KEY_APOSTROPHE 40
#define KEY_GRAVE 41
#define KEY_LEFTSHIFT 42
#define KEY_BACKSLASH 43
#define KEY_Z 44
#define KEY_X 45
#define KEY_C 46
#define KEY_V 47
#define KEY_B 48
#define KEY_N 49
#define KEY_M 50
#define KEY_COMMA 51
#define KEY_DOT 52
#define KEY_SLASH 53
#define KEY_RIGHTSHIFT 54
#define KEY_KPASTERISK 55
#define KEY_LEFTALT 56
#define KEY_SPACE 57
#define KEY_CAPSLOCK 58
#define KEY_F1 59
#define KEY_F2 60
#define KEY_F3 61
#define KEY_F4 62
#define KEY_F5 63
#define KEY_F6 64
#define KEY_F7 65
#define KEY_F8 66
#define KEY_F9 67
#define KEY_F10 68
#define KEY_NUMLOCK 69
#define KEY_SCROLLLOCK 70
#define KEY_KP7 71
#define KEY_KP8 72
#define KEY_KP9 73
#define KEY_KPMINUS 74
#define KEY_KP4 75
#define KEY_KP5 76
#define KEY_KP6 77
#define KEY_KPPLUS 78
#define KEY_KP1 79
#define KEY_KP2 80
#define KEY_KP3 81
#define KEY_KP0 82
#define KEY_KPDOT 83
#define KEY_ZENKAKUHANKAKU 85
#define KEY_102ND 86
#define KEY_F11 87
#define KEY_F12 88
#define KEY_RO 89
#define KEY_KATAKANA 90
#define KEY_HIRAGANA 91
#define KEY_HENKAN 92
#define KEY_KATAKANAHIRAGANA 93
#define KEY_MUHENKAN 94
#define KEY_KPJPCOMMA 95
#define KEY_KPENTER 96
#define KEY_RIGHTCTRL 97
#define KEY_KPSLASH 98
#define KEY_SYSRQ 99
#define KEY_RIGHTALT 100
#define KEY_LINEFEED 101
#define KEY_HOME 102
#define KEY_UP 103
#define KEY_PAGEUP 104
#define KEY_LEFT 105
#define KEY_RIGHT 106
#define KEY_END 107
#define KEY_DOWN 108
#define KEY_PAGEDOWN 109
#define KEY_INSERT 110
#define KEY_DELETE 111
#define KEY_MACRO 112
#define KEY_MUTE 113
#define KEY_VOLUMEDOWN 114
#define KEY_VOLUMEUP 115
#define KEY_POWER 116 /* SC System Power Down */
#define KEY_KPEQUAL 117
#define KEY_KPPLUSMINUS 118
#define KEY_PAUSE 119
#define KEY_SCALE 120 /* AL Compiz Scale (Expose) */
#define KEY_KPCOMMA 121
#define KEY_HANGEUL 122
#define KEY_HANGUEL KEY_HANGEUL
#define KEY_HANJA 123
#define KEY_YEN 124
#define KEY_LEFTMETA 125
#define KEY_RIGHTMETA 126
#define KEY_COMPOSE 127
#define KEY_STOP 128 /* AC Stop */
#define KEY_AGAIN 129
#define KEY_PROPS 130 /* AC Properties */
#define KEY_UNDO 131 /* AC Undo */
#define KEY_FRONT 132
#define KEY_COPY 133 /* AC Copy */
#define KEY_OPEN 134 /* AC Open */
#define KEY_PASTE 135 /* AC Paste */
#define KEY_FIND 136 /* AC Search */
#define KEY_CUT 137 /* AC Cut */
#define KEY_HELP 138 /* AL Integrated Help Center */
#define KEY_MENU 139 /* Menu (show menu) */
#define KEY_CALC 140 /* AL Calculator */
#define KEY_SETUP 141
#define KEY_SLEEP 142 /* SC System Sleep */
#define KEY_WAKEUP 143 /* System Wake Up */
#define KEY_FILE 144 /* AL Local Machine Browser */
#define KEY_SENDFILE 145
#define KEY_DELETEFILE 146
#define KEY_XFER 147
#define KEY_PROG1 148
#define KEY_PROG2 149
#define KEY_WWW 150 /* AL Internet Browser */
#define KEY_MSDOS 151
#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */
#define KEY_SCREENLOCK KEY_COFFEE
#define KEY_DIRECTION 153
#define KEY_CYCLEWINDOWS 154
#define KEY_MAIL 155
#define KEY_BOOKMARKS 156 /* AC Bookmarks */
#define KEY_COMPUTER 157
#define KEY_BACK 158 /* AC Back */
#define KEY_FORWARD 159 /* AC Forward */
#define KEY_CLOSECD 160
#define KEY_EJECTCD 161
#define KEY_EJECTCLOSECD 162
#define KEY_NEXTSONG 163
#define KEY_PLAYPAUSE 164
#define KEY_PREVIOUSSONG 165
#define KEY_STOPCD 166
#define KEY_RECORD 167
#define KEY_REWIND 168
#define KEY_PHONE 169 /* Media Select Telephone */
#define KEY_ISO 170
#define KEY_CONFIG 171 /* AL Consumer Control Configuration */
#define KEY_HOMEPAGE 172 /* AC Home */
#define KEY_REFRESH 173 /* AC Refresh */
#define KEY_EXIT 174 /* AC Exit */
#define KEY_MOVE 175
#define KEY_EDIT 176
#define KEY_SCROLLUP 177
#define KEY_SCROLLDOWN 178
#define KEY_KPLEFTPAREN 179
#define KEY_KPRIGHTPAREN 180
#define KEY_NEW 181 /* AC New */
#define KEY_REDO 182 /* AC Redo/Repeat */
#define KEY_F13 183
#define KEY_F14 184
#define KEY_F15 185
#define KEY_F16 186
#define KEY_F17 187
#define KEY_F18 188
#define KEY_F19 189
#define KEY_F20 190
#define KEY_F21 191
#define KEY_F22 192
#define KEY_F23 193
#define KEY_F24 194
#define KEY_PLAYCD 200
#define KEY_PAUSECD 201
#define KEY_PROG3 202
#define KEY_PROG4 203
#define KEY_DASHBOARD 204 /* AL Dashboard */
#define KEY_SUSPEND 205
#define KEY_CLOSE 206 /* AC Close */
#define KEY_PLAY 207
#define KEY_FASTFORWARD 208
#define KEY_BASSBOOST 209
#define KEY_PRINT 210 /* AC Print */
#define KEY_HP 211
#define KEY_CAMERA 212
#define KEY_SOUND 213
#define KEY_QUESTION 214
#define KEY_EMAIL 215
#define KEY_CHAT 216
#define KEY_SEARCH 217
#define KEY_CONNECT 218
#define KEY_FINANCE 219 /* AL Checkbook/Finance */
#define KEY_SPORT 220
#define KEY_SHOP 221
#define KEY_ALTERASE 222
#define KEY_CANCEL 223 /* AC Cancel */
#define KEY_BRIGHTNESSDOWN 224
#define KEY_BRIGHTNESSUP 225
#define KEY_MEDIA 226
#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video
outputs (Monitor/LCD/TV-out/etc) */
#define KEY_KBDILLUMTOGGLE 228
#define KEY_KBDILLUMDOWN 229
#define KEY_KBDILLUMUP 230
#define KEY_SEND 231 /* AC Send */
#define KEY_REPLY 232 /* AC Reply */
#define KEY_FORWARDMAIL 233 /* AC Forward Msg */
#define KEY_SAVE 234 /* AC Save */
#define KEY_DOCUMENTS 235
#define KEY_BATTERY 236
#define KEY_BLUETOOTH 237
#define KEY_WLAN 238
#define KEY_UWB 239
#define KEY_UNKNOWN 240
#define KEY_VIDEO_NEXT 241 /* drive next video source */
#define KEY_VIDEO_PREV 242 /* drive previous video source */
#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
#define KEY_BRIGHTNESS_AUTO 244 /* Set Auto Brightness: manual
brightness control is off,
rely on ambient */
#define KEY_BRIGHTNESS_ZERO KEY_BRIGHTNESS_AUTO
#define KEY_DISPLAY_OFF 245 /* display device to off state */
#define KEY_WWAN 246 /* Wireless WAN (LTE, UMTS, GSM, etc.) */
#define KEY_WIMAX KEY_WWAN
#define KEY_RFKILL 247 /* Key that controls all radios */
#define KEY_MICMUTE 248 /* Mute / unmute the microphone */
/* Code 255 is reserved for special needs of AT keyboard driver */
#define BTN_MISC 0x100
#define BTN_0 0x100
#define BTN_1 0x101
#define BTN_2 0x102
#define BTN_3 0x103
#define BTN_4 0x104
#define BTN_5 0x105
#define BTN_6 0x106
#define BTN_7 0x107
#define BTN_8 0x108
#define BTN_9 0x109
#define BTN_MOUSE 0x110
#define BTN_LEFT 0x110
#define BTN_RIGHT 0x111
#define BTN_MIDDLE 0x112
#define BTN_SIDE 0x113
#define BTN_EXTRA 0x114
#define BTN_FORWARD 0x115
#define BTN_BACK 0x116
#define BTN_TASK 0x117
#define BTN_JOYSTICK 0x120
#define BTN_TRIGGER 0x120
#define BTN_THUMB 0x121
#define BTN_THUMB2 0x122
#define BTN_TOP 0x123
#define BTN_TOP2 0x124
#define BTN_PINKIE 0x125
#define BTN_BASE 0x126
#define BTN_BASE2 0x127
#define BTN_BASE3 0x128
#define BTN_BASE4 0x129
#define BTN_BASE5 0x12a
#define BTN_BASE6 0x12b
#define BTN_DEAD 0x12f
#define BTN_GAMEPAD 0x130
#define BTN_SOUTH 0x130
#define BTN_A BTN_SOUTH
#define BTN_EAST 0x131
#define BTN_B BTN_EAST
#define BTN_C 0x132
#define BTN_NORTH 0x133
#define BTN_X BTN_NORTH
#define BTN_WEST 0x134
#define BTN_Y BTN_WEST
#define BTN_Z 0x135
#define BTN_TL 0x136
#define BTN_TR 0x137
#define BTN_TL2 0x138
#define BTN_TR2 0x139
#define BTN_SELECT 0x13a
#define BTN_START 0x13b
#define BTN_MODE 0x13c
#define BTN_THUMBL 0x13d
#define BTN_THUMBR 0x13e
#define BTN_DIGI 0x140
#define BTN_TOOL_PEN 0x140
#define BTN_TOOL_RUBBER 0x141
#define BTN_TOOL_BRUSH 0x142
#define BTN_TOOL_PENCIL 0x143
#define BTN_TOOL_AIRBRUSH 0x144
#define BTN_TOOL_FINGER 0x145
#define BTN_TOOL_MOUSE 0x146
#define BTN_TOOL_LENS 0x147
#define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */
#define BTN_TOUCH 0x14a
#define BTN_STYLUS 0x14b
#define BTN_STYLUS2 0x14c
#define BTN_TOOL_DOUBLETAP 0x14d
#define BTN_TOOL_TRIPLETAP 0x14e
#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
#define BTN_WHEEL 0x150
#define BTN_GEAR_DOWN 0x150
#define BTN_GEAR_UP 0x151
#define KEY_OK 0x160
#define KEY_SELECT 0x161
#define KEY_GOTO 0x162
#define KEY_CLEAR 0x163
#define KEY_POWER2 0x164
#define KEY_OPTION 0x165
#define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */
#define KEY_TIME 0x167
#define KEY_VENDOR 0x168
#define KEY_ARCHIVE 0x169
#define KEY_PROGRAM 0x16a /* Media Select Program Guide */
#define KEY_CHANNEL 0x16b
#define KEY_FAVORITES 0x16c
#define KEY_EPG 0x16d
#define KEY_PVR 0x16e /* Media Select Home */
#define KEY_MHP 0x16f
#define KEY_LANGUAGE 0x170
#define KEY_TITLE 0x171
#define KEY_SUBTITLE 0x172
#define KEY_ANGLE 0x173
#define KEY_ZOOM 0x174
#define KEY_MODE 0x175
#define KEY_KEYBOARD 0x176
#define KEY_SCREEN 0x177
#define KEY_PC 0x178 /* Media Select Computer */
#define KEY_TV 0x179 /* Media Select TV */
#define KEY_TV2 0x17a /* Media Select Cable */
#define KEY_VCR 0x17b /* Media Select VCR */
#define KEY_VCR2 0x17c /* VCR Plus */
#define KEY_SAT 0x17d /* Media Select Satellite */
#define KEY_SAT2 0x17e
#define KEY_CD 0x17f /* Media Select CD */
#define KEY_TAPE 0x180 /* Media Select Tape */
#define KEY_RADIO 0x181
#define KEY_TUNER 0x182 /* Media Select Tuner */
#define KEY_PLAYER 0x183
#define KEY_TEXT 0x184
#define KEY_DVD 0x185 /* Media Select DVD */
#define KEY_AUX 0x186
#define KEY_MP3 0x187
#define KEY_AUDIO 0x188 /* AL Audio Browser */
#define KEY_VIDEO 0x189 /* AL Movie Browser */
#define KEY_DIRECTORY 0x18a
#define KEY_LIST 0x18b
#define KEY_MEMO 0x18c /* Media Select Messages */
#define KEY_CALENDAR 0x18d
#define KEY_RED 0x18e
#define KEY_GREEN 0x18f
#define KEY_YELLOW 0x190
#define KEY_BLUE 0x191
#define KEY_CHANNELUP 0x192 /* Channel Increment */
#define KEY_CHANNELDOWN 0x193 /* Channel Decrement */
#define KEY_FIRST 0x194
#define KEY_LAST 0x195 /* Recall Last */
#define KEY_AB 0x196
#define KEY_NEXT 0x197
#define KEY_RESTART 0x198
#define KEY_SLOW 0x199
#define KEY_SHUFFLE 0x19a
#define KEY_BREAK 0x19b
#define KEY_PREVIOUS 0x19c
#define KEY_DIGITS 0x19d
#define KEY_TEEN 0x19e
#define KEY_TWEN 0x19f
#define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */
#define KEY_GAMES 0x1a1 /* Media Select Games */
#define KEY_ZOOMIN 0x1a2 /* AC Zoom In */
#define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */
#define KEY_ZOOMRESET 0x1a4 /* AC Zoom */
#define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */
#define KEY_EDITOR 0x1a6 /* AL Text Editor */
#define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */
#define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */
#define KEY_PRESENTATION 0x1a9 /* AL Presentation App */
#define KEY_DATABASE 0x1aa /* AL Database App */
#define KEY_NEWS 0x1ab /* AL Newsreader */
#define KEY_VOICEMAIL 0x1ac /* AL Voicemail */
#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */
#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */
#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
#define KEY_BRIGHTNESS_TOGGLE KEY_DISPLAYTOGGLE
#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
#define KEY_LOGOFF 0x1b1 /* AL Logoff */
#define KEY_DOLLAR 0x1b2
#define KEY_EURO 0x1b3
#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
#define KEY_FRAMEFORWARD 0x1b5
#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
#define KEY_IMAGES 0x1ba /* AL Image Browser */
#define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1
#define KEY_INS_LINE 0x1c2
#define KEY_DEL_LINE 0x1c3
#define KEY_FN 0x1d0
#define KEY_FN_ESC 0x1d1
#define KEY_FN_F1 0x1d2
#define KEY_FN_F2 0x1d3
#define KEY_FN_F3 0x1d4
#define KEY_FN_F4 0x1d5
#define KEY_FN_F5 0x1d6
#define KEY_FN_F6 0x1d7
#define KEY_FN_F7 0x1d8
#define KEY_FN_F8 0x1d9
#define KEY_FN_F9 0x1da
#define KEY_FN_F10 0x1db
#define KEY_FN_F11 0x1dc
#define KEY_FN_F12 0x1dd
#define KEY_FN_1 0x1de
#define KEY_FN_2 0x1df
#define KEY_FN_D 0x1e0
#define KEY_FN_E 0x1e1
#define KEY_FN_F 0x1e2
#define KEY_FN_S 0x1e3
#define KEY_FN_B 0x1e4
#define KEY_BRL_DOT1 0x1f1
#define KEY_BRL_DOT2 0x1f2
#define KEY_BRL_DOT3 0x1f3
#define KEY_BRL_DOT4 0x1f4
#define KEY_BRL_DOT5 0x1f5
#define KEY_BRL_DOT6 0x1f6
#define KEY_BRL_DOT7 0x1f7
#define KEY_BRL_DOT8 0x1f8
#define KEY_BRL_DOT9 0x1f9
#define KEY_BRL_DOT10 0x1fa
#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */
#define KEY_NUMERIC_1 0x201 /* and other keypads */
#define KEY_NUMERIC_2 0x202
#define KEY_NUMERIC_3 0x203
#define KEY_NUMERIC_4 0x204
#define KEY_NUMERIC_5 0x205
#define KEY_NUMERIC_6 0x206
#define KEY_NUMERIC_7 0x207
#define KEY_NUMERIC_8 0x208
#define KEY_NUMERIC_9 0x209
#define KEY_NUMERIC_STAR 0x20a
#define KEY_NUMERIC_POUND 0x20b
#define KEY_CAMERA_FOCUS 0x210
#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */
#define KEY_TOUCHPAD_ON 0x213
#define KEY_TOUCHPAD_OFF 0x214
#define KEY_CAMERA_ZOOMIN 0x215
#define KEY_CAMERA_ZOOMOUT 0x216
#define KEY_CAMERA_UP 0x217
#define KEY_CAMERA_DOWN 0x218
#define KEY_CAMERA_LEFT 0x219
#define KEY_CAMERA_RIGHT 0x21a
#define KEY_ATTENDANT_ON 0x21b
#define KEY_ATTENDANT_OFF 0x21c
#define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */
#define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */
#define BTN_DPAD_UP 0x220
#define BTN_DPAD_DOWN 0x221
#define BTN_DPAD_LEFT 0x222
#define BTN_DPAD_RIGHT 0x223
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
#define KEY_JOURNAL 0x242 /* AL Log/Journal/Timecard */
#define KEY_CONTROLPANEL 0x243 /* AL Control Panel */
#define KEY_APPSELECT 0x244 /* AL Select Task/Application */
#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
#define KEY_KBDINPUTASSIST_PREV 0x260
#define KEY_KBDINPUTASSIST_NEXT 0x261
#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
#define KEY_KBDINPUTASSIST_NEXTGROUP 0x263
#define KEY_KBDINPUTASSIST_ACCEPT 0x264
#define KEY_KBDINPUTASSIST_CANCEL 0x265
#define BTN_TRIGGER_HAPPY 0x2c0
#define BTN_TRIGGER_HAPPY1 0x2c0
#define BTN_TRIGGER_HAPPY2 0x2c1
#define BTN_TRIGGER_HAPPY3 0x2c2
#define BTN_TRIGGER_HAPPY4 0x2c3
#define BTN_TRIGGER_HAPPY5 0x2c4
#define BTN_TRIGGER_HAPPY6 0x2c5
#define BTN_TRIGGER_HAPPY7 0x2c6
#define BTN_TRIGGER_HAPPY8 0x2c7
#define BTN_TRIGGER_HAPPY9 0x2c8
#define BTN_TRIGGER_HAPPY10 0x2c9
#define BTN_TRIGGER_HAPPY11 0x2ca
#define BTN_TRIGGER_HAPPY12 0x2cb
#define BTN_TRIGGER_HAPPY13 0x2cc
#define BTN_TRIGGER_HAPPY14 0x2cd
#define BTN_TRIGGER_HAPPY15 0x2ce
#define BTN_TRIGGER_HAPPY16 0x2cf
#define BTN_TRIGGER_HAPPY17 0x2d0
#define BTN_TRIGGER_HAPPY18 0x2d1
#define BTN_TRIGGER_HAPPY19 0x2d2
#define BTN_TRIGGER_HAPPY20 0x2d3
#define BTN_TRIGGER_HAPPY21 0x2d4
#define BTN_TRIGGER_HAPPY22 0x2d5
#define BTN_TRIGGER_HAPPY23 0x2d6
#define BTN_TRIGGER_HAPPY24 0x2d7
#define BTN_TRIGGER_HAPPY25 0x2d8
#define BTN_TRIGGER_HAPPY26 0x2d9
#define BTN_TRIGGER_HAPPY27 0x2da
#define BTN_TRIGGER_HAPPY28 0x2db
#define BTN_TRIGGER_HAPPY29 0x2dc
#define BTN_TRIGGER_HAPPY30 0x2dd
#define BTN_TRIGGER_HAPPY31 0x2de
#define BTN_TRIGGER_HAPPY32 0x2df
#define BTN_TRIGGER_HAPPY33 0x2e0
#define BTN_TRIGGER_HAPPY34 0x2e1
#define BTN_TRIGGER_HAPPY35 0x2e2
#define BTN_TRIGGER_HAPPY36 0x2e3
#define BTN_TRIGGER_HAPPY37 0x2e4
#define BTN_TRIGGER_HAPPY38 0x2e5
#define BTN_TRIGGER_HAPPY39 0x2e6
#define BTN_TRIGGER_HAPPY40 0x2e7
/* We avoid low common keys in module aliases so they don't get huge. */
#define KEY_MIN_INTERESTING KEY_MUTE
#define KEY_MAX 0x2ff
#define KEY_CNT (KEY_MAX+1)
/*
* Relative axes
*/ */
#define EVIOCSMASK _IOW('E', 0x93, struct input_mask) /* Set event-masks */
#define REL_X 0x00 #define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */
#define REL_Y 0x01
#define REL_Z 0x02
#define REL_RX 0x03
#define REL_RY 0x04
#define REL_RZ 0x05
#define REL_HWHEEL 0x06
#define REL_DIAL 0x07
#define REL_WHEEL 0x08
#define REL_MISC 0x09
#define REL_MAX 0x0f
#define REL_CNT (REL_MAX+1)
/*
* Absolute axes
*/
#define ABS_X 0x00
#define ABS_Y 0x01
#define ABS_Z 0x02
#define ABS_RX 0x03
#define ABS_RY 0x04
#define ABS_RZ 0x05
#define ABS_THROTTLE 0x06
#define ABS_RUDDER 0x07
#define ABS_WHEEL 0x08
#define ABS_GAS 0x09
#define ABS_BRAKE 0x0a
#define ABS_HAT0X 0x10
#define ABS_HAT0Y 0x11
#define ABS_HAT1X 0x12
#define ABS_HAT1Y 0x13
#define ABS_HAT2X 0x14
#define ABS_HAT2Y 0x15
#define ABS_HAT3X 0x16
#define ABS_HAT3Y 0x17
#define ABS_PRESSURE 0x18
#define ABS_DISTANCE 0x19
#define ABS_TILT_X 0x1a
#define ABS_TILT_Y 0x1b
#define ABS_TOOL_WIDTH 0x1c
#define ABS_VOLUME 0x20
#define ABS_MISC 0x28
#define ABS_MT_SLOT 0x2f /* MT slot being modified */
#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
#define ABS_MT_POSITION_X 0x35 /* Center X touch position */
#define ABS_MT_POSITION_Y 0x36 /* Center Y touch position */
#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
#define ABS_MT_TOOL_X 0x3c /* Center X tool position */
#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */
#define ABS_MAX 0x3f
#define ABS_CNT (ABS_MAX+1)
/*
* Switch events
*/
#define SW_LID 0x00 /* set = lid shut */
#define SW_TABLET_MODE 0x01 /* set = tablet mode */
#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */
#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any"
set = radio enabled */
#define SW_RADIO SW_RFKILL_ALL /* deprecated */
#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */
#define SW_DOCK 0x05 /* set = plugged into dock */
#define SW_LINEOUT_INSERT 0x06 /* set = inserted */
#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */
#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */
#define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */
#define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */
#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */
#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */
#define SW_LINEIN_INSERT 0x0d /* set = inserted */
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_MAX 0x0f
#define SW_CNT (SW_MAX+1)
/*
* Misc events
*/
#define MSC_SERIAL 0x00
#define MSC_PULSELED 0x01
#define MSC_GESTURE 0x02
#define MSC_RAW 0x03
#define MSC_SCAN 0x04
#define MSC_TIMESTAMP 0x05
#define MSC_MAX 0x07
#define MSC_CNT (MSC_MAX+1)
/*
* LEDs
*/
#define LED_NUML 0x00
#define LED_CAPSL 0x01
#define LED_SCROLLL 0x02
#define LED_COMPOSE 0x03
#define LED_KANA 0x04
#define LED_SLEEP 0x05
#define LED_SUSPEND 0x06
#define LED_MUTE 0x07
#define LED_MISC 0x08
#define LED_MAIL 0x09
#define LED_CHARGING 0x0a
#define LED_MAX 0x0f
#define LED_CNT (LED_MAX+1)
/*
* Autorepeat values
*/
#define REP_DELAY 0x00
#define REP_PERIOD 0x01
#define REP_MAX 0x01
#define REP_CNT (REP_MAX+1)
/*
* Sounds
*/
#define SND_CLICK 0x00
#define SND_BELL 0x01
#define SND_TONE 0x02
#define SND_MAX 0x07
#define SND_CNT (SND_MAX+1)
/* /*
* IDs. * IDs.
@ -962,6 +248,9 @@ struct input_keymap_entry {
#define BUS_GSC 0x1A #define BUS_GSC 0x1A
#define BUS_ATARI 0x1B #define BUS_ATARI 0x1B
#define BUS_SPI 0x1C #define BUS_SPI 0x1C
#define BUS_RMI 0x1D
#define BUS_CEC 0x1E
#define BUS_INTEL_ISHTP 0x1F
/* /*
* MT_TOOL types * MT_TOOL types
@ -1190,6 +479,14 @@ struct ff_effect {
#define FF_GAIN 0x60 #define FF_GAIN 0x60
#define FF_AUTOCENTER 0x61 #define FF_AUTOCENTER 0x61
/*
* ff->playback(effect_id = FF_GAIN) is the first effect_id to
* cause a collision with another ff method, in this case ff->set_gain().
* Therefore the greatest safe value for effect_id is FF_GAIN - 1,
* and thus the total number of effects should never exceed FF_GAIN.
*/
#define FF_MAX_EFFECTS FF_GAIN
#define FF_MAX 0x7f #define FF_MAX 0x7f
#define FF_CNT (FF_MAX+1) #define FF_CNT (FF_MAX+1)

View file

@ -1,5 +1,5 @@
project('libinput', 'c', 'cpp', project('libinput', 'c', 'cpp',
version : '1.8.0', version : '1.8.4',
license : 'MIT/Expat', license : 'MIT/Expat',
default_options : [ 'c_std=gnu99', 'warning_level=2' ], default_options : [ 'c_std=gnu99', 'warning_level=2' ],
meson_version : '>= 0.40.0') meson_version : '>= 0.40.0')
@ -47,6 +47,10 @@ dep_libevdev = dependency('libevdev', version : '>= 0.4')
dep_lm = cc.find_library('m', required : false) dep_lm = cc.find_library('m', required : false)
dep_rt = cc.find_library('rt', required : false) dep_rt = cc.find_library('rt', required : false)
# Include directories
includes_include = include_directories('include')
includes_src = include_directories('src')
############ libwacom configuration ############ ############ libwacom configuration ############
have_libwacom = get_option('libwacom') have_libwacom = get_option('libwacom')
@ -62,6 +66,8 @@ if have_libwacom
name : 'libwacom_get_paired_device check', name : 'libwacom_get_paired_device check',
dependencies : dep_libwacom) dependencies : dep_libwacom)
config_h.set10('HAVE_LIBWACOM_GET_PAIRED_DEVICE', result) config_h.set10('HAVE_LIBWACOM_GET_PAIRED_DEVICE', result)
else
dep_libwacom = declare_dependency()
endif endif
############ udev bits ############ ############ udev bits ############
@ -76,13 +82,13 @@ udev_hwdb_dir = join_paths(udev_dir, 'hwdb.d')
executable('libinput-device-group', executable('libinput-device-group',
'udev/libinput-device-group.c', 'udev/libinput-device-group.c',
dependencies : [dep_udev, dep_libwacom], dependencies : [dep_udev, dep_libwacom],
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
install : true, install : true,
install_dir : udev_dir) install_dir : udev_dir)
executable('libinput-model-quirks', executable('libinput-model-quirks',
'udev/libinput-model-quirks.c', 'udev/libinput-model-quirks.c',
dependencies : dep_udev, dependencies : dep_udev,
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
install : true, install : true,
install_dir : udev_dir) install_dir : udev_dir)
@ -129,7 +135,8 @@ src_libinput_util = [
] ]
libinput_util = static_library('libinput-util', libinput_util = static_library('libinput-util',
src_libinput_util, src_libinput_util,
dependencies : dep_udev) dependencies : dep_udev,
include_directories : includes_include)
dep_libinput_util = declare_dependency(link_with : libinput_util) dep_libinput_util = declare_dependency(link_with : libinput_util)
############ libfilter.a ############ ############ libfilter.a ############
@ -200,7 +207,7 @@ mapfile = join_paths(meson.source_root(), 'src', 'libinput.sym')
version_flag = '-Wl,--version-script,@0@'.format(mapfile) version_flag = '-Wl,--version-script,@0@'.format(mapfile)
lib_libinput = shared_library('input', lib_libinput = shared_library('input',
src_libinput, src_libinput,
include_directories : include_directories('.'), include_directories : [include_directories('.'), includes_include],
dependencies : deps_libinput, dependencies : deps_libinput,
version : libinput_so_version, version : libinput_so_version,
link_args : version_flag, link_args : version_flag,
@ -352,7 +359,7 @@ tools_shared_sources = [ 'tools/shared.c',
deps_tools_shared = [ dep_libinput, dep_libevdev ] deps_tools_shared = [ dep_libinput, dep_libevdev ]
lib_tools_shared = static_library('tools_shared', lib_tools_shared = static_library('tools_shared',
tools_shared_sources, tools_shared_sources,
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
dependencies : deps_tools_shared) dependencies : deps_tools_shared)
dep_tools_shared = declare_dependency(link_with : lib_tools_shared, dep_tools_shared = declare_dependency(link_with : lib_tools_shared,
dependencies : deps_tools_shared) dependencies : deps_tools_shared)
@ -365,7 +372,7 @@ libinput_debug_events_sources = [ 'tools/libinput-debug-events.c' ]
executable('libinput-debug-events', executable('libinput-debug-events',
libinput_debug_events_sources, libinput_debug_events_sources,
dependencies : deps_tools, dependencies : deps_tools,
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
install_dir : libinput_tool_path, install_dir : libinput_tool_path,
install : true install : true
) )
@ -380,7 +387,7 @@ libinput_list_devices_sources = [ 'tools/libinput-list-devices.c' ]
executable('libinput-list-devices', executable('libinput-list-devices',
libinput_list_devices_sources, libinput_list_devices_sources,
dependencies : deps_tools, dependencies : deps_tools,
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
install_dir : libinput_tool_path, install_dir : libinput_tool_path,
install : true, install : true,
) )
@ -395,7 +402,7 @@ libinput_measure_sources = [ 'tools/libinput-measure.c' ]
executable('libinput-measure', executable('libinput-measure',
libinput_measure_sources, libinput_measure_sources,
dependencies : deps_tools, dependencies : deps_tools,
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
install_dir : libinput_tool_path, install_dir : libinput_tool_path,
install : true, install : true,
) )
@ -410,7 +417,7 @@ libinput_measure_touchpad_tap_sources = [ 'tools/libinput-measure-touchpad-tap.c
executable('libinput-measure-touchpad-tap', executable('libinput-measure-touchpad-tap',
libinput_measure_touchpad_tap_sources, libinput_measure_touchpad_tap_sources,
dependencies : deps_tools, dependencies : deps_tools,
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
install_dir : libinput_tool_path, install_dir : libinput_tool_path,
install : true, install : true,
) )
@ -422,7 +429,7 @@ configure_file(input : 'tools/libinput-measure-touchpad-tap.man',
) )
if get_option('debug-gui') if get_option('debug-gui')
dep_gtk = dependency('gtk+-3.0') dep_gtk = dependency('gtk+-3.0', version : '>= 3.20')
dep_cairo = dependency('cairo') dep_cairo = dependency('cairo')
dep_glib = dependency('glib-2.0') dep_glib = dependency('glib-2.0')
@ -435,7 +442,7 @@ if get_option('debug-gui')
executable('libinput-debug-gui', executable('libinput-debug-gui',
debug_gui_sources, debug_gui_sources,
dependencies : deps_debug_gui, dependencies : deps_debug_gui,
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
install_dir : libinput_tool_path, install_dir : libinput_tool_path,
install : true install : true
) )
@ -452,7 +459,7 @@ libinput_sources = [ 'tools/libinput-tool.c' ]
executable('libinput', executable('libinput',
libinput_sources, libinput_sources,
dependencies : deps_tools, dependencies : deps_tools,
include_directories : include_directories ('src'), include_directories : [includes_src, includes_include],
install : true install : true
) )
configure_file(input : 'tools/libinput.man', configure_file(input : 'tools/libinput.man',
@ -468,7 +475,7 @@ ptraccel_debug_sources = [ 'tools/ptraccel-debug.c' ]
executable('ptraccel-debug', executable('ptraccel-debug',
ptraccel_debug_sources, ptraccel_debug_sources,
dependencies : [ dep_libfilter, dep_libinput ], dependencies : [ dep_libfilter, dep_libinput ],
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
install : false install : false
) )
@ -505,6 +512,7 @@ if get_option('tests')
'test/litest-device-cyborg-rat-5.c', 'test/litest-device-cyborg-rat-5.c',
'test/litest-device-elantech-touchpad.c', 'test/litest-device-elantech-touchpad.c',
'test/litest-device-generic-singletouch.c', 'test/litest-device-generic-singletouch.c',
'test/litest-device-gpio-keys.c',
'test/litest-device-huion-pentablet.c', 'test/litest-device-huion-pentablet.c',
'test/litest-device-keyboard.c', 'test/litest-device-keyboard.c',
'test/litest-device-keyboard-all-codes.c', 'test/litest-device-keyboard-all-codes.c',
@ -548,6 +556,7 @@ if get_option('tests')
'test/litest-device-wacom-intuos5-pen.c', 'test/litest-device-wacom-intuos5-pen.c',
'test/litest-device-wacom-isdv4-e6-pen.c', 'test/litest-device-wacom-isdv4-e6-pen.c',
'test/litest-device-wacom-isdv4-e6-finger.c', 'test/litest-device-wacom-isdv4-e6-finger.c',
'test/litest-device-wacom-mobilestudio-pro-pad.c',
'test/litest-device-waltop-tablet.c', 'test/litest-device-waltop-tablet.c',
'test/litest-device-wheel-only.c', 'test/litest-device-wheel-only.c',
'test/litest-device-xen-virtual-pointer.c', 'test/litest-device-xen-virtual-pointer.c',
@ -582,7 +591,7 @@ if get_option('tests')
join_paths(meson.build_root(), '80-libinput-device-groups.rules')) join_paths(meson.build_root(), '80-libinput-device-groups.rules'))
lib_litest = static_library('litest', lib_litest = static_library('litest',
lib_litest_sources, lib_litest_sources,
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
dependencies : deps_litest) dependencies : deps_litest)
dep_litest = declare_dependency(link_with : lib_litest, dep_litest = declare_dependency(link_with : lib_litest,
dependencies : deps_litest) dependencies : deps_litest)
@ -602,7 +611,7 @@ if get_option('tests')
deps_litest_selftest = [dep_litest] deps_litest_selftest = [dep_litest]
test_litest_selftest = executable('test-litest-selftest', test_litest_selftest = executable('test-litest-selftest',
test_litest_selftest_sources, test_litest_selftest_sources,
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
dependencies : deps_litest_selftest, dependencies : deps_litest_selftest,
c_args : defs_litest_selftest, c_args : defs_litest_selftest,
install : false) install : false)
@ -635,7 +644,7 @@ if get_option('tests')
def_LT_VERSION = '-DLIBINPUT_LT_VERSION="@0@:@1@:@2@"'.format(libinput_lt_c, libinput_lt_r, libinput_lt_a) def_LT_VERSION = '-DLIBINPUT_LT_VERSION="@0@:@1@:@2@"'.format(libinput_lt_c, libinput_lt_r, libinput_lt_a)
libinput_test_runner = executable('libinput-test-suite-runner', libinput_test_runner = executable('libinput-test-suite-runner',
libinput_test_runner_sources, libinput_test_runner_sources,
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
dependencies : dep_litest, dependencies : dep_litest,
c_args : [ def_LT_VERSION ], c_args : [ def_LT_VERSION ],
install : false) install : false)
@ -646,25 +655,25 @@ if get_option('tests')
# build-test only # build-test only
executable('test-build-pedantic', executable('test-build-pedantic',
'test/build-pedantic.c', 'test/build-pedantic.c',
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
c_args : ['-std=c99', '-pedantic', '-Werror'], c_args : ['-std=c99', '-pedantic', '-Werror'],
install : false) install : false)
# build-test only # build-test only
executable('test-build-std-gnuc90', executable('test-build-std-gnuc90',
'test/build-pedantic.c', 'test/build-pedantic.c',
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
c_args : ['-std=gnu90', '-Werror'], c_args : ['-std=gnu90', '-Werror'],
install : false) install : false)
# test for linking with the minimal linker flags # test for linking with the minimal linker flags
executable('test-build-linker', executable('test-build-linker',
'test/build-pedantic.c', 'test/build-pedantic.c',
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
dependencies : [ dep_libinput, dep_libinput_util ], dependencies : [ dep_libinput, dep_libinput_util ],
install : false) install : false)
# test including from C++ # test including from C++
executable('test-build-cxx', executable('test-build-cxx',
'test/build-cxx.cc', 'test/build-cxx.cc',
include_directories : include_directories('src'), include_directories : [includes_src, includes_include],
install : false) install : false)
valgrind_env = environment() valgrind_env = environment()

View file

@ -1,20 +1,20 @@
option('udev-dir', option('udev-dir',
type: 'string', type: 'string',
default: '', value: '',
description: 'udev base directory [default=$prefix/lib/udev]') description: 'udev base directory [default=$prefix/lib/udev]')
option('libwacom', option('libwacom',
type: 'boolean', type: 'boolean',
default: true, value: true,
description: 'Use libwacom for tablet identification (default=true)') description: 'Use libwacom for tablet identification (default=true)')
option('debug-gui', option('debug-gui',
type: 'boolean', type: 'boolean',
default: true, value: true,
description: 'Enable the "debug-gui" feature in the libinput tool [default=true]') description: 'Enable the "debug-gui" feature in the libinput tool [default=true]')
option('tests', option('tests',
type: 'boolean', type: 'boolean',
default: true, value: true,
description: 'Build the tests [default=true]') description: 'Build the tests [default=true]')
option('documentation', option('documentation',
type: 'boolean', type: 'boolean',
default: true, value: true,
description: 'Build the documentation [default=true]') description: 'Build the documentation [default=true]')

View file

@ -33,7 +33,8 @@ libinput_la_SOURCES = \
udev-seat.h \ udev-seat.h \
timer.c \ timer.c \
timer.h \ timer.h \
../include/linux/input.h ../include/linux/input.h \
../include/linux/input-event-codes.h
libinput_la_LIBADD = $(MTDEV_LIBS) \ libinput_la_LIBADD = $(MTDEV_LIBS) \
$(LIBUDEV_LIBS) \ $(LIBUDEV_LIBS) \

View file

@ -78,13 +78,14 @@ lid_switch_keyboard_event(uint64_t time,
return; return;
if (dispatch->reliability == RELIABILITY_WRITE_OPEN) { if (dispatch->reliability == RELIABILITY_WRITE_OPEN) {
__attribute__((unused)) int rc;
int fd = libevdev_get_fd(dispatch->device->evdev); int fd = libevdev_get_fd(dispatch->device->evdev);
struct input_event ev[2] = { struct input_event ev[2] = {
{{ 0, 0 }, EV_SW, SW_LID, 0 }, {{ 0, 0 }, EV_SW, SW_LID, 0 },
{{ 0, 0 }, EV_SYN, SYN_REPORT, 0 }, {{ 0, 0 }, EV_SYN, SYN_REPORT, 0 },
}; };
(void)write(fd, ev, sizeof(ev)); rc = write(fd, ev, sizeof(ev));
/* In case write() fails, we sync the lid state manually /* In case write() fails, we sync the lid state manually
* regardless. */ * regardless. */
} }
@ -104,6 +105,8 @@ lid_switch_toggle_keyboard_listener(struct lid_switch_dispatch *dispatch,
if (!dispatch->keyboard.keyboard) if (!dispatch->keyboard.keyboard)
return; return;
libinput_device_remove_event_listener(&dispatch->keyboard.listener);
if (is_closed) { if (is_closed) {
libinput_device_add_event_listener( libinput_device_add_event_listener(
&dispatch->keyboard.keyboard->base, &dispatch->keyboard.keyboard->base,
@ -111,10 +114,7 @@ lid_switch_toggle_keyboard_listener(struct lid_switch_dispatch *dispatch,
lid_switch_keyboard_event, lid_switch_keyboard_event,
dispatch); dispatch);
} else { } else {
libinput_device_remove_event_listener( libinput_device_init_event_listener(&dispatch->keyboard.listener);
&dispatch->keyboard.listener);
libinput_device_init_event_listener(
&dispatch->keyboard.listener);
} }
} }
@ -130,11 +130,12 @@ lid_switch_process_switch(struct lid_switch_dispatch *dispatch,
case SW_LID: case SW_LID:
is_closed = !!e->value; is_closed = !!e->value;
if (dispatch->lid_is_closed == is_closed)
return;
lid_switch_toggle_keyboard_listener(dispatch, lid_switch_toggle_keyboard_listener(dispatch,
is_closed); is_closed);
if (dispatch->lid_is_closed == is_closed)
return;
dispatch->lid_is_closed = is_closed; dispatch->lid_is_closed = is_closed;
lid_switch_notify_toggle(dispatch, device, time); lid_switch_notify_toggle(dispatch, device, time);
@ -298,6 +299,7 @@ struct evdev_dispatch *
evdev_lid_switch_dispatch_create(struct evdev_device *lid_device) evdev_lid_switch_dispatch_create(struct evdev_device *lid_device)
{ {
struct lid_switch_dispatch *dispatch = zalloc(sizeof *dispatch); struct lid_switch_dispatch *dispatch = zalloc(sizeof *dispatch);
int type;
if (dispatch == NULL) if (dispatch == NULL)
return NULL; return NULL;
@ -311,5 +313,12 @@ evdev_lid_switch_dispatch_create(struct evdev_device *lid_device)
dispatch->lid_is_closed = false; dispatch->lid_is_closed = false;
for (type = EV_KEY; type < EV_CNT; type++) {
if (type == EV_SW)
continue;
libevdev_disable_event_type(lid_device->evdev, type);
}
return &dispatch->base; return &dispatch->base;
} }

View file

@ -497,7 +497,7 @@ evdev_middlebutton_handle_event(struct evdev_device *device,
uint64_t time, uint64_t time,
enum evdev_middlebutton_event event) enum evdev_middlebutton_event event)
{ {
int rc; int rc = 0;
enum evdev_middlebutton_state current; enum evdev_middlebutton_state current;
current = device->middlebutton.state; current = device->middlebutton.state;
@ -545,6 +545,11 @@ evdev_middlebutton_handle_event(struct evdev_device *device,
time, time,
event); event);
break; break;
default:
evdev_log_bug_libinput(device,
"Invalid middle button state %d\n",
current);
break;
} }
evdev_log_debug(device, evdev_log_debug(device,

View file

@ -334,6 +334,10 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
if (tp->gesture.finger_count == 2) { if (tp->gesture.finger_count == 2) {
tp_gesture_set_scroll_buildup(tp); tp_gesture_set_scroll_buildup(tp);
return GESTURE_STATE_SCROLL; return GESTURE_STATE_SCROLL;
/* more fingers than slots, don't bother with pinch, always
* assume swipe */
} else if (tp->gesture.finger_count > tp->num_slots) {
return GESTURE_STATE_SWIPE;
} }
/* for 3+ finger gestures, check if one finger is > 20mm /* for 3+ finger gestures, check if one finger is > 20mm
@ -356,7 +360,8 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
/* If both touches are moving in the same direction assume /* If both touches are moving in the same direction assume
* scroll or swipe */ * scroll or swipe */
if (tp_gesture_same_directions(dir1, dir2)) { if (tp->gesture.finger_count > tp->num_slots ||
tp_gesture_same_directions(dir1, dir2)) {
if (tp->gesture.finger_count == 2) { if (tp->gesture.finger_count == 2) {
tp_gesture_set_scroll_buildup(tp); tp_gesture_set_scroll_buildup(tp);
return GESTURE_STATE_SCROLL; return GESTURE_STATE_SCROLL;

View file

@ -1426,6 +1426,31 @@ tp_resume(struct tp_dispatch *tp, struct evdev_device *device)
} }
} }
#define NO_EXCLUDED_DEVICE NULL
static void
tp_resume_conditional(struct tp_dispatch *tp,
struct evdev_device *device,
struct evdev_device *excluded_device)
{
if (tp->sendevents.current_mode == LIBINPUT_CONFIG_SEND_EVENTS_DISABLED)
return;
if (tp->sendevents.current_mode ==
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE) {
struct libinput_device *dev;
list_for_each(dev, &device->base.seat->devices_list, link) {
struct evdev_device *d = evdev_device(dev);
if (d != excluded_device &&
(d->tags & EVDEV_TAG_EXTERNAL_MOUSE)) {
return;
}
}
}
tp_resume(tp, device);
}
static void static void
tp_trackpoint_timeout(uint64_t now, void *data) tp_trackpoint_timeout(uint64_t now, void *data)
{ {
@ -1667,7 +1692,7 @@ tp_lid_switch_event(uint64_t time, struct libinput_event *event, void *data)
swev = libinput_event_get_switch_event(event); swev = libinput_event_get_switch_event(event);
switch (libinput_event_switch_get_switch_state(swev)) { switch (libinput_event_switch_get_switch_state(swev)) {
case LIBINPUT_SWITCH_STATE_OFF: case LIBINPUT_SWITCH_STATE_OFF:
tp_resume(tp, tp->device); tp_resume_conditional(tp, tp->device, NO_EXCLUDED_DEVICE);
evdev_log_debug(tp->device, "lid: resume touchpad\n"); evdev_log_debug(tp->device, "lid: resume touchpad\n");
break; break;
case LIBINPUT_SWITCH_STATE_ON: case LIBINPUT_SWITCH_STATE_ON:
@ -1722,7 +1747,6 @@ tp_interface_device_removed(struct evdev_device *device,
struct evdev_device *removed_device) struct evdev_device *removed_device)
{ {
struct tp_dispatch *tp = (struct tp_dispatch*)device->dispatch; struct tp_dispatch *tp = (struct tp_dispatch*)device->dispatch;
struct libinput_device *dev;
if (removed_device == tp->buttons.trackpoint) { if (removed_device == tp->buttons.trackpoint) {
/* Clear any pending releases for the trackpoint */ /* Clear any pending releases for the trackpoint */
@ -1740,6 +1764,7 @@ tp_interface_device_removed(struct evdev_device *device,
libinput_device_remove_event_listener( libinput_device_remove_event_listener(
&tp->dwt.keyboard_listener); &tp->dwt.keyboard_listener);
tp->dwt.keyboard = NULL; tp->dwt.keyboard = NULL;
tp->dwt.keyboard_active = false;
} }
if (removed_device == tp->lid_switch.lid_switch) { if (removed_device == tp->lid_switch.lid_switch) {
@ -1748,19 +1773,9 @@ tp_interface_device_removed(struct evdev_device *device,
tp->lid_switch.lid_switch = NULL; tp->lid_switch.lid_switch = NULL;
} }
if (tp->sendevents.current_mode != /* removed_device is still in the device list at this point, so we
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE) * need to exclude it from the tp_resume_conditional */
return; tp_resume_conditional(tp, device, removed_device);
list_for_each(dev, &device->base.seat->devices_list, link) {
struct evdev_device *d = evdev_device(dev);
if (d != removed_device &&
(d->tags & EVDEV_TAG_EXTERNAL_MOUSE)) {
return;
}
}
tp_resume(tp, device);
} }
static inline void static inline void
@ -2278,12 +2293,12 @@ tp_init_palmdetect_edge(struct tp_dispatch *tp,
if (width < 70.0) if (width < 70.0)
return; return;
/* palm edges are 5% of the width on each side */ /* palm edges are 8% of the width on each side */
mm.x = width * 0.05; mm.x = min(8, width * 0.08);
edges = evdev_device_mm_to_units(device, &mm); edges = evdev_device_mm_to_units(device, &mm);
tp->palm.left_edge = edges.x; tp->palm.left_edge = edges.x;
mm.x = width * 0.95; mm.x = width - min(8, width * 0.08);
edges = evdev_device_mm_to_units(device, &mm); edges = evdev_device_mm_to_units(device, &mm);
tp->palm.right_edge = edges.x; tp->palm.right_edge = edges.x;
} }

View file

@ -790,7 +790,7 @@ get_key_type(uint16_t code)
return EVDEV_KEY_TYPE_KEY; return EVDEV_KEY_TYPE_KEY;
if (code >= BTN_DPAD_UP && code <= BTN_DPAD_RIGHT) if (code >= BTN_DPAD_UP && code <= BTN_DPAD_RIGHT)
return EVDEV_KEY_TYPE_BUTTON; return EVDEV_KEY_TYPE_BUTTON;
if (code >= KEY_ALS_TOGGLE && code <= KEY_KBDINPUTASSIST_CANCEL) if (code >= KEY_ALS_TOGGLE && code <= KEY_ONSCREEN_KEYBOARD)
return EVDEV_KEY_TYPE_KEY; return EVDEV_KEY_TYPE_KEY;
if (code >= BTN_TRIGGER_HAPPY && code <= BTN_TRIGGER_HAPPY40) if (code >= BTN_TRIGGER_HAPPY && code <= BTN_TRIGGER_HAPPY40)
return EVDEV_KEY_TYPE_BUTTON; return EVDEV_KEY_TYPE_BUTTON;
@ -836,16 +836,16 @@ fallback_process_key(struct fallback_dispatch *dispatch,
type = get_key_type(e->code); type = get_key_type(e->code);
/* Ignore key release events from the kernel for keys that libinput /* Ignore key release events from the kernel for keys that libinput
* never got a pressed event for. */ * never got a pressed event for or key presses for keys that we
if (e->value == 0) { * think are still down */
switch (type) { switch (type) {
case EVDEV_KEY_TYPE_NONE: case EVDEV_KEY_TYPE_NONE:
break; break;
case EVDEV_KEY_TYPE_KEY: case EVDEV_KEY_TYPE_KEY:
case EVDEV_KEY_TYPE_BUTTON: case EVDEV_KEY_TYPE_BUTTON:
if (!hw_is_key_down(dispatch, e->code)) if ((e->value && hw_is_key_down(dispatch, e->code)) ||
return; (e->value == 0 && !hw_is_key_down(dispatch, e->code)))
} return;
} }
hw_set_key_down(dispatch, e->code, e->value); hw_set_key_down(dispatch, e->code, e->value);
@ -2565,6 +2565,20 @@ evdev_extract_abs_axes(struct evdev_device *device)
device->is_mt = 1; device->is_mt = 1;
} }
static void
evdev_disable_accelerometer_axes(struct evdev_device *device)
{
struct libevdev *evdev = device->evdev;
libevdev_disable_event_code(evdev, EV_ABS, ABS_X);
libevdev_disable_event_code(evdev, EV_ABS, ABS_Y);
libevdev_disable_event_code(evdev, EV_ABS, ABS_Z);
libevdev_disable_event_code(evdev, EV_ABS, REL_X);
libevdev_disable_event_code(evdev, EV_ABS, REL_Y);
libevdev_disable_event_code(evdev, EV_ABS, REL_Z);
}
static struct evdev_dispatch * static struct evdev_dispatch *
evdev_configure_device(struct evdev_device *device) evdev_configure_device(struct evdev_device *device)
{ {
@ -2596,10 +2610,14 @@ evdev_configure_device(struct evdev_device *device)
udev_tags & EVDEV_UDEV_TAG_TRACKBALL ? " Trackball" : "", udev_tags & EVDEV_UDEV_TAG_TRACKBALL ? " Trackball" : "",
udev_tags & EVDEV_UDEV_TAG_SWITCH ? " Switch" : ""); udev_tags & EVDEV_UDEV_TAG_SWITCH ? " Switch" : "");
if (udev_tags & EVDEV_UDEV_TAG_ACCELEROMETER) { /* Ignore pure accelerometers, but accept devices that are
* accelerometers with other axes */
if (udev_tags == (EVDEV_UDEV_TAG_INPUT|EVDEV_UDEV_TAG_ACCELEROMETER)) {
evdev_log_info(device, evdev_log_info(device,
"device is an accelerometer, ignoring\n"); "device is an accelerometer, ignoring\n");
return NULL; return NULL;
} else if (udev_tags & EVDEV_UDEV_TAG_ACCELEROMETER) {
evdev_disable_accelerometer_axes(device);
} }
/* libwacom *adds* TABLET, TOUCHPAD but leaves JOYSTICK in place, so /* libwacom *adds* TABLET, TOUCHPAD but leaves JOYSTICK in place, so

View file

@ -52,6 +52,8 @@ list_insert(struct list *list, struct list *elm)
{ {
assert((list->next != NULL && list->prev != NULL) || assert((list->next != NULL && list->prev != NULL) ||
!"list->next|prev is NULL, possibly missing list_init()"); !"list->next|prev is NULL, possibly missing list_init()");
assert(((elm->next == NULL && elm->prev == NULL) || list_empty(elm)) ||
!"elm->next|prev is not NULL, list node used twice?");
elm->prev = list; elm->prev = list;
elm->next = list->next; elm->next = list->next;

View file

@ -116,7 +116,7 @@ static void
libinput_timer_handler(void *data) libinput_timer_handler(void *data)
{ {
struct libinput *libinput = data; struct libinput *libinput = data;
struct libinput_timer *timer, *tmp; struct libinput_timer *timer;
uint64_t now; uint64_t now;
uint64_t discard; uint64_t discard;
int r; int r;
@ -132,12 +132,26 @@ libinput_timer_handler(void *data)
if (now == 0) if (now == 0)
return; return;
list_for_each_safe(timer, tmp, &libinput->timer.list, link) { restart:
list_for_each(timer, &libinput->timer.list, link) {
if (timer->expire == 0)
continue;
if (timer->expire <= now) { if (timer->expire <= now) {
/* Clear the timer before calling timer_func, /* Clear the timer before calling timer_func,
as timer_func may re-arm it */ as timer_func may re-arm it */
libinput_timer_cancel(timer); libinput_timer_cancel(timer);
timer->timer_func(now, timer->timer_func_data); timer->timer_func(now, timer->timer_func_data);
/*
* Restart the loop. We can't use
* list_for_each_safe() here because that only
* allows removing one (our) timer per timer_func.
* But the timer func may trigger another unrelated
* timer to be cancelled and removed, causing a
* segfault.
*/
goto restart;
} }
} }
} }

View file

@ -29,6 +29,7 @@ liblitest_la_SOURCES = \
litest-device-cyborg-rat-5.c \ litest-device-cyborg-rat-5.c \
litest-device-elantech-touchpad.c \ litest-device-elantech-touchpad.c \
litest-device-generic-singletouch.c \ litest-device-generic-singletouch.c \
litest-device-gpio-keys.c \
litest-device-huion-pentablet.c \ litest-device-huion-pentablet.c \
litest-device-keyboard.c \ litest-device-keyboard.c \
litest-device-keyboard-all-codes.c \ litest-device-keyboard-all-codes.c \
@ -72,6 +73,7 @@ liblitest_la_SOURCES = \
litest-device-wacom-intuos5-pen.c \ litest-device-wacom-intuos5-pen.c \
litest-device-wacom-isdv4-e6-pen.c \ litest-device-wacom-isdv4-e6-pen.c \
litest-device-wacom-isdv4-e6-finger.c \ litest-device-wacom-isdv4-e6-finger.c \
litest-device-wacom-mobilestudio-pro-pad.c \
litest-device-waltop-tablet.c \ litest-device-waltop-tablet.c \
litest-device-wheel-only.c \ litest-device-wheel-only.c \
litest-device-xen-virtual-pointer.c \ litest-device-xen-virtual-pointer.c \

View file

@ -0,0 +1,75 @@
/*
* Copyright © 2017 Red Hat, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include "litest.h"
#include "litest-int.h"
static void
litest_gpio_keys_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_GPIO_KEYS);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x19,
.vendor = 0x1,
.product = 0x1,
};
static int events[] = {
EV_SW, SW_LID,
EV_SW, SW_TABLET_MODE,
EV_KEY, KEY_POWER,
EV_KEY, KEY_VOLUMEUP,
EV_KEY, KEY_VOLUMEDOWN,
EV_KEY, KEY_POWER,
-1, -1,
};
static const char udev_rule[] =
"ACTION==\"remove\", GOTO=\"switch_end\"\n"
"KERNEL!=\"event*\", GOTO=\"switch_end\"\n"
"\n"
"ATTRS{name}==\"litest gpio-keys*\",\\\n"
" ENV{ID_INPUT_SWITCH}=\"1\",\\\n"
" ENV{LIBINPUT_ATTR_gpio_keys_RELIABILITY}=\"reliable\"\n"
"\n"
"LABEL=\"switch_end\"";
struct litest_test_device litest_gpio_keys_device = {
.type = LITEST_GPIO_KEYS,
.features = LITEST_SWITCH,
.shortname = "gpio keys",
.setup = litest_gpio_keys_setup,
.interface = NULL,
.name = "gpio-keys",
.id = &input_id,
.events = events,
.absinfo = NULL,
.udev_rule = udev_rule,
};

View file

@ -25,12 +25,13 @@
#include "litest.h" #include "litest.h"
#include "litest-int.h" #include "litest-int.h"
#include "libinput-util.h"
static void all_codes_create(struct litest_device *d); static void all_codes_create(struct litest_device *d);
static void litest_keyboard_all_codes_setup(void) static void litest_keyboard_all_codes_setup(void)
{ {
struct litest_device *d = litest_create_device(LITEST_KEYBOARD); struct litest_device *d = litest_create_device(LITEST_KEYBOARD_ALL_CODES);
litest_set_current_device(d); litest_set_current_device(d);
} }
@ -61,6 +62,11 @@ all_codes_create(struct litest_device *d)
int code, idx; int code, idx;
for (idx = 0, code = 0; code < KEY_MAX; code++) { for (idx = 0, code = 0; code < KEY_MAX; code++) {
const char *name = libevdev_event_code_get_name(EV_KEY, code);
if (name && strneq(name, "BTN_", 4))
continue;
events[idx++] = EV_KEY; events[idx++] = EV_KEY;
events[idx++] = code; events[idx++] = code;
} }

View file

@ -0,0 +1,126 @@
/*
* Copyright © 2017 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include "litest.h"
#include "litest-int.h"
static void litest_wacom_mobilestudio_pad_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_WACOM_MOBILESTUDIO_PRO_16_PAD);
litest_set_current_device(d);
}
static struct input_event down[] = {
{ .type = -1, .code = -1 },
};
static struct input_event move[] = {
{ .type = -1, .code = -1 },
};
static struct input_event ring_start[] = {
{ .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MISC, .value = 15 },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
} ;
static struct input_event ring_change[] = {
{ .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
} ;
static struct input_event ring_end[] = {
{ .type = EV_ABS, .code = ABS_WHEEL, .value = 0 },
{ .type = EV_ABS, .code = ABS_MISC, .value = 0 },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
} ;
static struct litest_device_interface interface = {
.touch_down_events = down,
.touch_move_events = move,
.pad_ring_start_events = ring_start,
.pad_ring_change_events = ring_change,
.pad_ring_end_events = ring_end,
};
static struct input_absinfo absinfo[] = {
{ ABS_X, -2048, 2048, 0, 0, 0 },
{ ABS_Y, -2048, 2048, 0, 0, 0 },
{ ABS_Z, -2048, 2048, 0, 0, 0 },
{ ABS_WHEEL, 0, 35, 0, 0, 0 },
{ ABS_MISC, 0, 0, 0, 0, 0 },
{ .value = -1 },
};
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x56a,
.product = 0x34e,
.version = 0x110,
};
static int events[] = {
EV_KEY, BTN_0,
EV_KEY, BTN_1,
EV_KEY, BTN_2,
EV_KEY, BTN_3,
EV_KEY, BTN_4,
EV_KEY, BTN_5,
EV_KEY, BTN_6,
EV_KEY, BTN_7,
EV_KEY, BTN_8,
EV_KEY, BTN_SOUTH,
EV_KEY, BTN_EAST,
EV_KEY, BTN_C,
EV_KEY, BTN_STYLUS,
INPUT_PROP_MAX, INPUT_PROP_ACCELEROMETER,
-1, -1,
};
static const char udev_rule[] =
"ACTION==\"remove\", GOTO=\"pad_end\"\n"
"KERNEL!=\"event*\", GOTO=\"pad_end\"\n"
"\n"
"ATTRS{name}==\"litest Wacom MobileStudio Pro 16 Pad*\",\\\n"
" ENV{ID_INPUT_TABLET}=\"1\",\\\n"
" ENV{ID_INPUT_TABLET_PAD}=\"1\"\\\n"
"\n"
"LABEL=\"pad_end\"";
struct litest_test_device litest_wacom_mobilestudio_13hdt_pad_device = {
.type = LITEST_WACOM_MOBILESTUDIO_PRO_16_PAD,
.features = LITEST_TABLET_PAD | LITEST_RING,
.shortname = "wacom-mobilestudio-pro16-pad",
.setup = litest_wacom_mobilestudio_pad_setup,
.interface = &interface,
.name = "Wacom MobileStudio Pro 16 Pad",
.id = &input_id,
.events = events,
.absinfo = absinfo,
.udev_rule = udev_rule,
};

View file

@ -173,8 +173,6 @@ litest_backtrace(void)
char procname[256]; char procname[256];
Dl_info dlinfo; Dl_info dlinfo;
/* filename and i are unused ifdef LITEST_SHUTUP */ /* filename and i are unused ifdef LITEST_SHUTUP */
const char *filename __attribute__((unused));
int i __attribute__((unused)) = 0;
pip.unwind_info = NULL; pip.unwind_info = NULL;
ret = unw_getcontext(&context); ret = unw_getcontext(&context);
@ -199,6 +197,8 @@ litest_backtrace(void)
char file[PATH_MAX]; char file[PATH_MAX];
int line; int line;
bool have_lineno = false; bool have_lineno = false;
const char *filename = "?";
int i = 0;
ret = unw_get_proc_info(&cursor, &pip); ret = unw_get_proc_info(&cursor, &pip);
if (ret) { if (ret) {
@ -226,8 +226,6 @@ litest_backtrace(void)
(pip.start_ip + off), (pip.start_ip + off),
file, file,
&line); &line);
} else {
filename = "?";
} }
if (have_lineno) { if (have_lineno) {
@ -416,6 +414,8 @@ extern struct litest_test_device litest_mouse_wheel_tilt_device;
extern struct litest_test_device litest_lid_switch_device; extern struct litest_test_device litest_lid_switch_device;
extern struct litest_test_device litest_lid_switch_surface3_device; extern struct litest_test_device litest_lid_switch_surface3_device;
extern struct litest_test_device litest_appletouch_device; extern struct litest_test_device litest_appletouch_device;
extern struct litest_test_device litest_gpio_keys_device;
extern struct litest_test_device litest_wacom_mobilestudio_13hdt_pad_device;
struct litest_test_device* devices[] = { struct litest_test_device* devices[] = {
&litest_synaptics_clickpad_device, &litest_synaptics_clickpad_device,
@ -481,6 +481,8 @@ struct litest_test_device* devices[] = {
&litest_lid_switch_device, &litest_lid_switch_device,
&litest_lid_switch_surface3_device, &litest_lid_switch_surface3_device,
&litest_appletouch_device, &litest_appletouch_device,
&litest_gpio_keys_device,
&litest_wacom_mobilestudio_13hdt_pad_device,
NULL, NULL,
}; };
@ -1474,8 +1476,9 @@ litest_delete_device(struct litest_device *d)
litest_assert_int_eq(d->skip_ev_syn, 0); litest_assert_int_eq(d->skip_ev_syn, 0);
libinput_device_unref(d->libinput_device);
libinput_path_remove_device(d->libinput_device); libinput_path_remove_device(d->libinput_device);
libinput_device_unref(d->libinput_device);
if (d->owns_context) if (d->owns_context)
libinput_unref(d->libinput); libinput_unref(d->libinput);
close(libevdev_get_fd(d->evdev)); close(libevdev_get_fd(d->evdev));

View file

@ -232,6 +232,8 @@ enum litest_device_type {
LITEST_LID_SWITCH, LITEST_LID_SWITCH,
LITEST_LID_SWITCH_SURFACE3, LITEST_LID_SWITCH_SURFACE3,
LITEST_APPLETOUCH, LITEST_APPLETOUCH,
LITEST_GPIO_KEYS,
LITEST_WACOM_MOBILESTUDIO_PRO_16_PAD,
}; };
enum litest_device_feature { enum litest_device_feature {

View file

@ -754,110 +754,6 @@ START_TEST(gestures_pinch_3fg)
} }
END_TEST END_TEST
START_TEST(gestures_pinch_3fg_btntool)
{
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
struct libinput_event *event;
struct libinput_event_gesture *gevent;
double dx, dy;
int cardinal = _i; /* ranged test */
double dir_x, dir_y;
int i;
double scale, oldscale;
double angle;
int cardinals[8][2] = {
{ 0, 30 },
{ 30, 30 },
{ 30, 0 },
{ 30, -30 },
{ 0, -30 },
{ -30, -30 },
{ -30, 0 },
{ -30, 30 },
};
if (libevdev_get_num_slots(dev->evdev) > 2 ||
!libinput_device_has_capability(dev->libinput_device,
LIBINPUT_DEVICE_CAP_GESTURE))
return;
dir_x = cardinals[cardinal][0];
dir_y = cardinals[cardinal][1];
litest_drain_events(li);
litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y);
litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y);
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
libinput_dispatch(li);
for (i = 0; i < 8; i++) {
litest_push_event_frame(dev);
if (dir_x > 0.0)
dir_x -= 2;
else if (dir_x < 0.0)
dir_x += 2;
if (dir_y > 0.0)
dir_y -= 2;
else if (dir_y < 0.0)
dir_y += 2;
litest_touch_move(dev,
0,
50 + dir_x,
50 + dir_y);
litest_touch_move(dev,
1,
50 - dir_x,
50 - dir_y);
litest_pop_event_frame(dev);
libinput_dispatch(li);
}
event = libinput_get_event(li);
gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
3);
dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent);
scale = libinput_event_gesture_get_scale(gevent);
ck_assert(dx == 0.0);
ck_assert(dy == 0.0);
ck_assert(scale == 1.0);
libinput_event_destroy(event);
while ((event = libinput_get_event(li)) != NULL) {
gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
3);
oldscale = scale;
scale = libinput_event_gesture_get_scale(gevent);
ck_assert(scale < oldscale);
angle = libinput_event_gesture_get_angle_delta(gevent);
ck_assert_double_le(fabs(angle), 1.0);
libinput_event_destroy(event);
libinput_dispatch(li);
}
litest_touch_up(dev, 0);
litest_touch_up(dev, 1);
libinput_dispatch(li);
event = libinput_get_event(li);
gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_END,
3);
ck_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event);
}
END_TEST
START_TEST(gestures_pinch_4fg) START_TEST(gestures_pinch_4fg)
{ {
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
@ -969,111 +865,6 @@ START_TEST(gestures_pinch_4fg)
} }
END_TEST END_TEST
START_TEST(gestures_pinch_4fg_btntool)
{
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
struct libinput_event *event;
struct libinput_event_gesture *gevent;
double dx, dy;
int cardinal = _i; /* ranged test */
double dir_x, dir_y;
int i;
double scale, oldscale;
double angle;
int cardinals[8][2] = {
{ 0, 30 },
{ 30, 30 },
{ 30, 0 },
{ 30, -30 },
{ 0, -30 },
{ -30, -30 },
{ -30, 0 },
{ -30, 30 },
};
if (libevdev_get_num_slots(dev->evdev) > 2 ||
!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP) ||
!libinput_device_has_capability(dev->libinput_device,
LIBINPUT_DEVICE_CAP_GESTURE))
return;
dir_x = cardinals[cardinal][0];
dir_y = cardinals[cardinal][1];
litest_drain_events(li);
litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y);
litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y);
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
libinput_dispatch(li);
for (i = 0; i < 8; i++) {
litest_push_event_frame(dev);
if (dir_x > 0.0)
dir_x -= 3;
else if (dir_x < 0.0)
dir_x += 3;
if (dir_y > 0.0)
dir_y -= 3;
else if (dir_y < 0.0)
dir_y += 3;
litest_touch_move(dev,
0,
50 + dir_x,
50 + dir_y);
litest_touch_move(dev,
1,
50 - dir_x,
50 - dir_y);
litest_pop_event_frame(dev);
libinput_dispatch(li);
}
event = libinput_get_event(li);
gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
4);
dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent);
scale = libinput_event_gesture_get_scale(gevent);
ck_assert(dx == 0.0);
ck_assert(dy == 0.0);
ck_assert(scale == 1.0);
libinput_event_destroy(event);
while ((event = libinput_get_event(li)) != NULL) {
gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
4);
oldscale = scale;
scale = libinput_event_gesture_get_scale(gevent);
ck_assert(scale < oldscale);
angle = libinput_event_gesture_get_angle_delta(gevent);
ck_assert_double_le(fabs(angle), 1.5);
libinput_event_destroy(event);
libinput_dispatch(li);
}
litest_touch_up(dev, 0);
litest_touch_up(dev, 1);
libinput_dispatch(li);
event = libinput_get_event(li);
gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_END,
4);
ck_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event);
}
END_TEST
START_TEST(gestures_spread) START_TEST(gestures_spread)
{ {
struct litest_device *dev = litest_current_device(); struct litest_device *dev = litest_current_device();
@ -1282,9 +1073,7 @@ litest_setup_tests_gestures(void)
litest_add_ranged("gestures:swipe", gestures_swipe_4fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); litest_add_ranged("gestures:swipe", gestures_swipe_4fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); litest_add_ranged("gestures:pinch", gestures_pinch, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); litest_add_ranged("gestures:pinch", gestures_pinch_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_4fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); litest_add_ranged("gestures:pinch", gestures_pinch_4fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_4fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_spread, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); litest_add_ranged("gestures:pinch", gestures_spread, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_vertical_positon, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &fingers); litest_add_ranged("gestures:pinch", gestures_pinch_vertical_positon, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &fingers);

View file

@ -342,6 +342,81 @@ START_TEST(lid_disable_touchpad_already_open)
} }
END_TEST END_TEST
START_TEST(switch_dont_resume_disabled_touchpad)
{
struct litest_device *sw = litest_current_device();
struct litest_device *touchpad;
struct libinput *li = sw->libinput;
touchpad = lid_init_paired_touchpad(li);
litest_disable_tap(touchpad->libinput_device);
libinput_device_config_send_events_set_mode(touchpad->libinput_device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
litest_drain_events(li);
/* switch is on - no events */
litest_lid_action(sw, LIBINPUT_SWITCH_STATE_ON);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
/* switch is off but but tp is still disabled */
litest_lid_action(sw, LIBINPUT_SWITCH_STATE_OFF);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
litest_delete_device(touchpad);
}
END_TEST
START_TEST(switch_dont_resume_disabled_touchpad_external_mouse)
{
struct litest_device *sw = litest_current_device();
struct litest_device *touchpad, *mouse;
struct libinput *li = sw->libinput;
touchpad = lid_init_paired_touchpad(li);
mouse = litest_add_device(li, LITEST_MOUSE);
litest_disable_tap(touchpad->libinput_device);
libinput_device_config_send_events_set_mode(touchpad->libinput_device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE);
litest_drain_events(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
/* switch is on - no events */
litest_lid_action(sw, LIBINPUT_SWITCH_STATE_ON);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
/* switch is off but but tp is still disabled */
litest_lid_action(sw, LIBINPUT_SWITCH_STATE_OFF);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
litest_delete_device(touchpad);
litest_delete_device(mouse);
}
END_TEST
START_TEST(lid_open_on_key) START_TEST(lid_open_on_key)
{ {
struct litest_device *sw = litest_current_device(); struct litest_device *sw = litest_current_device();
@ -351,26 +426,27 @@ START_TEST(lid_open_on_key)
keyboard = litest_add_device(li, LITEST_KEYBOARD); keyboard = litest_add_device(li, LITEST_KEYBOARD);
litest_lid_action(sw, LIBINPUT_SWITCH_STATE_ON); for (int i = 0; i < 3; i++) {
litest_drain_events(li); litest_lid_action(sw, LIBINPUT_SWITCH_STATE_ON);
litest_drain_events(li);
litest_event(keyboard, EV_KEY, KEY_A, 1); litest_event(keyboard, EV_KEY, KEY_A, 1);
litest_event(keyboard, EV_SYN, SYN_REPORT, 0); litest_event(keyboard, EV_SYN, SYN_REPORT, 0);
litest_event(keyboard, EV_KEY, KEY_A, 0); litest_event(keyboard, EV_KEY, KEY_A, 0);
litest_event(keyboard, EV_SYN, SYN_REPORT, 0); litest_event(keyboard, EV_SYN, SYN_REPORT, 0);
libinput_dispatch(li); libinput_dispatch(li);
event = libinput_get_event(li); event = libinput_get_event(li);
litest_is_switch_event(event, litest_is_switch_event(event,
LIBINPUT_SWITCH_LID, LIBINPUT_SWITCH_LID,
LIBINPUT_SWITCH_STATE_OFF); LIBINPUT_SWITCH_STATE_OFF);
libinput_event_destroy(event);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY);
litest_lid_action(sw, LIBINPUT_SWITCH_STATE_OFF); litest_lid_action(sw, LIBINPUT_SWITCH_STATE_OFF);
litest_assert_empty_queue(li); litest_assert_empty_queue(li);
}
libinput_event_destroy(event);
litest_delete_device(keyboard); litest_delete_device(keyboard);
} }
END_TEST END_TEST
@ -467,7 +543,6 @@ START_TEST(lid_update_hw_on_key)
struct litest_device *keyboard; struct litest_device *keyboard;
struct libinput_event *event; struct libinput_event *event;
sleep(5);
keyboard = litest_add_device(li, LITEST_KEYBOARD); keyboard = litest_add_device(li, LITEST_KEYBOARD);
/* separate context to listen to the fake hw event */ /* separate context to listen to the fake hw event */
@ -555,6 +630,24 @@ START_TEST(lid_update_hw_on_key_closed_on_init)
} }
END_TEST END_TEST
START_TEST(lid_key_press)
{
struct litest_device *sw = litest_current_device();
struct libinput *li = sw->libinput;
litest_drain_events(li);
litest_keyboard_key(sw, KEY_POWER, true);
litest_keyboard_key(sw, KEY_POWER, false);
libinput_dispatch(li);
/* We should route the key events correctly, but for now we just
* ignore them. This test will fail once the key events are handled
* correctly. */
litest_assert_empty_queue(li);
}
END_TEST
void void
litest_setup_tests_lid(void) litest_setup_tests_lid(void)
{ {
@ -567,6 +660,8 @@ litest_setup_tests_lid(void)
litest_add("lid:disable_touchpad", lid_disable_touchpad_edge_scroll, LITEST_SWITCH, LITEST_ANY); litest_add("lid:disable_touchpad", lid_disable_touchpad_edge_scroll, LITEST_SWITCH, LITEST_ANY);
litest_add("lid:disable_touchpad", lid_disable_touchpad_edge_scroll_interrupt, LITEST_SWITCH, LITEST_ANY); litest_add("lid:disable_touchpad", lid_disable_touchpad_edge_scroll_interrupt, LITEST_SWITCH, LITEST_ANY);
litest_add("lid:disable_touchpad", lid_disable_touchpad_already_open, LITEST_SWITCH, LITEST_ANY); litest_add("lid:disable_touchpad", lid_disable_touchpad_already_open, LITEST_SWITCH, LITEST_ANY);
litest_add("lid:touchpad", switch_dont_resume_disabled_touchpad, LITEST_SWITCH, LITEST_ANY);
litest_add("lid:touchpad", switch_dont_resume_disabled_touchpad_external_mouse, LITEST_SWITCH, LITEST_ANY);
litest_add("lid:keyboard", lid_open_on_key, LITEST_SWITCH, LITEST_ANY); litest_add("lid:keyboard", lid_open_on_key, LITEST_SWITCH, LITEST_ANY);
litest_add("lid:keyboard", lid_open_on_key_touchpad_enabled, LITEST_SWITCH, LITEST_ANY); litest_add("lid:keyboard", lid_open_on_key_touchpad_enabled, LITEST_SWITCH, LITEST_ANY);
@ -576,4 +671,6 @@ litest_setup_tests_lid(void)
litest_add_for_device("lid:buggy", lid_update_hw_on_key, LITEST_LID_SWITCH_SURFACE3); litest_add_for_device("lid:buggy", lid_update_hw_on_key, LITEST_LID_SWITCH_SURFACE3);
litest_add_for_device("lid:buggy", lid_update_hw_on_key_closed_on_init, LITEST_LID_SWITCH_SURFACE3); litest_add_for_device("lid:buggy", lid_update_hw_on_key_closed_on_init, LITEST_LID_SWITCH_SURFACE3);
litest_add_for_device("lid:keypress", lid_key_press, LITEST_GPIO_KEYS);
} }

View file

@ -270,6 +270,9 @@ START_TEST(pad_ring)
struct libinput_event_tablet_pad *pev; struct libinput_event_tablet_pad *pev;
int val; int val;
double degrees, expected; double degrees, expected;
int min, max;
int step_size;
int nevents = 0;
litest_pad_ring_start(dev, 10); litest_pad_ring_start(dev, 10);
@ -278,11 +281,28 @@ START_TEST(pad_ring)
/* Wacom's 0 value is at 275 degrees */ /* Wacom's 0 value is at 275 degrees */
expected = 270; expected = 270;
for (val = 0; val < 100; val += 10) { min = libevdev_get_abs_minimum(dev->evdev, ABS_WHEEL);
max = libevdev_get_abs_maximum(dev->evdev, ABS_WHEEL);
step_size = 360/(max - min + 1);
/* This is a bit strange because we rely on kernel filtering here.
The litest_*() functions take a percentage, but mapping this to
the pads 72 or 36 range pad ranges is lossy and a bit
unpredictable. So instead we increase by a small percentage,
expecting *most* events to be filtered by the kernel because they
resolve to the same integer value as the previous event. Whenever
an event gets through, we expect that to be the next integer
value in the range and thus the next step on the circle.
*/
for (val = 0; val < 100.0; val += 1) {
litest_pad_ring_change(dev, val); litest_pad_ring_change(dev, val);
libinput_dispatch(li); libinput_dispatch(li);
ev = libinput_get_event(li); ev = libinput_get_event(li);
if (!ev)
continue;
nevents++;
pev = litest_is_pad_ring_event(ev, pev = litest_is_pad_ring_event(ev,
0, 0,
LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER); LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER);
@ -291,15 +311,14 @@ START_TEST(pad_ring)
ck_assert_double_ge(degrees, 0.0); ck_assert_double_ge(degrees, 0.0);
ck_assert_double_lt(degrees, 360.0); ck_assert_double_lt(degrees, 360.0);
/* rounding errors, mostly caused by small physical range */ ck_assert_double_eq(degrees, expected);
ck_assert_double_ge(degrees, expected - 2);
ck_assert_double_le(degrees, expected + 2);
libinput_event_destroy(ev); libinput_event_destroy(ev);
expected = fmod(degrees + step_size, 360);
expected = fmod(degrees + 36, 360);
} }
ck_assert_int_eq(nevents, 360/step_size - 1);
litest_pad_ring_end(dev); litest_pad_ring_end(dev);
} }
END_TEST END_TEST

View file

@ -490,6 +490,40 @@ START_TEST(pointer_button_has_no_button)
} }
END_TEST END_TEST
START_TEST(pointer_recover_from_lost_button_count)
{
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
struct libevdev *evdev = dev->evdev;
disable_button_scrolling(dev);
litest_drain_events(dev->libinput);
litest_button_click(dev, BTN_LEFT, 1);
litest_assert_button_event(li,
BTN_LEFT,
LIBINPUT_BUTTON_STATE_PRESSED);
/* Grab for the release to make libinput lose count */
libevdev_grab(evdev, LIBEVDEV_GRAB);
litest_button_click(dev, BTN_LEFT, 0);
libevdev_grab(evdev, LIBEVDEV_UNGRAB);
litest_assert_empty_queue(li);
litest_button_click(dev, BTN_LEFT, 1);
litest_assert_empty_queue(li);
litest_button_click(dev, BTN_LEFT, 0);
litest_assert_button_event(li,
BTN_LEFT,
LIBINPUT_BUTTON_STATE_RELEASED);
litest_assert_empty_queue(li);
}
END_TEST
static inline double static inline double
wheel_click_count(struct litest_device *dev, int which) wheel_click_count(struct litest_device *dev, int which)
{ {
@ -2088,6 +2122,7 @@ litest_setup_tests_pointer(void)
litest_add_no_device("pointer:button", pointer_button_auto_release); litest_add_no_device("pointer:button", pointer_button_auto_release);
litest_add_no_device("pointer:button", pointer_seat_button_count); litest_add_no_device("pointer:button", pointer_seat_button_count);
litest_add_for_device("pointer:button", pointer_button_has_no_button, LITEST_KEYBOARD); litest_add_for_device("pointer:button", pointer_button_has_no_button, LITEST_KEYBOARD);
litest_add("pointer:button", pointer_recover_from_lost_button_count, LITEST_BUTTON, LITEST_CLICKPAD);
litest_add("pointer:scroll", pointer_scroll_wheel, LITEST_WHEEL, LITEST_TABLET); litest_add("pointer:scroll", pointer_scroll_wheel, LITEST_WHEEL, LITEST_TABLET);
litest_add("pointer:scroll", pointer_scroll_button, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY); litest_add("pointer:scroll", pointer_scroll_button, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY);
litest_add("pointer:scroll", pointer_scroll_button_noscroll, LITEST_ABSOLUTE|LITEST_BUTTON, LITEST_RELATIVE); litest_add("pointer:scroll", pointer_scroll_button_noscroll, LITEST_ABSOLUTE|LITEST_BUTTON, LITEST_RELATIVE);

View file

@ -3819,6 +3819,47 @@ START_TEST(touchpad_dwt_enable_during_tap)
} }
END_TEST END_TEST
START_TEST(touchpad_dwt_remove_kbd_while_active)
{
struct litest_device *touchpad = litest_current_device();
struct litest_device *keyboard;
struct libinput *li = touchpad->libinput;
if (!has_disable_while_typing(touchpad))
return;
litest_enable_tap(touchpad->libinput_device);
enable_dwt(touchpad);
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
litest_keyboard_key(keyboard, KEY_A, false);
libinput_dispatch(li);
litest_touch_down(touchpad, 0, 50, 50);
libinput_dispatch(li);
litest_keyboard_key(keyboard, KEY_A, true);
litest_keyboard_key(keyboard, KEY_A, false);
litest_drain_events(li);
litest_delete_device(keyboard);
litest_drain_events(li);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
}
END_TEST
START_TEST(touchpad_dwt_apple) START_TEST(touchpad_dwt_apple)
{ {
struct litest_device *touchpad = litest_current_device(); struct litest_device *touchpad = litest_current_device();
@ -5071,6 +5112,7 @@ litest_setup_tests_touchpad(void)
litest_add("touchpad:dwt", touchpad_dwt_enable_during_touch, LITEST_TOUCHPAD, LITEST_ANY); litest_add("touchpad:dwt", touchpad_dwt_enable_during_touch, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:dwt", touchpad_dwt_enable_before_touch, LITEST_TOUCHPAD, LITEST_ANY); litest_add("touchpad:dwt", touchpad_dwt_enable_before_touch, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:dwt", touchpad_dwt_enable_during_tap, LITEST_TOUCHPAD, LITEST_ANY); litest_add("touchpad:dwt", touchpad_dwt_enable_during_tap, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:dwt", touchpad_dwt_remove_kbd_while_active, LITEST_TOUCHPAD, LITEST_ANY);
litest_add_for_device("touchpad:dwt", touchpad_dwt_apple, LITEST_BCM5974); litest_add_for_device("touchpad:dwt", touchpad_dwt_apple, LITEST_BCM5974);
litest_add_for_device("touchpad:dwt", touchpad_dwt_acer_hawaii, LITEST_ACER_HAWAII_TOUCHPAD); litest_add_for_device("touchpad:dwt", touchpad_dwt_acer_hawaii, LITEST_ACER_HAWAII_TOUCHPAD);

View file

@ -45,3 +45,10 @@
... ...
obj:/usr/lib*/libpython3*.so* obj:/usr/lib*/libpython3*.so*
} }
{
libevdev:grab
Memcheck:Param
ioctl(generic)
fun:ioctl
fun:libevdev_grab
}

View file

@ -63,7 +63,7 @@ endif
EXTRA_DIST = make-ptraccel-graphs.sh install-compat-scripts.sh $(bin_SCRIPTS) EXTRA_DIST = make-ptraccel-graphs.sh install-compat-scripts.sh $(bin_SCRIPTS)
install-data-hook: install-exec-hook:
(cd $(DESTDIR)$(bindir) && mv libinput-list-devices.compat libinput-list-devices) (cd $(DESTDIR)$(bindir) && mv libinput-list-devices.compat libinput-list-devices)
(cd $(DESTDIR)$(bindir) && mv libinput-debug-events.compat libinput-debug-events) (cd $(DESTDIR)$(bindir) && mv libinput-debug-events.compat libinput-debug-events)

View file

@ -967,7 +967,6 @@ main(int argc, char **argv)
verbose = true; verbose = true;
break; break;
default: default:
printf(".. %c\n", c);
if (tools_parse_option(c, optarg, &options) != 0) { if (tools_parse_option(c, optarg, &options) != 0) {
usage(); usage();
return 1; return 1;

0
tools/libinput-list-devices.c Executable file → Normal file
View file

View file

@ -128,11 +128,10 @@ int main(int argc, char **argv)
#endif #endif
snprintf(group, snprintf(group,
sizeof(group), sizeof(group),
"%x/%x/%x/%x:%s", "%x/%x/%x:%s",
bustype, bustype,
vendor_id, vendor_id,
product_id, product_id,
version,
phys); phys);
} }