shell command: getevent and sendevent

1.getevent
output all the basic information event equipment

 


Output formats:
Device name: Event type Event code Event value

Note: Here are hexadecimal numbers.

getevent -c 10 // 10 outputs information of the exit
getevent -l // the type, code, value names displayed in a corresponding constant

after use getevent -l output of the command format is:

 



Corresponding to the digital code converted to a string of readily appreciated, these constants are defined input.h file.

2.sendevent
send events command, event simulation operation.
The command format is as follows:

 

Note: Results and getevent command output is not the same, type here, code, value is decimal.

Look at this map

This is to click the volume down button on the Lenovo A390t time, getevent output. It is readily appreciated, four steps: Press the Save Volume -> transmit a synchronization Report -> Save Lift Volume -> transmit a synchronization report. Only after the report is sent synchronous event to take effect.
Converted to hexadecimal Output:

Wherein the hexadecimal number is converted into a decimal number (0x72-> 114), using the command sendevent simulate pressing keys to try the effect of reducing the volume.
In turn enter the following command:

sendEvent / dev / the INPUT / event0 0001 0114 00000001
sendEvent / dev / the INPUT / event0 0000 0000 00000000
sendEvent / dev / the INPUT / event0 0001 0114 00000000
sendEvent / dev / the INPUT / 0000 0000 00000000 event0

can be found in the two days before the command input then came the volume control window, if you do not enter two commands, volume adjustment window will not disappear.

Last emphasize:
(1) the GetEvent output is 16 hexadecimal, sendevent using decimal, pay attention to conversion.
(2) the output command getevent different types of equipment, but they are similar.

 

Guess you like

Origin www.cnblogs.com/klb561/p/11029446.html