From: Lionel Sambuc Date: Mon, 26 May 2014 14:34:34 +0000 (+0200) Subject: Message type for TTY_INPUT_EVENT X-Git-Tag: v3.3.0~209 X-Git-Url: http://zhaoyanbai.com/repos/?a=commitdiff_plain;h=310904bf1260e89ca23e5dd4af8e0a0a5be3f8f0;p=minix.git Message type for TTY_INPUT_EVENT Change-Id: I2bae0a2c8326b36c438f9b340c394ec66189c1c8 --- diff --git a/drivers/tty/arch/i386/keyboard.c b/drivers/tty/arch/i386/keyboard.c index 736043ede..0e8a9fc59 100644 --- a/drivers/tty/arch/i386/keyboard.c +++ b/drivers/tty/arch/i386/keyboard.c @@ -152,16 +152,16 @@ void do_input(message *msg) } /* Only handle keyboard keys. */ - if (msg->INPUT_PAGE != INPUT_PAGE_KEY) + if (msg->m_input_tty_event.page != INPUT_PAGE_KEY) return; /* 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) return; /* Is it a KEY RELEASE? */ - if (msg->INPUT_VALUE == INPUT_RELEASE) + if (msg->m_input_tty_event.value == INPUT_RELEASE) scode |= RELEASE_BIT; if (incount < KB_IN_BYTES) { diff --git a/include/minix/com.h b/include/minix/com.h index 3bde3d3ad..09d99c0c4 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -966,9 +966,6 @@ /* This message uses no message fields. */ #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 * diff --git a/include/minix/ipc.h b/include/minix/ipc.h index ee423e56a..55ddbd7db 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -145,6 +145,17 @@ typedef struct { } 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 { time_t acnt_queue; @@ -1616,6 +1627,8 @@ typedef struct { mess_notify m_notify; mess_sigcalls m_sigcalls; + mess_input_tty_event m_input_tty_event; + mess_krn_lsys_schedule m_krn_lsys_schedule; mess_krn_lsys_sys_fork m_krn_lsys_sys_fork; mess_krn_lsys_sys_getwhoami m_krn_lsys_sys_getwhoami; diff --git a/servers/input/input.c b/servers/input/input.c index 6390255fe..089e779b9 100644 --- a/servers/input/input.c +++ b/servers/input/input.c @@ -406,9 +406,17 @@ input_event(message *m) else if (mux_dev->opened) input_process(mux_dev, m); 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); } }