summaryrefslogtreecommitdiff
path: root/evtest.txt
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2011-07-20 18:25:03 +0100
committerPeter Hutterer <peter.hutterer@who-t.net>2011-07-22 09:55:37 +1000
commit8a10dfe3b7bc53b319107de89434922a2c79ef94 (patch)
tree4bc3f50a848f0b4161a38c1775e38cfb84d08701 /evtest.txt
parent6015b4c4cf0efeb845673c37d80f3049e86c04a1 (diff)
Add one-shot query functionality
Add functionality to query evdev state of a specific key, switch, button, LED or sound event. This is useful in programs such as powerd (http://wiki.laptop.org/go/Powerd) which need to query things like the state of the laptop lid switch from shell code. Original capture-mode functionality is left unchanged and is still activated by default. New usage modes are explained in the man page. Signed-off-by: Daniel Drake <dsd@laptop.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'evtest.txt')
-rw-r--r--evtest.txt33
1 files changed, 28 insertions, 5 deletions
diff --git a/evtest.txt b/evtest.txt
index 685a4de..5ae7092 100644
--- a/evtest.txt
+++ b/evtest.txt
@@ -4,17 +4,33 @@ EVTEST(1)
NAME
----
- evtest - Input device event monitor
+ evtest - Input device event monitor and query tool
SYNOPSIS
--------
- evtest "/dev/input/eventX"
+ evtest /dev/input/eventX
+
+ evtest --query /dev/input/eventX <type> <value>
DESCRIPTION
-----------
-evtest displays information on the input device specified on the command
-line, including all the events supported by the device. It then monitors the
-device and displays all the events layer events generated.
+The first invocation type displayed above ("capture mode") causes evtest to
+display information about the specified input device, including all the events
+supported by the device. It then monitors the device and displays all the
+events layer events generated.
+
+In the second invocation type ("query mode"), evtest performs a one-shot query
+of the state of a specific key *value* of an event *type*.
+
+*type* is one of: *EV_KEY*, *EV_SW*, *EV_SND*, *EV_LED* (or the numerical value)
+
+*value* can be either a decimal representation (e.g. 44), hex
+(e.g. 0x2c), or the constant name (e.g. KEY_Z) of the key/switch/sound/LED
+being queried.
+
+If the state bit is set (key pressed, switch on, ...), evtest exits with
+code 0. If the state bit is unset (key depressed, switch off, ...), evtest
+exits with code 10. No other output is generated.
evtest needs to be able to read from the device; in most cases this means it
must be run as root.
@@ -32,6 +48,13 @@ when debugging a synaptics device from within X. VT switching to a TTY or
shutting down the X server terminates this grab and synaptics devices can be
debugged.
+EXIT CODE
+---------
+evtest returns 1 on error.
+
+When used to query state, evtest returns 0 if the state bit is unset and
+10 if the state bit is set.
+
SEE ALSO
--------
inputattach(1)