From 4091fdf5c4b1d2888cacde15c0acfb536e6593a0 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Wed, 4 Jun 2014 17:23:50 +0200 Subject: [PATCH] Message type for TTY_FKEY_CONTROL Change-Id: Ic7a8901089f14f65e840bd88b087b733c3e3bdee --- drivers/tty/arch/i386/keyboard.c | 24 ++++++++++++------------ include/minix/com.h | 5 ----- include/minix/ipc.h | 21 +++++++++++++++++++++ lib/libsys/fkey_ctl.c | 10 +++++----- 4 files changed, 38 insertions(+), 22 deletions(-) diff --git a/drivers/tty/arch/i386/keyboard.c b/drivers/tty/arch/i386/keyboard.c index bd74859bd..764054502 100644 --- a/drivers/tty/arch/i386/keyboard.c +++ b/drivers/tty/arch/i386/keyboard.c @@ -435,11 +435,11 @@ message *m_ptr; /* pointer to the request message */ int s, i; int result = EINVAL; - switch (m_ptr->FKEY_REQUEST) { /* see what we must do */ + switch (m_ptr->m_lsys_tty_fkey_ctl.request) { /* see what we must do */ case FKEY_MAP: /* request for new mapping */ result = OK; /* assume everything will be ok*/ for (i=0; i < 12; i++) { /* check F1-F12 keys */ - if (bit_isset(m_ptr->FKEY_FKEYS, i+1) ) { + if (bit_isset(m_ptr->m_lsys_tty_fkey_ctl.fkeys, i+1) ) { #if DEAD_CODE /* Currently, we don't check if the slot is in use, so that IS * can recover after a crash by overtaking its existing mappings. @@ -449,7 +449,7 @@ message *m_ptr; /* pointer to the request message */ #endif fkey_obs[i].proc_nr = m_ptr->m_source; fkey_obs[i].events = 0; - bit_unset(m_ptr->FKEY_FKEYS, i+1); + bit_unset(m_ptr->m_lsys_tty_fkey_ctl.fkeys, i+1); #if DEAD_CODE } else { printf("WARNING, fkey_map failed F%d\n", i+1); @@ -459,13 +459,13 @@ message *m_ptr; /* pointer to the request message */ } } for (i=0; i < 12; i++) { /* check Shift+F1-F12 keys */ - if (bit_isset(m_ptr->FKEY_SFKEYS, i+1) ) { + if (bit_isset(m_ptr->m_lsys_tty_fkey_ctl.sfkeys, i+1) ) { #if DEAD_CODE if (sfkey_obs[i].proc_nr == NONE) { #endif sfkey_obs[i].proc_nr = m_ptr->m_source; sfkey_obs[i].events = 0; - bit_unset(m_ptr->FKEY_SFKEYS, i+1); + bit_unset(m_ptr->m_lsys_tty_fkey_ctl.sfkeys, i+1); #if DEAD_CODE } else { printf("WARNING, fkey_map failed Shift F%d\n", i+1); @@ -478,22 +478,22 @@ message *m_ptr; /* pointer to the request message */ case FKEY_UNMAP: result = OK; /* assume everything will be ok*/ for (i=0; i < 12; i++) { /* check F1-F12 keys */ - if (bit_isset(m_ptr->FKEY_FKEYS, i+1) ) { + if (bit_isset(m_ptr->m_lsys_tty_fkey_ctl.fkeys, i+1) ) { if (fkey_obs[i].proc_nr == m_ptr->m_source) { fkey_obs[i].proc_nr = NONE; fkey_obs[i].events = 0; - bit_unset(m_ptr->FKEY_FKEYS, i+1); + bit_unset(m_ptr->m_lsys_tty_fkey_ctl.fkeys, i+1); } else { result = EPERM; /* report failure, but try rest */ } } } for (i=0; i < 12; i++) { /* check Shift+F1-F12 keys */ - if (bit_isset(m_ptr->FKEY_SFKEYS, i+1) ) { + if (bit_isset(m_ptr->m_lsys_tty_fkey_ctl.sfkeys, i+1) ) { if (sfkey_obs[i].proc_nr == m_ptr->m_source) { sfkey_obs[i].proc_nr = NONE; sfkey_obs[i].events = 0; - bit_unset(m_ptr->FKEY_SFKEYS, i+1); + bit_unset(m_ptr->m_lsys_tty_fkey_ctl.sfkeys, i+1); } else { result = EPERM; /* report failure, but try rest */ } @@ -502,17 +502,17 @@ message *m_ptr; /* pointer to the request message */ break; case FKEY_EVENTS: result = OK; /* everything will be ok*/ - m_ptr->FKEY_FKEYS = m_ptr->FKEY_SFKEYS = 0; + m_ptr->m_tty_lsys_fkey_ctl.fkeys = m_ptr->m_tty_lsys_fkey_ctl.sfkeys = 0; for (i=0; i < 12; i++) { /* check (Shift+) F1-F12 keys */ if (fkey_obs[i].proc_nr == m_ptr->m_source) { if (fkey_obs[i].events) { - bit_set(m_ptr->FKEY_FKEYS, i+1); + bit_set(m_ptr->m_tty_lsys_fkey_ctl.fkeys, i+1); fkey_obs[i].events = 0; } } if (sfkey_obs[i].proc_nr == m_ptr->m_source) { if (sfkey_obs[i].events) { - bit_set(m_ptr->FKEY_SFKEYS, i+1); + bit_set(m_ptr->m_tty_lsys_fkey_ctl.sfkeys, i+1); sfkey_obs[i].events = 0; } } diff --git a/include/minix/com.h b/include/minix/com.h index 09d99c0c4..948dca05e 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -955,16 +955,11 @@ #define TTY_RQ_BASE 0x1300 #define TTY_FKEY_CONTROL (TTY_RQ_BASE + 1) /* control an F-key at TTY */ -# define FKEY_REQUEST m2_i1 /* request to perform at TTY */ # define FKEY_MAP 10 /* observe function key */ # define FKEY_UNMAP 11 /* stop observing function key */ # define FKEY_EVENTS 12 /* request open key presses */ -# define FKEY_FKEYS m2_l1 /* F1-F12 keys pressed */ -# define FKEY_SFKEYS m2_l2 /* Shift-F1-F12 keys pressed */ #define TTY_INPUT_UP (TTY_RQ_BASE + 2) /* input server is up */ -/* This message uses no message fields. */ - #define TTY_INPUT_EVENT (TTY_RQ_BASE + 3) /* relayed input event */ /*===========================================================================* diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 55ddbd7db..99c988a35 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -1067,6 +1067,23 @@ typedef struct { } mess_lsys_svrctl; _ASSERT_MSG_SIZE(mess_lsys_svrctl); +typedef struct { + int request; + int fkeys; + int sfkeys; + + uint8_t padding[44]; +} mess_lsys_tty_fkey_ctl; +_ASSERT_MSG_SIZE(mess_lsys_tty_fkey_ctl); + +typedef struct { + int fkeys; + int sfkeys; + + uint8_t padding[48]; +} mess_tty_lsys_fkey_ctl; +_ASSERT_MSG_SIZE(mess_tty_lsys_fkey_ctl); + typedef struct { endpoint_t endpt; cp_grant_id_t grant; @@ -1748,6 +1765,8 @@ typedef struct { mess_lsys_svrctl m_lsys_svrctl; + mess_lsys_tty_fkey_ctl m_lsys_tty_fkey_ctl; + mess_lsys_vfs_checkperms m_lsys_vfs_checkperms; mess_lsys_vfs_copyfd m_lsys_vfs_copyfd; mess_lsys_vfs_mapdriver m_lsys_vfs_mapdriver; @@ -1784,6 +1803,8 @@ typedef struct { mess_sched_lsys_scheduling_start m_sched_lsys_scheduling_start; + mess_tty_lsys_fkey_ctl m_tty_lsys_fkey_ctl; + mess_vfs_fs_breadwrite m_vfs_fs_breadwrite; mess_vfs_fs_chmod m_vfs_fs_chmod; mess_vfs_fs_chown m_vfs_fs_chown; diff --git a/lib/libsys/fkey_ctl.c b/lib/libsys/fkey_ctl.c index 94ec9478e..9938e669a 100644 --- a/lib/libsys/fkey_ctl.c +++ b/lib/libsys/fkey_ctl.c @@ -17,12 +17,12 @@ int *sfkeys; /* bit masks for Shift F1-F12 keys */ message m; int s; memset(&m, 0, sizeof(m)); - m.FKEY_REQUEST = request; - m.FKEY_FKEYS = (fkeys) ? *fkeys : 0; - m.FKEY_SFKEYS = (sfkeys) ? *sfkeys : 0; + m.m_lsys_tty_fkey_ctl.request = request; + m.m_lsys_tty_fkey_ctl.fkeys = (fkeys) ? *fkeys : 0; + m.m_lsys_tty_fkey_ctl.sfkeys = (sfkeys) ? *sfkeys : 0; s = _taskcall(TTY_PROC_NR, TTY_FKEY_CONTROL, &m); - if (fkeys) *fkeys = m.FKEY_FKEYS; - if (sfkeys) *sfkeys = m.FKEY_SFKEYS; + if (fkeys) *fkeys = m.m_tty_lsys_fkey_ctl.fkeys; + if (sfkeys) *sfkeys = m.m_tty_lsys_fkey_ctl.sfkeys; return(s); }