[Linux] Writing input event directly.

This is a kind of reminder.
(On Android)

Source code.

linux/input.h
    struct input_event;
: write 'struct input_event' to input event node.
ex.
    struct input_event ev;
    ...
    write(fd, &ev, sizeof(ev));
    ...

File system

/dev/input/*, /proc/bus/input/*

Touch event

                  type        code        value
                  EV_ABS      ABS_X       <value>
<common>          EV_ABS      ABS_Y       <value>

Press (or Drag)   EV_KEY      BTN_TOUCH   1
Release           EV_KEY      BTN_TOUCH   0

<common>          EV_SYN      0           0

 

Key event

                  type        code        value
Press             EV_KEY      <key code>  1
Release           EV_KEY      <key code>  0

 

Done.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s