Changeset 593e023 in mainline
- Timestamp:
- 2014-08-12T17:14:32Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c3bdc92
- Parents:
- ce3efa0
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/cmd.c
rce3efa0 r593e023 1357 1357 printf("The kernel will now relinquish the console.\n"); 1358 1358 release_console(); 1359 1360 event_notify_0(EVENT_KCONSOLE, false);1361 1359 indev_pop_character(stdin); 1362 1360 -
kernel/generic/src/console/console.c
rce3efa0 r593e023 204 204 void grab_console(void) 205 205 { 206 event_notify_1(EVENT_KCONSOLE, false, true); 206 207 bool prev = console_override; 207 208 … … 221 222 { 222 223 console_override = false; 224 event_notify_1(EVENT_KCONSOLE, false, false); 223 225 } 224 226 -
uspace/app/getterm/getterm.c
rce3efa0 r593e023 42 42 #include <str_error.h> 43 43 #include <errno.h> 44 #include <loc.h> 44 45 #include "version.h" 45 46 #include "welcome.h" … … 49 50 static void usage(void) 50 51 { 51 printf("Usage: %s <terminal> [-w] <command> [<arguments...>]\n", APP_NAME); 52 printf("Usage: %s <terminal> <locfs> [--msg] [--wait] -- " 53 "<command> [<arguments...>]\n", APP_NAME); 54 printf(" <terminal> Terminal device\n"); 55 printf(" <locfs> Mount point of locfs\n"); 56 printf(" --msg Print welcome message\n"); 57 printf(" --wait Wait for the terminal to be ready\n"); 52 58 } 53 59 54 static void reopen(FILE **stream, int fd, const char *path, int flags, const char *mode) 60 static void reopen(FILE **stream, int fd, const char *path, int flags, 61 const char *mode) 55 62 { 56 63 if (fclose(*stream)) … … 76 83 int main(int argc, char *argv[]) 77 84 { 78 int rc;79 task_exit_t texit;80 int retval;81 task_id_t id;82 char *fname, *term;83 char **cmd_args;84 bool print_wmsg;85 86 85 argv++; 87 86 argc--; 87 if (argc < 4) { 88 usage(); 89 return 1; 90 } 91 92 char *term = *argv; 93 argv++; 94 argc--; 95 96 char *locfs = *argv; 97 argv++; 98 argc--; 99 100 bool print_msg = false; 101 bool wait = false; 102 103 while ((argc > 0) && (str_cmp(*argv, "--") != 0)) { 104 if (str_cmp(*argv, "--msg") == 0) { 105 print_msg = true; 106 } else if (str_cmp(*argv, "--wait") == 0) { 107 wait = true; 108 } else { 109 usage(); 110 return 2; 111 } 112 113 argv++; 114 argc--; 115 } 116 88 117 if (argc < 1) { 89 118 usage(); 90 return -1;119 return 3; 91 120 } 92 93 if (str_cmp(*argv, "-w") == 0) { 94 print_wmsg = true; 95 argv++; 96 argc--; 97 } else { 98 print_wmsg = false; 121 122 /* Skip "--" */ 123 argv++; 124 argc--; 125 126 char *cmd = *argv; 127 char **args = argv; 128 129 if (wait) { 130 /* Wait for the terminal service to be ready */ 131 service_id_t service_id; 132 int rc = loc_service_get_id(term, &service_id, IPC_FLAG_BLOCKING); 133 if (rc != EOK) { 134 printf("%s: Error waiting on %s (%s)\n", APP_NAME, term, 135 str_error(rc)); 136 return rc; 137 } 99 138 } 100 101 if (argc < 2) {102 usage();103 return -1;104 }105 106 term = *argv++;107 fname = *argv;108 cmd_args = argv;109 139 110 reopen(&stdin, 0, term, O_RDONLY, "r"); 111 reopen(&stdout, 1, term, O_WRONLY, "w"); 112 reopen(&stderr, 2, term, O_WRONLY, "w"); 140 char term_node[LOC_NAME_MAXLEN]; 141 snprintf(term_node, LOC_NAME_MAXLEN, "%s/%s", locfs, term); 142 143 reopen(&stdin, 0, term_node, O_RDONLY, "r"); 144 reopen(&stdout, 1, term_node, O_WRONLY, "w"); 145 reopen(&stderr, 2, term_node, O_WRONLY, "w"); 113 146 114 147 if (stdin == NULL) 115 return -2;148 return 4; 116 149 117 150 if (stdout == NULL) 118 return -3;151 return 5; 119 152 120 153 if (stderr == NULL) 121 return -4;154 return 6; 122 155 123 156 /* … … 128 161 129 162 version_print(term); 130 if (print_ wmsg)163 if (print_msg) 131 164 welcome_msg_print(); 132 133 rc = task_spawnv(&id, fname, (const char * const *) cmd_args); 165 166 task_id_t id; 167 168 int rc = task_spawnv(&id, cmd, (const char * const *) args); 134 169 if (rc != EOK) { 135 printf("%s: Error spawning %s (%s)\n", APP_NAME, fname,170 printf("%s: Error spawning %s (%s)\n", APP_NAME, cmd, 136 171 str_error(rc)); 137 return -5;172 return rc; 138 173 } 139 174 175 task_exit_t texit; 176 int retval; 140 177 rc = task_wait(id, &texit, &retval); 141 178 if (rc != EOK) { 142 printf("%s: Error waiting for %s (%s)\n", APP_NAME, fname,179 printf("%s: Error waiting for %s (%s)\n", APP_NAME, cmd, 143 180 str_error(rc)); 144 return -6;181 return rc; 145 182 } 146 183 147 184 return 0; 148 185 } -
uspace/app/init/init.c
rce3efa0 r593e023 272 272 } 273 273 274 static void getterm(const char *svc, const char *app, bool wmsg) 275 { 276 char term[LOC_NAME_MAXLEN]; 277 snprintf(term, LOC_NAME_MAXLEN, "%s/%s", LOCFS_MOUNT_POINT, svc); 278 279 printf("%s: Spawning %s %s %s\n", NAME, APP_GETTERM, term, app); 280 281 /* Wait for the terminal service to be ready */ 282 service_id_t service_id; 283 int rc = loc_service_get_id(svc, &service_id, IPC_FLAG_BLOCKING); 284 if (rc != EOK) { 285 printf("%s: Error waiting on %s (%s)\n", NAME, term, 286 str_error(rc)); 287 return; 288 } 289 290 if (wmsg) { 291 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, "-w", term, 292 app, NULL); 293 if (rc != EOK) { 294 printf("%s: Error spawning %s -w %s %s (%s)\n", NAME, 295 APP_GETTERM, term, app, str_error(rc)); 296 } 274 static void getterm(const char *svc, const char *app, bool msg) 275 { 276 if (msg) { 277 printf("%s: Spawning %s %s %s --msg --wait -- %s\n", NAME, 278 APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 279 280 int rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, svc, 281 LOCFS_MOUNT_POINT, "--msg", "--wait", "--", app, NULL); 282 if (rc != EOK) 283 printf("%s: Error spawning %s %s %s --msg --wait -- %s\n", 284 NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 297 285 } else { 298 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, term, app, 299 NULL); 300 if (rc != EOK) { 301 printf("%s: Error spawning %s %s %s (%s)\n", NAME, 302 APP_GETTERM, term, app, str_error(rc)); 303 } 286 printf("%s: Spawning %s %s %s --wait -- %s\n", NAME, 287 APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 288 289 int rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, svc, 290 LOCFS_MOUNT_POINT, "--wait", "--", app, NULL); 291 if (rc != EOK) 292 printf("%s: Error spawning %s %s %s --wait -- %s\n", 293 NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 304 294 } 305 295 } … … 364 354 gui_start("/app/vlaunch", HID_COMPOSITOR_SERVER); 365 355 gui_start("/app/vterm", HID_COMPOSITOR_SERVER); 366 } else { 367 rc = console(HID_INPUT, HID_OUTPUT); 368 if (rc == EOK) { 369 getterm("term/vc0", "/app/bdsh", true); 370 getterm("term/vc1", "/app/bdsh", false); 371 getterm("term/vc2", "/app/bdsh", false); 372 getterm("term/vc3", "/app/bdsh", false); 373 getterm("term/vc4", "/app/bdsh", false); 374 getterm("term/vc5", "/app/bdsh", false); 375 getterm("term/vc6", "/app/klog", false); 376 } 356 } 357 358 rc = console(HID_INPUT, HID_OUTPUT); 359 if (rc == EOK) { 360 getterm("term/vc0", "/app/bdsh", true); 361 getterm("term/vc1", "/app/bdsh", false); 362 getterm("term/vc2", "/app/bdsh", false); 363 getterm("term/vc3", "/app/bdsh", false); 364 getterm("term/vc4", "/app/bdsh", false); 365 getterm("term/vc5", "/app/bdsh", false); 377 366 } 378 367 -
uspace/lib/c/generic/io/input.c
rce3efa0 r593e023 80 80 } 81 81 82 int input_ yield(input_t *input)82 int input_activate(input_t *input) 83 83 { 84 84 async_exch_t *exch = async_exchange_begin(input->sess); 85 int rc = async_req_0_0(exch, INPUT_ YIELD);85 int rc = async_req_0_0(exch, INPUT_ACTIVATE); 86 86 async_exchange_end(exch); 87 87 … … 89 89 } 90 90 91 int input_reclaim(input_t *input) 92 { 93 async_exch_t *exch = async_exchange_begin(input->sess); 94 95 int rc = async_req_0_0(exch, INPUT_RECLAIM); 96 async_exchange_end(exch); 97 98 return rc; 91 static void input_ev_active(input_t *input, ipc_callid_t callid, 92 ipc_call_t *call) 93 { 94 int rc = input->ev_ops->active(input); 95 async_answer_0(callid, rc); 96 } 97 98 static void input_ev_deactive(input_t *input, ipc_callid_t callid, 99 ipc_call_t *call) 100 { 101 int rc = input->ev_ops->deactive(input); 102 async_answer_0(callid, rc); 99 103 } 100 104 … … 177 181 178 182 switch (IPC_GET_IMETHOD(call)) { 183 case INPUT_EVENT_ACTIVE: 184 input_ev_active(input, callid, &call); 185 break; 186 case INPUT_EVENT_DEACTIVE: 187 input_ev_deactive(input, callid, &call); 188 break; 179 189 case INPUT_EVENT_KEY: 180 190 input_ev_key(input, callid, &call); -
uspace/lib/c/include/io/input.h
rce3efa0 r593e023 49 49 50 50 typedef struct input_ev_ops { 51 int (*active)(input_t *); 52 int (*deactive)(input_t *); 51 53 int (*key)(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t); 52 54 int (*move)(input_t *, int, int); … … 57 59 extern int input_open(async_sess_t *, input_ev_ops_t *, void *, input_t **); 58 60 extern void input_close(input_t *); 59 extern int input_yield(input_t *); 60 extern int input_reclaim(input_t *); 61 extern int input_activate(input_t *); 61 62 62 63 #endif -
uspace/lib/c/include/ipc/input.h
rce3efa0 r593e023 39 39 40 40 typedef enum { 41 INPUT_YIELD = IPC_FIRST_USER_METHOD, 42 INPUT_RECLAIM 41 INPUT_ACTIVATE = IPC_FIRST_USER_METHOD 43 42 } input_request_t; 44 43 45 44 typedef enum { 46 INPUT_EVENT_KEY = IPC_FIRST_USER_METHOD, 45 INPUT_EVENT_ACTIVE = IPC_FIRST_USER_METHOD, 46 INPUT_EVENT_DEACTIVE, 47 INPUT_EVENT_KEY, 47 48 INPUT_EVENT_MOVE, 48 49 INPUT_EVENT_ABS_MOVE, -
uspace/lib/gui/terminal.c
rce3efa0 r593e023 104 104 static void getterm(const char *svc, const char *app) 105 105 { 106 char term[LOC_NAME_MAXLEN]; 107 snprintf(term, LOC_NAME_MAXLEN, "%s/%s", LOCFS_MOUNT_POINT, svc); 108 109 /* Wait for the terminal service to be ready */ 110 service_id_t service_id; 111 int rc = loc_service_get_id(svc, &service_id, IPC_FLAG_BLOCKING); 112 if (rc != EOK) 113 return; 114 115 task_spawnl(NULL, APP_GETTERM, APP_GETTERM, "-w", term, app, NULL); 106 task_spawnl(NULL, APP_GETTERM, APP_GETTERM, svc, LOCFS_MOUNT_POINT, 107 "--msg", "--wait", "--", app, NULL); 116 108 } 117 109 -
uspace/srv/hid/compositor/compositor.c
rce3efa0 r593e023 56 56 #include <loc.h> 57 57 58 #include <event.h>59 58 #include <io/keycode.h> 60 59 #include <io/mode.h> 61 60 #include <io/visualizer.h> 62 61 #include <io/window.h> 62 #include <io/console.h> 63 63 64 64 #include <transform.h> … … 144 144 /** Input server proxy */ 145 145 static input_t *input; 146 146 static bool active = false; 147 148 static int comp_active(input_t *); 149 static int comp_deactive(input_t *); 147 150 static int comp_key_press(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t); 148 151 static int comp_mouse_move(input_t *, int, int); … … 151 154 152 155 static input_ev_ops_t input_ev_ops = { 156 .active = comp_active, 157 .deactive = comp_deactive, 153 158 .key = comp_key_press, 154 159 .move = comp_mouse_move, … … 156 161 .button = comp_mouse_button 157 162 }; 158 159 static void input_disconnect(void);160 163 161 164 static pointer_t *input_pointer(input_t *input) … … 567 570 568 571 /* Notify visualizers about updated regions. */ 569 list_foreach(viewport_list, link, viewport_t, vp) { 570 sysarg_t x_dmg_vp, y_dmg_vp, w_dmg_vp, h_dmg_vp; 571 surface_get_damaged_region(vp->surface, &x_dmg_vp, &y_dmg_vp, &w_dmg_vp, &h_dmg_vp); 572 surface_reset_damaged_region(vp->surface); 573 visualizer_update_damaged_region( 574 vp->sess, x_dmg_vp, y_dmg_vp, w_dmg_vp, h_dmg_vp, 0, 0); 572 if (active) { 573 list_foreach(viewport_list, link, viewport_t, vp) { 574 sysarg_t x_dmg_vp, y_dmg_vp, w_dmg_vp, h_dmg_vp; 575 surface_get_damaged_region(vp->surface, &x_dmg_vp, &y_dmg_vp, &w_dmg_vp, &h_dmg_vp); 576 surface_reset_damaged_region(vp->surface); 577 visualizer_update_damaged_region(vp->sess, 578 x_dmg_vp, y_dmg_vp, w_dmg_vp, h_dmg_vp, 0, 0); 579 } 575 580 } 576 581 … … 1074 1079 } 1075 1080 1081 #if 0 1082 static void comp_shutdown(void) 1083 { 1084 loc_service_unregister(winreg_id); 1085 input_disconnect(); 1086 1087 /* Close all clients and their windows. */ 1088 fibril_mutex_lock(&window_list_mtx); 1089 list_foreach(window_list, link, window_t, win) { 1090 window_event_t *event = (window_event_t *) malloc(sizeof(window_event_t)); 1091 if (event) { 1092 link_initialize(&event->link); 1093 event->type = WINDOW_CLOSE; 1094 prodcons_produce(&win->queue, &event->link); 1095 } 1096 } 1097 fibril_mutex_unlock(&window_list_mtx); 1098 1099 async_answer_0(iid, EOK); 1100 1101 /* All fibrils of the compositor will terminate soon. */ 1102 } 1103 #endif 1104 1076 1105 static void comp_visualizer_disconnect(viewport_t *vp, ipc_callid_t iid, ipc_call_t *icall) 1077 1106 { … … 1082 1111 viewport_destroy(vp); 1083 1112 1084 /* Terminate compositor if there are no more viewports. */ 1085 if (list_empty(&viewport_list)) { 1086 fibril_mutex_unlock(&viewport_list_mtx); 1087 loc_service_unregister(winreg_id); 1088 input_disconnect(); 1089 1090 /* Close all clients and their windows. */ 1091 fibril_mutex_lock(&window_list_mtx); 1092 list_foreach(window_list, link, window_t, win) { 1093 window_event_t *event = (window_event_t *) malloc(sizeof(window_event_t)); 1094 if (event) { 1095 link_initialize(&event->link); 1096 event->type = WINDOW_CLOSE; 1097 prodcons_produce(&win->queue, &event->link); 1098 } 1099 } 1100 fibril_mutex_unlock(&window_list_mtx); 1101 1102 async_answer_0(iid, EOK); 1103 1104 /* All fibrils of the compositor will terminate soon. */ 1105 } else { 1106 fibril_mutex_unlock(&viewport_list_mtx); 1107 async_answer_0(iid, EOK); 1108 1109 comp_restrict_pointers(); 1110 comp_damage(0, 0, UINT32_MAX, UINT32_MAX); 1111 } 1113 fibril_mutex_unlock(&viewport_list_mtx); 1114 1115 async_answer_0(iid, EOK); 1116 1117 comp_restrict_pointers(); 1118 comp_damage(0, 0, UINT32_MAX, UINT32_MAX); 1112 1119 } 1113 1120 … … 1780 1787 } 1781 1788 1789 static int comp_active(input_t *input) 1790 { 1791 active = true; 1792 comp_damage(0, 0, UINT32_MAX, UINT32_MAX); 1793 1794 return EOK; 1795 } 1796 1797 static int comp_deactive(input_t *input) 1798 { 1799 active = false; 1800 return EOK; 1801 } 1802 1782 1803 static int comp_key_press(input_t *input, kbd_event_type_t type, keycode_t key, 1783 1804 keymod_t mods, wchar_t c) … … 2068 2089 fibril_mutex_unlock(&viewport_list_mtx); 2069 2090 } else if (kconsole_switch) { 2070 __SYSCALL0(SYS_DEBUG_CONSOLE); 2091 if (console_kcon()) 2092 active = false; 2071 2093 } else { 2072 2094 window_event_t *event = (window_event_t *) malloc(sizeof(window_event_t)); … … 2137 2159 } 2138 2160 2139 static void interrupt_received(ipc_callid_t callid, ipc_call_t *call) 2140 { 2141 comp_damage(0, 0, UINT32_MAX, UINT32_MAX); 2142 } 2143 2144 static int discover_viewports(void) 2145 { 2161 static void discover_viewports(void) 2162 { 2163 fibril_mutex_lock(&discovery_mtx); 2164 2146 2165 /* Create viewports and connect them to visualizers. */ 2147 2166 category_id_t cat_id; 2148 2167 int rc = loc_category_get_id("visualizer", &cat_id, IPC_FLAG_BLOCKING); 2149 if (rc != EOK) { 2150 printf("%s: Failed to get visualizer category.\n", NAME); 2151 return -1; 2152 } 2168 if (rc != EOK) 2169 goto ret; 2153 2170 2154 2171 service_id_t *svcs; 2155 2172 size_t svcs_cnt = 0; 2156 2173 rc = loc_category_get_svcs(cat_id, &svcs, &svcs_cnt); 2157 if (rc != EOK || svcs_cnt == 0) { 2158 printf("%s: Failed to get visualizer category services.\n", NAME); 2159 return -1; 2160 } 2161 2162 fibril_mutex_lock(&viewport_list_mtx); 2174 if (rc != EOK) 2175 goto ret; 2176 2177 fibril_mutex_lock(&viewport_list_mtx); 2163 2178 for (size_t i = 0; i < svcs_cnt; ++i) { 2164 2179 bool exists = false; … … 2179 2194 fibril_mutex_unlock(&viewport_list_mtx); 2180 2195 2181 /* TODO damage only newly added viewports */ 2182 comp_damage(0, 0, UINT32_MAX, UINT32_MAX); 2183 return EOK; 2196 if (!list_empty(&viewport_list)) 2197 input_activate(input); 2198 2199 ret: 2200 fibril_mutex_unlock(&discovery_mtx); 2184 2201 } 2185 2202 2186 2203 static void category_change_cb(void) 2187 2204 { 2188 fibril_mutex_lock(&discovery_mtx);2189 2205 discover_viewports(); 2190 fibril_mutex_unlock(&discovery_mtx);2191 2206 } 2192 2207 … … 2206 2221 printf("%s: Unable to register server (%s)\n", NAME, str_error(rc)); 2207 2222 return -1; 2208 }2209 2210 /* Register interrupt handler to switch back from kconsole. */2211 async_set_interrupt_received(interrupt_received);2212 rc = event_subscribe(EVENT_KCONSOLE, 0);2213 if (rc != EOK) {2214 printf("%s: Failed to register kconsole notifications (%s)\n",2215 NAME, str_error(rc));2216 2223 } 2217 2224 … … 2248 2255 input_disconnect(); 2249 2256 return rc; 2250 } 2251 2252 rc = discover_viewports(); 2253 if (rc != EOK) { 2254 input_disconnect(); 2255 return rc; 2256 } 2257 2258 if (list_empty(&viewport_list)) { 2259 printf("%s: Failed to get viewports.\n", NAME); 2260 input_disconnect(); 2261 return -1; 2262 } 2257 } 2258 2259 discover_viewports(); 2263 2260 2264 2261 comp_restrict_pointers(); -
uspace/srv/hid/console/console.c
rce3efa0 r593e023 41 41 #include <str_error.h> 42 42 #include <loc.h> 43 #include <event.h>44 43 #include <io/con_srv.h> 45 44 #include <io/kbd_event.h> … … 84 83 /** Input server proxy */ 85 84 static input_t *input; 85 static bool active = false; 86 86 87 87 /** Session to the output server */ … … 98 98 static FIBRIL_MUTEX_INITIALIZE(switch_mtx); 99 99 100 static console_t *prev_console = &consoles[0];101 100 static console_t *active_console = &consoles[0]; 102 static console_t *kernel_console = &consoles[KERNEL_CONSOLE]; 103 101 102 static int input_ev_active(input_t *); 103 static int input_ev_deactive(input_t *); 104 104 static int input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t); 105 105 static int input_ev_move(input_t *, int, int); … … 108 108 109 109 static input_ev_ops_t input_ev_ops = { 110 .active = input_ev_active, 111 .deactive = input_ev_deactive, 110 112 .key = input_ev_key, 111 113 .move = input_ev_move, … … 159 161 fibril_mutex_lock(&cons->mtx); 160 162 161 if (( cons == active_console) && (active_console != kernel_console)) {163 if ((active) && (cons == active_console)) { 162 164 output_update(output_sess, cons->fbid); 163 165 output_cursor_update(output_sess, cons->fbid); … … 173 175 fibril_mutex_lock(&cons->mtx); 174 176 175 if (( cons == active_console) && (active_console != kernel_console))177 if ((active) && (cons == active_console)) 176 178 output_cursor_update(output_sess, cons->fbid); 177 179 … … 185 187 fibril_mutex_lock(&cons->mtx); 186 188 187 if (( cons == active_console) && (active_console != kernel_console)) {189 if ((active) && (cons == active_console)) { 188 190 output_damage(output_sess, cons->fbid, 0, 0, cons->cols, 189 191 cons->rows); … … 195 197 } 196 198 197 static void cons_switch(console_t *cons) 198 { 199 static void cons_switch(unsigned int index) 200 { 201 /* 202 * The first undefined index is reserved 203 * for switching to the kernel console. 204 */ 205 if (index == CONSOLE_COUNT) { 206 if (console_kcon()) 207 active = false; 208 209 return; 210 } 211 212 if (index > CONSOLE_COUNT) 213 return; 214 215 console_t *cons = &consoles[index]; 216 199 217 fibril_mutex_lock(&switch_mtx); 200 218 … … 204 222 } 205 223 206 if (cons == kernel_console) {207 output_yield(output_sess);208 if (!console_kcon()) {209 output_claim(output_sess);210 fibril_mutex_unlock(&switch_mtx);211 return;212 }213 }214 215 if (active_console == kernel_console)216 output_claim(output_sess);217 218 prev_console = active_console;219 224 active_console = cons; 220 225 … … 224 229 } 225 230 226 static console_t *cons_get_active_uspace(void) 227 { 228 fibril_mutex_lock(&switch_mtx); 229 230 console_t *active_uspace = active_console; 231 if (active_uspace == kernel_console) 232 active_uspace = prev_console; 233 234 assert(active_uspace != kernel_console); 235 236 fibril_mutex_unlock(&switch_mtx); 237 238 return active_uspace; 231 static int input_ev_active(input_t *input) 232 { 233 active = true; 234 output_claim(output_sess); 235 cons_damage(active_console); 236 237 return EOK; 238 } 239 240 static int input_ev_deactive(input_t *input) 241 { 242 active = false; 243 output_yield(output_sess); 244 245 return EOK; 239 246 } 240 247 … … 242 249 keymod_t mods, wchar_t c) 243 250 { 244 if ((key >= KC_F1) && (key < KC_F1 + CONSOLE_COUNT) &&251 if ((key >= KC_F1) && (key <= KC_F1 + CONSOLE_COUNT) && 245 252 ((mods & KM_CTRL) == 0)) { 246 cons_switch( &consoles[key - KC_F1]);253 cons_switch(key - KC_F1); 247 254 } else { 248 255 /* Got key press/release event */ … … 259 266 event->c = c; 260 267 261 /* 262 * Kernel console does not read events 263 * from us, so we will redirect them 264 * to the (last) active userspace console 265 * if necessary. 266 */ 267 console_t *target_console = cons_get_active_uspace(); 268 269 prodcons_produce(&target_console->input_pc, 268 prodcons_produce(&active_console->input_pc, 270 269 &event->link); 271 270 } … … 509 508 510 509 for (size_t i = 0; i < CONSOLE_COUNT; i++) { 511 if (i == KERNEL_CONSOLE)512 continue;513 514 510 if (consoles[i].dsid == (service_id_t) IPC_GET_ARG1(*icall)) { 515 511 cons = &consoles[i]; … … 556 552 557 553 return EOK; 558 }559 560 static void interrupt_received(ipc_callid_t callid, ipc_call_t *call)561 {562 cons_switch(prev_console);563 554 } 564 555 … … 609 600 output_get_caps(output_sess, &ccaps); 610 601 611 /* Inititalize consoles */ 612 for (size_t i = 0; i < CONSOLE_COUNT; i++) { 613 consoles[i].index = i; 614 atomic_set(&consoles[i].refcnt, 0); 615 fibril_mutex_initialize(&consoles[i].mtx); 616 prodcons_initialize(&consoles[i].input_pc); 617 consoles[i].char_remains_len = 0; 618 619 if (i == KERNEL_CONSOLE) 620 continue; 621 622 consoles[i].cols = cols; 623 consoles[i].rows = rows; 624 consoles[i].ccaps = ccaps; 625 consoles[i].frontbuf = 626 chargrid_create(cols, rows, CHARGRID_FLAG_SHARED); 627 628 if (consoles[i].frontbuf == NULL) { 629 printf("%s: Unable to allocate frontbuffer %zu\n", NAME, i); 630 return false; 602 /* 603 * Inititalize consoles only if there are 604 * actually some output devices. 605 */ 606 if (ccaps != 0) { 607 for (size_t i = 0; i < CONSOLE_COUNT; i++) { 608 consoles[i].index = i; 609 atomic_set(&consoles[i].refcnt, 0); 610 fibril_mutex_initialize(&consoles[i].mtx); 611 prodcons_initialize(&consoles[i].input_pc); 612 consoles[i].char_remains_len = 0; 613 614 consoles[i].cols = cols; 615 consoles[i].rows = rows; 616 consoles[i].ccaps = ccaps; 617 consoles[i].frontbuf = 618 chargrid_create(cols, rows, CHARGRID_FLAG_SHARED); 619 620 if (consoles[i].frontbuf == NULL) { 621 printf("%s: Unable to allocate frontbuffer %zu\n", NAME, i); 622 return false; 623 } 624 625 consoles[i].fbid = output_frontbuf_create(output_sess, 626 consoles[i].frontbuf); 627 if (consoles[i].fbid == 0) { 628 printf("%s: Unable to create frontbuffer %zu\n", NAME, i); 629 return false; 630 } 631 632 con_srvs_init(&consoles[i].srvs); 633 consoles[i].srvs.ops = &con_ops; 634 consoles[i].srvs.sarg = &consoles[i]; 635 636 char vc[LOC_NAME_MAXLEN + 1]; 637 snprintf(vc, LOC_NAME_MAXLEN, "%s/vc%zu", NAMESPACE, i); 638 639 if (loc_service_register(vc, &consoles[i].dsid) != EOK) { 640 printf("%s: Unable to register device %s\n", NAME, vc); 641 return false; 642 } 631 643 } 632 644 633 consoles[i].fbid = output_frontbuf_create(output_sess, 634 consoles[i].frontbuf); 635 if (consoles[i].fbid == 0) { 636 printf("%s: Unable to create frontbuffer %zu\n", NAME, i); 637 return false; 638 } 639 640 con_srvs_init(&consoles[i].srvs); 641 consoles[i].srvs.ops = &con_ops; 642 consoles[i].srvs.sarg = &consoles[i]; 643 644 char vc[LOC_NAME_MAXLEN + 1]; 645 snprintf(vc, LOC_NAME_MAXLEN, "%s/vc%zu", NAMESPACE, i); 646 647 if (loc_service_register(vc, &consoles[i].dsid) != EOK) { 648 printf("%s: Unable to register device %s\n", NAME, vc); 649 return false; 650 } 651 } 652 653 cons_damage(active_console); 654 655 /* Receive kernel notifications */ 656 async_set_interrupt_received(interrupt_received); 657 rc = event_subscribe(EVENT_KCONSOLE, 0); 658 if (rc != EOK) 659 printf("%s: Failed to register kconsole notifications (%s)\n", 660 NAME, str_error(rc)); 645 input_activate(input); 646 } 661 647 662 648 return true; -
uspace/srv/hid/console/console.h
rce3efa0 r593e023 36 36 #define CONSOLE_CONSOLE_H__ 37 37 38 #define CONSOLE_COUNT 12 39 #define KERNEL_CONSOLE 11 38 #define CONSOLE_COUNT 11 40 39 41 40 #endif -
uspace/srv/hid/input/input.c
rce3efa0 r593e023 54 54 #include <io/keycode.h> 55 55 #include <loc.h> 56 #include <event.h> 57 #include <str_error.h> 56 58 #include "layout.h" 57 59 #include "kbd.h" … … 62 64 #include "input.h" 63 65 66 bool irc_service = false; 67 async_sess_t *irc_sess = NULL; 68 64 69 #define NUM_LAYOUTS 4 65 70 … … 71 76 }; 72 77 73 static void kbd_devs_yield(void); 74 static void kbd_devs_reclaim(void); 75 76 async_sess_t *client_sess = NULL; 78 typedef struct { 79 /** Link into the list of clients */ 80 link_t link; 81 82 /** Indicate whether the client is active */ 83 bool active; 84 85 /** Client callback session */ 86 async_sess_t *sess; 87 } client_t; 88 89 /** List of clients */ 90 static list_t clients; 91 static client_t *active_client = NULL; 77 92 78 93 /** List of keyboard devices */ … … 82 97 static list_t mouse_devs; 83 98 84 bool irc_service = false;85 async_sess_t *irc_sess = NULL;86 87 99 static FIBRIL_MUTEX_INITIALIZE(discovery_lock); 100 101 static void *client_data_create(void) 102 { 103 client_t *client = (client_t *) calloc(1, sizeof(client_t)); 104 if (client == NULL) 105 return NULL; 106 107 link_initialize(&client->link); 108 client->active = false; 109 client->sess = NULL; 110 111 list_append(&client->link, &clients); 112 113 return client; 114 } 115 116 static void client_data_destroy(void *data) 117 { 118 client_t *client = (client_t *) data; 119 120 list_remove(&client->link); 121 free(client); 122 } 88 123 89 124 void kbd_push_data(kbd_dev_t *kdev, sysarg_t data) … … 199 234 ev.c = layout_parse_ev(kdev->active_layout, &ev); 200 235 201 async_exch_t *exch = async_exchange_begin(client_sess); 202 async_msg_4(exch, INPUT_EVENT_KEY, ev.type, ev.key, ev.mods, ev.c); 203 async_exchange_end(exch); 204 } 205 206 /** Mouse pointer has moved. */ 236 list_foreach(clients, link, client_t, client) { 237 if (client->active) { 238 async_exch_t *exch = async_exchange_begin(client->sess); 239 async_msg_4(exch, INPUT_EVENT_KEY, ev.type, ev.key, ev.mods, ev.c); 240 async_exchange_end(exch); 241 } 242 } 243 } 244 245 /** Mouse pointer has moved (relative mode). */ 207 246 void mouse_push_event_move(mouse_dev_t *mdev, int dx, int dy, int dz) 208 247 { 209 async_exch_t *exch = async_exchange_begin(client_sess); 210 if (dx || dy) 211 async_msg_2(exch, INPUT_EVENT_MOVE, dx, dy); 212 if (dz) { 213 // TODO: Implement proper wheel support 214 keycode_t code = dz > 0 ? KC_UP : KC_DOWN; 215 for (int i = 0; i < 3; ++i) { 216 async_msg_4(exch, INPUT_EVENT_KEY, KEY_PRESS, code, 0, 0); 217 } 218 async_msg_4(exch, INPUT_EVENT_KEY, KEY_RELEASE, code, 0, 0); 219 } 220 async_exchange_end(exch); 221 } 222 223 /** Mouse pointer has moved in absolute mode. */ 248 list_foreach(clients, link, client_t, client) { 249 if (client->active) { 250 async_exch_t *exch = async_exchange_begin(client->sess); 251 252 if ((dx) || (dy)) 253 async_msg_2(exch, INPUT_EVENT_MOVE, dx, dy); 254 255 if (dz) { 256 // TODO: Implement proper wheel support 257 keycode_t code = dz > 0 ? KC_UP : KC_DOWN; 258 259 for (unsigned int i = 0; i < 3; i++) 260 async_msg_4(exch, INPUT_EVENT_KEY, KEY_PRESS, code, 0, 0); 261 262 async_msg_4(exch, INPUT_EVENT_KEY, KEY_RELEASE, code, 0, 0); 263 } 264 265 async_exchange_end(exch); 266 } 267 } 268 } 269 270 /** Mouse pointer has moved (absolute mode). */ 224 271 void mouse_push_event_abs_move(mouse_dev_t *mdev, unsigned int x, unsigned int y, 225 272 unsigned int max_x, unsigned int max_y) 226 273 { 227 if (max_x && max_y) { 228 async_exch_t *exch = async_exchange_begin(client_sess); 229 async_msg_4(exch, INPUT_EVENT_ABS_MOVE, x, y, max_x, max_y); 230 async_exchange_end(exch); 274 list_foreach(clients, link, client_t, client) { 275 if (client->active) { 276 if ((max_x) && (max_y)) { 277 async_exch_t *exch = async_exchange_begin(client->sess); 278 async_msg_4(exch, INPUT_EVENT_ABS_MOVE, x, y, max_x, max_y); 279 async_exchange_end(exch); 280 } 281 } 231 282 } 232 283 } … … 235 286 void mouse_push_event_button(mouse_dev_t *mdev, int bnum, int press) 236 287 { 237 async_exch_t *exch = async_exchange_begin(client_sess); 238 async_msg_2(exch, INPUT_EVENT_BUTTON, bnum, press); 239 async_exchange_end(exch); 240 } 241 288 list_foreach(clients, link, client_t, client) { 289 if (client->active) { 290 async_exch_t *exch = async_exchange_begin(client->sess); 291 async_msg_2(exch, INPUT_EVENT_BUTTON, bnum, press); 292 async_exchange_end(exch); 293 } 294 } 295 } 296 297 /** Arbitrate client actiovation */ 298 static void client_arbitration(client_t *req) 299 { 300 /* Mutual exclusion of active clients */ 301 list_foreach(clients, link, client_t, client) 302 client->active = (client == req); 303 304 /* Notify clients about the arbitration */ 305 list_foreach(clients, link, client_t, client) { 306 async_exch_t *exch = async_exchange_begin(client->sess); 307 async_msg_0(exch, client->active ? 308 INPUT_EVENT_ACTIVE : INPUT_EVENT_DEACTIVE); 309 async_exchange_end(exch); 310 } 311 } 312 313 /** New client connection */ 242 314 static void client_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 243 315 { 316 client_t *client = (client_t *) async_get_client_data(); 317 if (client == NULL) { 318 async_answer_0(iid, ENOMEM); 319 return; 320 } 321 244 322 async_answer_0(iid, EOK); 245 323 … … 249 327 250 328 if (!IPC_GET_IMETHOD(call)) { 251 if (client _sess != NULL) {252 async_hangup(client _sess);253 client _sess = NULL;329 if (client->sess != NULL) { 330 async_hangup(client->sess); 331 client->sess = NULL; 254 332 } 255 333 … … 261 339 async_callback_receive_start(EXCHANGE_SERIALIZE, &call); 262 340 if (sess != NULL) { 263 if (client _sess == NULL) {264 client _sess = sess;341 if (client->sess == NULL) { 342 client->sess = sess; 265 343 async_answer_0(callid, EOK); 266 344 } else … … 268 346 } else { 269 347 switch (IPC_GET_IMETHOD(call)) { 270 case INPUT_YIELD: 271 kbd_devs_yield(); 272 async_answer_0(callid, EOK); 273 break; 274 case INPUT_RECLAIM: 275 kbd_devs_reclaim(); 348 case INPUT_ACTIVATE: 349 active_client = client; 350 client_arbitration(client); 276 351 async_answer_0(callid, EOK); 277 352 break; … … 283 358 } 284 359 360 static void kconsole_event_received(ipc_callid_t callid, ipc_call_t *call) 361 { 362 if (IPC_GET_ARG1(*call)) { 363 /* Kernel console activated */ 364 client_arbitration(NULL); 365 } else { 366 /* Kernel console deactivated */ 367 client_arbitration(active_client); 368 } 369 } 370 285 371 static kbd_dev_t *kbd_dev_new(void) 286 372 { … … 292 378 } 293 379 294 link_initialize(&kdev-> kbd_devs);380 link_initialize(&kdev->link); 295 381 296 382 kdev->mods = KM_NUM_LOCK; … … 310 396 } 311 397 312 link_initialize(&mdev-> mouse_devs);398 link_initialize(&mdev->link); 313 399 314 400 return mdev; … … 336 422 } 337 423 338 list_append(&kdev-> kbd_devs, &kbd_devs);424 list_append(&kdev->link, &kbd_devs); 339 425 return; 340 426 … … 364 450 } 365 451 366 list_append(&mdev-> mouse_devs, &mouse_devs);452 list_append(&mdev->link, &mouse_devs); 367 453 return; 368 454 … … 373 459 /** Add new kbdev device. 374 460 * 375 * @param service_id 461 * @param service_id Service ID of the keyboard device 376 462 * 377 463 */ … … 397 483 } 398 484 399 list_append(&kdev-> kbd_devs, &kbd_devs);485 list_append(&kdev->link, &kbd_devs); 400 486 *kdevp = kdev; 401 487 return EOK; … … 410 496 /** Add new mousedev device. 411 497 * 412 * @param service_id 498 * @param service_id Service ID of the mouse device 413 499 * 414 500 */ … … 434 520 } 435 521 436 list_append(&mdev-> mouse_devs, &mouse_devs);522 list_append(&mdev->link, &mouse_devs); 437 523 *mdevp = mdev; 438 524 return EOK; … … 489 575 } 490 576 491 static void kbd_devs_yield(void)492 {493 /* For each keyboard device */494 list_foreach(kbd_devs, kbd_devs, kbd_dev_t, kdev) {495 /* Yield port */496 if (kdev->port_ops != NULL)497 (*kdev->port_ops->yield)();498 }499 }500 501 static void kbd_devs_reclaim(void)502 {503 /* For each keyboard device */504 list_foreach(kbd_devs, kbd_devs, kbd_dev_t, kdev) {505 /* Reclaim port */506 if (kdev->port_ops != NULL)507 (*kdev->port_ops->reclaim)();508 }509 }510 511 577 static int dev_check_new_kbdevs(void) 512 578 { … … 537 603 538 604 /* Determine whether we already know this device. */ 539 list_foreach(kbd_devs, kbd_devs, kbd_dev_t, kdev) {605 list_foreach(kbd_devs, link, kbd_dev_t, kdev) { 540 606 if (kdev->svc_id == svcs[i]) { 541 607 already_known = true; … … 588 654 589 655 /* Determine whether we already know this device. */ 590 list_foreach(mouse_devs, mouse_devs, mouse_dev_t, mdev) {656 list_foreach(mouse_devs, link, mouse_dev_t, mdev) { 591 657 if (mdev->svc_id == svcs[i]) { 592 658 already_known = true; … … 668 734 sysarg_t obio; 669 735 736 list_initialize(&clients); 670 737 list_initialize(&kbd_devs); 671 738 list_initialize(&mouse_devs); … … 687 754 688 755 /* Register driver */ 756 async_set_client_data_constructor(client_data_create); 757 async_set_client_data_destructor(client_data_destroy); 689 758 async_set_client_connection(client_connection); 690 759 … … 701 770 return rc; 702 771 } 772 773 /* Receive kernel notifications */ 774 async_set_interrupt_received(kconsole_event_received); 775 rc = event_subscribe(EVENT_KCONSOLE, 0); 776 if (rc != EOK) 777 printf("%s: Failed to register kconsole notifications (%s)\n", 778 NAME, str_error(rc)); 703 779 704 780 /* Start looking for new input devices */ -
uspace/srv/hid/input/kbd.h
rce3efa0 r593e023 48 48 typedef struct kbd_dev { 49 49 /** Link to kbd_devs list */ 50 link_t kbd_devs;50 link_t link; 51 51 52 52 /** Service ID (only for kbdev devices) */ -
uspace/srv/hid/input/kbd_port.h
rce3efa0 r593e023 44 44 typedef struct kbd_port_ops { 45 45 int (*init)(struct kbd_dev *); 46 void (*yield)(void);47 void (*reclaim)(void);48 46 void (*write)(uint8_t); 49 47 } kbd_port_ops_t; -
uspace/srv/hid/input/mouse.h
rce3efa0 r593e023 46 46 typedef struct mouse_dev { 47 47 /** Link to mouse_devs list */ 48 link_t mouse_devs;48 link_t link; 49 49 50 50 /** Service ID (only for mousedev devices) */ -
uspace/srv/hid/input/mouse_port.h
rce3efa0 r593e023 44 44 typedef struct mouse_port_ops { 45 45 int (*init)(struct mouse_dev *); 46 void (*yield)(void);47 void (*reclaim)(void);48 46 void (*write)(uint8_t); 49 47 } mouse_port_ops_t; -
uspace/srv/hid/input/port/adb.c
rce3efa0 r593e023 49 49 50 50 static int adb_port_init(kbd_dev_t *); 51 static void adb_port_yield(void); 52 static void adb_port_reclaim(void); 53 static void adb_port_write(uint8_t data); 51 static void adb_port_write(uint8_t); 54 52 55 53 kbd_port_ops_t adb_port = { 56 54 .init = adb_port_init, 57 .yield = adb_port_yield,58 .reclaim = adb_port_reclaim,59 55 .write = adb_port_write 60 56 }; … … 95 91 96 92 return EOK; 97 }98 99 static void adb_port_yield(void)100 {101 }102 103 static void adb_port_reclaim(void)104 {105 93 } 106 94 -
uspace/srv/hid/input/port/adb_mouse.c
rce3efa0 r593e023 109 109 } 110 110 111 static void adb_port_yield(void)112 {113 }114 115 static void adb_port_reclaim(void)116 {117 }118 119 111 static void adb_port_write(uint8_t data) 120 112 { … … 123 115 mouse_port_ops_t adb_mouse_port = { 124 116 .init = adb_port_init, 125 .yield = adb_port_yield,126 .reclaim = adb_port_reclaim,127 117 .write = adb_port_write 128 118 }; -
uspace/srv/hid/input/port/chardev.c
rce3efa0 r593e023 47 47 48 48 static int chardev_port_init(kbd_dev_t *); 49 static void chardev_port_yield(void);50 static void chardev_port_reclaim(void);51 49 static void chardev_port_write(uint8_t data); 52 50 53 51 kbd_port_ops_t chardev_port = { 54 52 .init = chardev_port_init, 55 .yield = chardev_port_yield,56 .reclaim = chardev_port_reclaim,57 53 .write = chardev_port_write 58 54 }; … … 115 111 } 116 112 117 static void chardev_port_yield(void)118 {119 }120 121 static void chardev_port_reclaim(void)122 {123 }124 125 113 static void chardev_port_write(uint8_t data) 126 114 { -
uspace/srv/hid/input/port/msim.c
rce3efa0 r593e023 44 44 45 45 static int msim_port_init(kbd_dev_t *); 46 static void msim_port_yield(void);47 static void msim_port_reclaim(void);48 46 static void msim_port_write(uint8_t data); 49 47 50 48 kbd_port_ops_t msim_port = { 51 49 .init = msim_port_init, 52 .yield = msim_port_yield,53 .reclaim = msim_port_reclaim,54 50 .write = msim_port_write 55 51 }; … … 104 100 } 105 101 106 static void msim_port_yield(void)107 {108 }109 110 static void msim_port_reclaim(void)111 {112 }113 114 102 static void msim_port_write(uint8_t data) 115 103 { -
uspace/srv/hid/input/port/niagara.c
rce3efa0 r593e023 48 48 49 49 static int niagara_port_init(kbd_dev_t *); 50 static void niagara_port_yield(void);51 static void niagara_port_reclaim(void);52 50 static void niagara_port_write(uint8_t data); 53 51 54 52 kbd_port_ops_t niagara_port = { 55 53 .init = niagara_port_init, 56 .yield = niagara_port_yield,57 .reclaim = niagara_port_reclaim,58 54 .write = niagara_port_write 59 55 }; … … 79 75 static input_buffer_t input_buffer = (input_buffer_t) AS_AREA_ANY; 80 76 81 static volatile bool polling_disabled = false;82 77 static void niagara_thread_impl(void *arg); 83 78 … … 108 103 109 104 return 0; 110 }111 112 static void niagara_port_yield(void)113 {114 polling_disabled = true;115 }116 117 static void niagara_port_reclaim(void)118 {119 polling_disabled = false;120 105 } 121 106 … … 149 134 150 135 while (1) { 151 if (polling_disabled == false) 152 niagara_key_pressed(); 136 niagara_key_pressed(); 153 137 usleep(POLL_INTERVAL); 154 138 } -
uspace/srv/hid/input/port/ns16550.c
rce3efa0 r593e023 46 46 47 47 static int ns16550_port_init(kbd_dev_t *); 48 static void ns16550_port_yield(void);49 static void ns16550_port_reclaim(void);50 48 static void ns16550_port_write(uint8_t data); 51 49 52 50 kbd_port_ops_t ns16550_port = { 53 51 .init = ns16550_port_init, 54 .yield = ns16550_port_yield,55 .reclaim = ns16550_port_reclaim,56 52 .write = ns16550_port_write 57 53 }; … … 146 142 } 147 143 148 static void ns16550_port_yield(void)149 {150 }151 152 static void ns16550_port_reclaim(void)153 {154 }155 156 144 static void ns16550_port_write(uint8_t data) 157 145 { -
uspace/srv/hid/input/port/pl050.c
rce3efa0 r593e023 46 46 47 47 static int pl050_port_init(kbd_dev_t *); 48 static void pl050_port_yield(void);49 static void pl050_port_reclaim(void);50 48 static void pl050_port_write(uint8_t data); 51 49 52 50 kbd_port_ops_t pl050_port = { 53 51 .init = pl050_port_init, 54 .yield = pl050_port_yield,55 .reclaim = pl050_port_reclaim,56 52 .write = pl050_port_write 57 53 }; … … 129 125 } 130 126 131 static void pl050_port_yield(void)132 {133 }134 135 static void pl050_port_reclaim(void)136 {137 }138 139 127 static void pl050_port_write(uint8_t data) 140 128 { -
uspace/srv/hid/input/port/ski.c
rce3efa0 r593e023 45 45 46 46 static int ski_port_init(kbd_dev_t *); 47 static void ski_port_yield(void);48 static void ski_port_reclaim(void);49 47 static void ski_port_write(uint8_t data); 50 48 51 49 kbd_port_ops_t ski_port = { 52 50 .init = ski_port_init, 53 .yield = ski_port_yield,54 .reclaim = ski_port_reclaim,55 51 .write = ski_port_write 56 52 }; … … 64 60 static void ski_thread_impl(void *arg); 65 61 static int32_t ski_getchar(void); 66 67 static volatile bool polling_disabled = false;68 62 69 63 /** Initialize Ski port driver. */ … … 81 75 82 76 return 0; 83 }84 85 static void ski_port_yield(void)86 {87 polling_disabled = true;88 }89 90 static void ski_port_reclaim(void)91 {92 polling_disabled = false;93 77 } 94 78 -
uspace/srv/hid/remcons/remcons.c
rce3efa0 r593e023 226 226 telnet_user_t *user = arg; 227 227 228 char term[LOC_NAME_MAXLEN];229 snprintf(term, LOC_NAME_MAXLEN, "%s/%s", "/loc", user->service_name);230 231 228 task_id_t task; 232 int rc = task_spawnl(&task, APP_GETTERM, APP_GETTERM, "-w", term, APP_SHELL, NULL); 233 if (rc != EOK) { 234 telnet_user_error(user, "Spawning `%s -w %s %s' failed: %s.", 235 APP_GETTERM, term, APP_SHELL, str_error(rc)); 229 int rc = task_spawnl(&task, APP_GETTERM, APP_GETTERM, user->service_name, 230 "/loc", "--msg", "--", APP_SHELL, NULL); 231 if (rc != EOK) { 232 telnet_user_error(user, "Spawning `%s %s /loc --msg -- %s' " 233 "failed: %s.", APP_GETTERM, user->service_name, APP_SHELL, 234 str_error(rc)); 236 235 fibril_mutex_lock(&user->guard); 237 236 user->task_finished = true;
Note:
See TracChangeset
for help on using the changeset viewer.