Changes in uspace/lib/c/generic/io/console.c [7c014d1:902f0906] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/console.c
r7c014d1 r902f0906 38 38 #include <async.h> 39 39 #include <errno.h> 40 #include <stdio.h>41 40 #include <malloc.h> 42 41 #include <vfs/vfs_sess.h> … … 126 125 { 127 126 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 128 async_req_1_0(exch, CONSOLE_ CURSOR_VISIBILITY, (show != false));127 async_req_1_0(exch, CONSOLE_SET_CURSOR_VISIBILITY, (show != false)); 129 128 async_exchange_end(exch); 130 129 } … … 151 150 { 152 151 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 153 async_req_2_0(exch, CONSOLE_GOTO, col, row); 154 async_exchange_end(exch); 155 } 156 157 bool console_get_kbd_event(console_ctrl_t *ctrl, kbd_event_t *event) 152 async_req_2_0(exch, CONSOLE_SET_POS, col, row); 153 async_exchange_end(exch); 154 } 155 156 static int console_ev_decode(ipc_call_t *call, cons_event_t *event) 157 { 158 event->type = IPC_GET_ARG1(*call); 159 160 switch (event->type) { 161 case CEV_KEY: 162 event->ev.key.type = IPC_GET_ARG2(*call); 163 event->ev.key.key = IPC_GET_ARG3(*call); 164 event->ev.key.mods = IPC_GET_ARG4(*call); 165 event->ev.key.c = IPC_GET_ARG5(*call); 166 break; 167 case CEV_POS: 168 event->ev.pos.pos_id = IPC_GET_ARG2(*call) >> 16; 169 event->ev.pos.type = IPC_GET_ARG2(*call) & 0xffff; 170 event->ev.pos.btn_num = IPC_GET_ARG3(*call); 171 event->ev.pos.hpos = IPC_GET_ARG4(*call); 172 event->ev.pos.vpos = IPC_GET_ARG5(*call); 173 break; 174 default: 175 return EIO; 176 } 177 178 return EOK; 179 } 180 181 bool console_get_event(console_ctrl_t *ctrl, cons_event_t *event) 158 182 { 159 183 if (ctrl->input_aid == 0) { 160 sysarg_t type; 161 sysarg_t key; 162 sysarg_t mods; 163 sysarg_t c; 184 ipc_call_t result; 164 185 165 186 async_exch_t *exch = async_exchange_begin(ctrl->input_sess); 166 int rc = async_req_0_4(exch, CONSOLE_GET_EVENT, &type, &key, &mods, &c);187 aid_t aid = async_send_0(exch, CONSOLE_GET_EVENT, &result); 167 188 async_exchange_end(exch); 189 190 sysarg_t rc; 191 async_wait_for(aid, &rc); 168 192 169 193 if (rc != EOK) { … … 172 196 } 173 197 174 event->type = type; 175 event->key = key; 176 event->mods = mods; 177 event->c = c; 198 rc = console_ev_decode(&result, event); 199 if (rc != EOK) { 200 errno = rc; 201 return false; 202 } 178 203 } else { 179 204 sysarg_t retval; … … 187 212 } 188 213 189 event->type = IPC_GET_ARG1(ctrl->input_call); 190 event->key = IPC_GET_ARG2(ctrl->input_call); 191 event->mods = IPC_GET_ARG3(ctrl->input_call); 192 event->c = IPC_GET_ARG4(ctrl->input_call); 214 int rc = console_ev_decode(&ctrl->input_call, event); 215 if (rc != EOK) { 216 errno = rc; 217 return false; 218 } 193 219 } 194 220 … … 196 222 } 197 223 198 bool console_get_ kbd_event_timeout(console_ctrl_t *ctrl, kbd_event_t *event,224 bool console_get_event_timeout(console_ctrl_t *ctrl, cons_event_t *event, 199 225 suseconds_t *timeout) 200 226 { … … 224 250 } 225 251 226 event->type = IPC_GET_ARG1(ctrl->input_call); 227 event->key = IPC_GET_ARG2(ctrl->input_call); 228 event->mods = IPC_GET_ARG3(ctrl->input_call); 229 event->c = IPC_GET_ARG4(ctrl->input_call); 252 rc = console_ev_decode(&ctrl->input_call, event); 253 if (rc != EOK) { 254 errno = rc; 255 return false; 256 } 230 257 231 258 /* Update timeout */
Note:
See TracChangeset
for help on using the changeset viewer.