Changeset b48e680f in mainline for uspace/lib/c
- Timestamp:
- 2021-11-03T10:23:28Z (4 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ec8a1bf
- Parents:
- ce862ac
- git-author:
- Jiri Svoboda <jiri@…> (2021-11-02 19:19:50)
- git-committer:
- Jiri Svoboda <jiri@…> (2021-11-03 10:23:28)
- Location:
- uspace/lib/c
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/con_srv.c
rce862ac rb48e680f 281 281 } 282 282 283 static void con_set_caption_srv(con_srv_t *srv, ipc_call_t *icall) 284 { 285 char *caption; 286 errno_t rc; 287 288 rc = async_data_write_accept((void **) &caption, true, 0, 289 CON_CAPTION_MAXLEN, 0, NULL); 290 if (rc != EOK) { 291 async_answer_0(icall, rc); 292 return; 293 } 294 295 if (srv->srvs->ops->set_caption == NULL) { 296 async_answer_0(icall, ENOTSUP); 297 return; 298 } 299 300 srv->srvs->ops->set_caption(srv, caption); 301 free(caption); 302 async_answer_0(icall, EOK); 303 } 304 283 305 static void con_get_event_srv(con_srv_t *srv, ipc_call_t *icall) 284 306 { … … 488 510 con_set_cursor_visibility_srv(srv, &call); 489 511 break; 512 case CONSOLE_SET_CAPTION: 513 con_set_caption_srv(srv, &call); 514 break; 490 515 case CONSOLE_GET_EVENT: 491 516 con_get_event_srv(srv, &call); -
uspace/lib/c/generic/io/console.c
rce862ac rb48e680f 40 40 #include <errno.h> 41 41 #include <stdlib.h> 42 #include <str.h> 42 43 #include <vfs/vfs_sess.h> 43 44 #include <io/console.h> … … 128 129 async_req_1_0(exch, CONSOLE_SET_CURSOR_VISIBILITY, (show != false)); 129 130 async_exchange_end(exch); 131 } 132 133 /** Set console caption. 134 * 135 * Set caption text for the console (if the console suports captions). 136 * 137 * @param ctrl Console 138 * @param caption Caption text 139 * @return EOK on success or an error code 140 */ 141 errno_t console_set_caption(console_ctrl_t *ctrl, const char *caption) 142 { 143 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 144 ipc_call_t answer; 145 aid_t req = async_send_0(exch, CONSOLE_SET_CAPTION, &answer); 146 errno_t retval = async_data_write_start(exch, caption, str_size(caption)); 147 148 if (retval != EOK) { 149 async_forget(req); 150 async_exchange_end(exch); 151 return retval; 152 } 153 154 async_wait_for(req, &retval); 155 async_exchange_end(exch); 156 return EOK; 130 157 } 131 158 -
uspace/lib/c/include/io/con_srv.h
rce862ac rb48e680f 51 51 typedef struct con_ops con_ops_t; 52 52 53 #define CON_CAPTION_MAXLEN 255 54 53 55 /** Service setup (per sevice) */ 54 56 typedef struct { … … 83 85 void (*set_rgb_color)(con_srv_t *, pixel_t, pixel_t); 84 86 void (*set_cursor_visibility)(con_srv_t *, bool); 87 errno_t (*set_caption)(con_srv_t *, const char *); 85 88 errno_t (*get_event)(con_srv_t *, cons_event_t *); 86 89 errno_t (*map)(con_srv_t *, sysarg_t, sysarg_t, charfield_t **); -
uspace/lib/c/include/io/console.h
rce862ac rb48e680f 83 83 84 84 extern void console_cursor_visibility(console_ctrl_t *, bool); 85 extern errno_t console_set_caption(console_ctrl_t *, const char *); 85 86 extern errno_t console_get_color_cap(console_ctrl_t *, sysarg_t *); 86 87 extern errno_t console_get_event(console_ctrl_t *, cons_event_t *); -
uspace/lib/c/include/ipc/console.h
rce862ac rb48e680f 50 50 CONSOLE_SET_RGB_COLOR, 51 51 CONSOLE_SET_CURSOR_VISIBILITY, 52 CONSOLE_SET_CAPTION, 52 53 CONSOLE_MAP, 53 54 CONSOLE_UNMAP,
Note:
See TracChangeset
for help on using the changeset viewer.