Changeset a35b458 in mainline for uspace/lib/c/generic/io/console.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/console.c
r3061bc1 ra35b458 48 48 if (!ctrl) 49 49 return NULL; 50 50 51 51 ctrl->input_sess = vfs_fsession(ifile, INTERFACE_CONSOLE); 52 52 if (!ctrl->input_sess) { … … 54 54 return NULL; 55 55 } 56 56 57 57 ctrl->output_sess = vfs_fsession(ofile, INTERFACE_CONSOLE); 58 58 if (!ctrl->output_sess) { … … 60 60 return NULL; 61 61 } 62 62 63 63 ctrl->input = ifile; 64 64 ctrl->output = ofile; 65 65 ctrl->input_aid = 0; 66 66 67 67 return ctrl; 68 68 } … … 95 95 errno_t rc = async_req_0_2(exch, CONSOLE_GET_SIZE, cols, rows); 96 96 async_exchange_end(exch); 97 97 98 98 return rc; 99 99 } … … 134 134 errno_t rc = async_req_0_1(exch, CONSOLE_GET_COLOR_CAP, ccap); 135 135 async_exchange_end(exch); 136 136 137 137 return rc; 138 138 } … … 143 143 errno_t rc = async_req_0_2(exch, CONSOLE_GET_POS, col, row); 144 144 async_exchange_end(exch); 145 145 146 146 return rc; 147 147 } … … 183 183 if (ctrl->input_aid == 0) { 184 184 ipc_call_t result; 185 185 186 186 async_exch_t *exch = async_exchange_begin(ctrl->input_sess); 187 187 aid_t aid = async_send_0(exch, CONSOLE_GET_EVENT, &result); 188 188 async_exchange_end(exch); 189 189 190 190 errno_t rc; 191 191 async_wait_for(aid, &rc); 192 192 193 193 if (rc != EOK) { 194 194 errno = rc; 195 195 return false; 196 196 } 197 197 198 198 rc = console_ev_decode(&result, event); 199 199 if (rc != EOK) { … … 204 204 errno_t retval; 205 205 async_wait_for(ctrl->input_aid, &retval); 206 206 207 207 ctrl->input_aid = 0; 208 208 209 209 if (retval != EOK) { 210 210 errno = retval; 211 211 return false; 212 212 } 213 213 214 214 errno_t rc = console_ev_decode(&ctrl->input_call, event); 215 215 if (rc != EOK) { … … 218 218 } 219 219 } 220 220 221 221 return true; 222 222 } … … 227 227 struct timeval t0; 228 228 gettimeofday(&t0, NULL); 229 229 230 230 if (ctrl->input_aid == 0) { 231 231 async_exch_t *exch = async_exchange_begin(ctrl->input_sess); … … 234 234 async_exchange_end(exch); 235 235 } 236 236 237 237 errno_t retval; 238 238 errno_t rc = async_wait_timeout(ctrl->input_aid, &retval, *timeout); … … 242 242 return false; 243 243 } 244 244 245 245 ctrl->input_aid = 0; 246 246 247 247 if (retval != EOK) { 248 248 errno = retval; 249 249 return false; 250 250 } 251 251 252 252 rc = console_ev_decode(&ctrl->input_call, event); 253 253 if (rc != EOK) { … … 255 255 return false; 256 256 } 257 257 258 258 /* Update timeout */ 259 259 struct timeval t1; 260 260 gettimeofday(&t1, NULL); 261 261 *timeout -= tv_sub_diff(&t1, &t0); 262 262 263 263 return true; 264 264 }
Note:
See TracChangeset
for help on using the changeset viewer.