Hardware Reference
In-Depth Information
Table 3-5.
List of uinput Event Types
Macro
From Header File input.h
53
]
Description
EV_SYN
Event synchronization/separation
EV_KEY
Key/button state changes
EV_REL
Relative axis mouse-like changes
EV_ABS
Absolute axis mouse-like changes
EV_MSC
Miscellaneous events
EV_SW
Binary (switch) state changes
EV_LED
LED on/off changes
EV_SND
Output to sound devices
EV_REP
For use with autorepeating devices
EV_FF
Force feedback commands to input device
EV_PWR
Power button/switch event
EV_FF_STATUS
Receive force feedback device status
■
Do not
or
the event types together. the device driver expects each event type
to be registered
separately
.
Caution
Configure EV_KEY
Once you have registered your intention to provide
EV_KEY
events, you need to register all
key codes that might be used. While this seems a nuisance, it does guard against garbage
being injected by an errant program. The following code registers its intention to inject an
Escape key code:
int rc;
rc = ioctl(fd,UI_SET_KEYBIT,KEY_ESC);
assert(!rc);
To configure all possible keys, a loop can be used. But do not register key code 0
(
KEY_RESERVED
) nor 255; the include file indicates that code 255 is reserved for the special
needs of the AT keyboard driver.