본문 바로가기

Engineering/__00. Linux

evtest - Input device event monitor and query tool

Sample

1.	In the file /etc/system/logind.conf 
HandlePowerKey=poweroff or HandlePowerKey section is none?
(It is set to handlepowerkey=power off or not at all. Also, after configuration change, it should be tested after rebooing.)
2.	Please check the evtest result.


# sudo evtest 
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      Power Button
/dev/input/event1:      Power Button
/dev/input/event2:      Logitech Wireless Mouse PID:4022
/dev/input/event3:      Logitech Wireless Keyboard PID:4023
Select the device event number [0-3]: 0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x1 version 0x0
Input device name: "Power Button"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 116 (KEY_POWER)
Properties:
Testing ... (interrupt to exit)
Event: time 1693188960.523333, type 1 (EV_KEY), code 116 (KEY_POWER), value 1
Event: time 1693188960.523333, -------------- SYN_REPORT ------------
Event: time 1693188960.523350, type 1 (EV_KEY), code 116 (KEY_POWER), value 0
Event: time 1693188960.523350, -------------- SYN_REPORT ------------

You can install ‘evetest’ with apt install evtest command.
We received signal after touch power button as like above 'Event :' text

 

NAME

       evtest - Input device event monitor and query tool

SYNOPSIS

       evtest [--grab] /dev/input/eventX

       evtest --query /dev/input/eventX <type> <value>

DESCRIPTION

       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.

       If the --grab flag is given in capture mode, evtest keeps an EVIOCGRAB on the device.
       While this grab is active, other processes will not receive events from the kernel
       devices. The grab is released again when evtest quits.

       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 10. If the
       state bit is unset (key depressed, switch off, ...), evtest exits with code 0. 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.

       evtest is commonly used to debug issues with input devices in X.Org. The output of evtest
       shows the information presented by the kernel; based on this information it can be
       determined whether a bug may be a kernel or an X.Org issue.

DIAGNOSTICS

       If evtest does not show any events even though the device is being used, the device may be
       grabbed by a process (EVIOCGRAB). This is usually the case 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.

       The following command shows the processes with an open file descriptor on the device:

           fuser -v /dev/input/eventX

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)

AUTHOR

       evtest was written by Vojtech Pavlik <vojtech@suse.cz[1]>.

       This manual page was written by Stephen Kitt <steve@sk2.org[2]>, based on that present in
       the lineakd package, for the Debian GNU/Linux system (but may be used by others).

NOTES

        1. vojtech@suse.cz
           mailto:vojtech@suse.cz

        2. steve@sk2.org
           mailto:steve@sk2.org

                                            08/22/2019                                  EVTEST(1)

 

 

 

'Engineering > __00. Linux' 카테고리의 다른 글

nc - arbitrary TCP and UDP connections and listens  (0) 2023.03.15
DISK 검사와 read only mount 조치 법  (0) 2023.03.07
[터미널 단축기]  (0) 2022.10.26
open 된 서비스 찾기 (lsof)  (0) 2021.12.07
[Sendmail/Postfix]  (0) 2021.08.31