Message type for TTY_INPUT_EVENT

Change-Id: I2bae0a2c8326b36c438f9b340c394ec66189c1c8
This commit is contained in:
Lionel Sambuc 2014-05-26 16:34:34 +02:00
parent 5277fbe9f6
commit 310904bf12
4 changed files with 26 additions and 8 deletions

View file

@ -152,16 +152,16 @@ void do_input(message *msg)
} }
/* Only handle keyboard keys. */ /* Only handle keyboard keys. */
if (msg->INPUT_PAGE != INPUT_PAGE_KEY) if (msg->m_input_tty_event.page != INPUT_PAGE_KEY)
return; return;
/* Only handle known USB HID keyboard codes (the 00h-E7h range). */ /* Only handle known USB HID keyboard codes (the 00h-E7h range). */
scode = msg->INPUT_CODE; scode = msg->m_input_tty_event.code;
if (scode >= NR_SCAN_CODES) if (scode >= NR_SCAN_CODES)
return; return;
/* Is it a KEY RELEASE? */ /* Is it a KEY RELEASE? */
if (msg->INPUT_VALUE == INPUT_RELEASE) if (msg->m_input_tty_event.value == INPUT_RELEASE)
scode |= RELEASE_BIT; scode |= RELEASE_BIT;
if (incount < KB_IN_BYTES) { if (incount < KB_IN_BYTES) {

View file

@ -966,9 +966,6 @@
/* This message uses no message fields. */ /* This message uses no message fields. */
#define TTY_INPUT_EVENT (TTY_RQ_BASE + 3) /* relayed input event */ #define TTY_INPUT_EVENT (TTY_RQ_BASE + 3) /* relayed input event */
# define INPUT_PAGE m7_i2 /* usage page */
# define INPUT_CODE m7_i3 /* usage code */
# define INPUT_VALUE m7_i4 /* event value */
/*===========================================================================* /*===========================================================================*
* Messages for input server and drivers * * Messages for input server and drivers *

View file

@ -145,6 +145,17 @@ typedef struct {
} mess_sigcalls; } mess_sigcalls;
_ASSERT_MSG_SIZE(mess_sigcalls); _ASSERT_MSG_SIZE(mess_sigcalls);
typedef struct {
int id;
int page;
int code;
int value;
int flags;
uint8_t padding[36];
} mess_input_tty_event;
_ASSERT_MSG_SIZE(mess_input_tty_event);
typedef struct { typedef struct {
time_t acnt_queue; time_t acnt_queue;
@ -1616,6 +1627,8 @@ typedef struct {
mess_notify m_notify; mess_notify m_notify;
mess_sigcalls m_sigcalls; mess_sigcalls m_sigcalls;
mess_input_tty_event m_input_tty_event;
mess_krn_lsys_schedule m_krn_lsys_schedule; mess_krn_lsys_schedule m_krn_lsys_schedule;
mess_krn_lsys_sys_fork m_krn_lsys_sys_fork; mess_krn_lsys_sys_fork m_krn_lsys_sys_fork;
mess_krn_lsys_sys_getwhoami m_krn_lsys_sys_getwhoami; mess_krn_lsys_sys_getwhoami m_krn_lsys_sys_getwhoami;

View file

@ -406,9 +406,17 @@ input_event(message *m)
else if (mux_dev->opened) else if (mux_dev->opened)
input_process(mux_dev, m); input_process(mux_dev, m);
else { else {
m->m_type = TTY_INPUT_EVENT; message fwd;
mess_input_tty_event *tty_event = &(fwd.m_input_tty_event);
if ((r = ipc_send(TTY_PROC_NR, m)) != OK) fwd.m_type = TTY_INPUT_EVENT;
tty_event->id = m->m_linputdriver_input_event.id;
tty_event->page = m->m_linputdriver_input_event.page;
tty_event->code = m->m_linputdriver_input_event.code;
tty_event->value = m->m_linputdriver_input_event.value;
tty_event->flags = m->m_linputdriver_input_event.flags;
if ((r = ipc_send(TTY_PROC_NR, &fwd)) != OK)
printf("INPUT: send to TTY failed (%d)\n", r); printf("INPUT: send to TTY failed (%d)\n", r);
} }
} }