source: mainline/uspace/srv/console/console.c@ 7447572

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 7447572 was 7447572, checked in by Jiri Svoboda <jirik.svoboda@…>, 16 years ago

Fix fb-con interbuffer for much faster redraw on a VC switch.

  • Property mode set to 100644
File size: 14.5 KB
RevLine 
[51c1b003]1/*
[df4ed85]2 * Copyright (c) 2006 Josef Cejka
[51c1b003]3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
[ce5bcb4]28
[231a60a]29/** @addtogroup console
[ce5bcb4]30 * @{
31 */
32/** @file
33 */
34
[3209923]35#include <libc.h>
[79460ae]36#include <fb.h>
[51c1b003]37#include <ipc/ipc.h>
[15039b67]38#include <keys.h>
[79460ae]39#include <ipc/fb.h>
[51c1b003]40#include <ipc/services.h>
41#include <errno.h>
[79460ae]42#include <key_buffer.h>
[d3e6935]43#include <ipc/console.h>
[eaf34f7]44#include <unistd.h>
45#include <async.h>
[cf28036c]46#include <libadt/fifo.h>
[3993b3d]47#include <screenbuffer.h>
[2def788]48#include <sys/mman.h>
[271b540]49#include <stdio.h>
[3ad953c]50#include <sysinfo.h>
[79460ae]51
[9805cde]52#include "console.h"
[e1c4849]53#include "gcons.h"
54
[cf28036c]55#define MAX_KEYREQUESTS_BUFFERED 32
[51c1b003]56
[271b540]57#define NAME "console"
[51c1b003]58
[e87e18f]59/** Index of currently used virtual console.
60 */
[390a678]61int active_console = 0;
[3ad953c]62int prev_console = 0;
[eaf34f7]63
[e87e18f]64/** Information about framebuffer
65 */
[3993b3d]66struct {
67 int phone; /**< Framebuffer phone */
[bb51e9a8]68 ipcarg_t rows; /**< Framebuffer rows */
69 ipcarg_t cols; /**< Framebuffer columns */
[3993b3d]70} fb_info;
71
[79460ae]72typedef struct {
[e87e18f]73 keybuffer_t keybuffer; /**< Buffer for incoming keys. */
[00bb6965]74 /** Buffer for unsatisfied request for keys. */
75 FIFO_CREATE_STATIC(keyrequests, ipc_callid_t,
76 MAX_KEYREQUESTS_BUFFERED);
[e87e18f]77 int keyrequest_counter; /**< Number of requests in buffer. */
78 int client_phone; /**< Phone to connected client. */
[00bb6965]79 int used; /**< 1 if this virtual console is
80 * connected to some client.*/
81 screenbuffer_t screenbuffer; /**< Screenbuffer for saving screen
82 * contents and related settings. */
[79460ae]83} connection_t;
84
[00bb6965]85static connection_t connections[CONSOLE_COUNT]; /**< Array of data for virtual
86 * consoles */
87static keyfield_t *interbuffer = NULL; /**< Pointer to memory shared
88 * with framebufer used for
89 * faster virtual console
[c738d65]90 * switching */
[429acb9]91
[bb51e9a8]92
[e87e18f]93/** Find unused virtual console.
94 *
95 */
[d32af35]96static int find_free_connection(void)
[79460ae]97{
[c738d65]98 int i;
[79460ae]99
[c738d65]100 for (i = 0; i < CONSOLE_COUNT; i++) {
[d32af35]101 if (!connections[i].used)
[79460ae]102 return i;
103 }
[d32af35]104 return -1;
[79460ae]105}
106
[429acb9]107static void clrscr(void)
108{
[0cc4313]109 async_msg_0(fb_info.phone, FB_CLEAR);
[429acb9]110}
111
[8c6337d]112static void curs_visibility(bool visible)
[429acb9]113{
[8c6337d]114 async_msg_1(fb_info.phone, FB_CURSOR_VISIBILITY, visible);
115}
116
117static void curs_hide_sync(void)
118{
119 ipc_call_sync_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false);
[429acb9]120}
121
122static void curs_goto(int row, int col)
123{
[085bd54]124 async_msg_2(fb_info.phone, FB_CURSOR_GOTO, row, col);
[429acb9]125}
126
[9805cde]127static void set_style(int style)
[429acb9]128{
[9805cde]129 async_msg_1(fb_info.phone, FB_SET_STYLE, style);
[429acb9]130}
131
[9805cde]132static void set_color(int fgcolor, int bgcolor, int flags)
[429acb9]133{
[9805cde]134 async_msg_3(fb_info.phone, FB_SET_COLOR, fgcolor, bgcolor, flags);
135}
136
137static void set_rgb_color(int fgcolor, int bgcolor)
138{
139 async_msg_2(fb_info.phone, FB_SET_RGB_COLOR, fgcolor, bgcolor);
140}
141
142static void set_attrs(attrs_t *attrs)
143{
144 switch (attrs->t) {
145 case at_style:
146 set_style(attrs->a.s.style);
147 break;
148
149 case at_idx:
150 set_color(attrs->a.i.fg_color, attrs->a.i.bg_color,
151 attrs->a.i.flags);
152 break;
153
154 case at_rgb:
155 set_rgb_color(attrs->a.r.fg_color, attrs->a.r.bg_color);
156 break;
157 }
[429acb9]158}
159
160static void prtchr(char c, int row, int col)
161{
[085bd54]162 async_msg_3(fb_info.phone, FB_PUTCHAR, c, row, col);
[429acb9]163}
164
[10569b1]165/** Check key and process special keys.
166 *
[96858e8]167 *
168 */
[10569b1]169static void write_char(int console, char key)
170{
171 screenbuffer_t *scr = &(connections[console].screenbuffer);
172
173 switch (key) {
[00bb6965]174 case '\n':
[c738d65]175 scr->position_y++;
176 scr->position_x = 0;
[00bb6965]177 break;
178 case '\r':
179 break;
180 case '\t':
181 scr->position_x += 8;
182 scr->position_x -= scr->position_x % 8;
183 break;
184 case '\b':
185 if (scr->position_x == 0)
[10569b1]186 break;
[00bb6965]187 scr->position_x--;
188 if (console == active_console)
189 prtchr(' ', scr->position_y, scr->position_x);
190 screenbuffer_putchar(scr, ' ');
191 break;
192 default:
193 if (console == active_console)
194 prtchr(key, scr->position_y, scr->position_x);
[10569b1]195
[00bb6965]196 screenbuffer_putchar(scr, key);
197 scr->position_x++;
[10569b1]198 }
199
200 scr->position_y += (scr->position_x >= scr->size_x);
201
202 if (scr->position_y >= scr->size_y) {
203 scr->position_y = scr->size_y - 1;
[c891ed39]204 screenbuffer_clear_line(scr, scr->top_line);
[c738d65]205 scr->top_line = (scr->top_line + 1) % scr->size_y;
[b1f51f0]206 if (console == active_console)
[0cc4313]207 async_msg_1(fb_info.phone, FB_SCROLL, 1);
[10569b1]208 }
209
210 scr->position_x = scr->position_x % scr->size_x;
[bd929cfb]211
[429acb9]212 if (console == active_console)
213 curs_goto(scr->position_y, scr->position_x);
[10569b1]214
215}
216
[429acb9]217/** Switch to new console */
218static void change_console(int newcons)
219{
220 connection_t *conn;
[bd02038]221 int i, j, rc;
[6d5005c]222 keyfield_t *field;
[9805cde]223 attrs_t *attrs;
[76fca31]224
[429acb9]225 if (newcons == active_console)
226 return;
[76fca31]227
[a7d2d78]228 if (newcons == KERNEL_CONSOLE) {
[1f83244]229 async_serialize_start();
[8c6337d]230 curs_hide_sync();
[76fca31]231 gcons_in_kernel();
[1f83244]232 async_serialize_end();
[76fca31]233
[3ad953c]234 if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) {
235 prev_console = active_console;
[76fca31]236 active_console = KERNEL_CONSOLE;
[3ad953c]237 } else
[8c6337d]238 newcons = active_console;
[01f5e17]239 }
[6d5005c]240
[76fca31]241 if (newcons != KERNEL_CONSOLE) {
242 async_serialize_start();
243
244 if (active_console == KERNEL_CONSOLE)
245 gcons_redraw_console();
246
247 active_console = newcons;
248 gcons_change_console(newcons);
249 conn = &connections[active_console];
250
[9805cde]251 set_attrs(&conn->screenbuffer.attrs);
[8c6337d]252 curs_visibility(false);
[76fca31]253 if (interbuffer) {
254 for (i = 0; i < conn->screenbuffer.size_x; i++)
255 for (j = 0; j < conn->screenbuffer.size_y; j++) {
256 unsigned int size_x;
257
258 size_x = conn->screenbuffer.size_x;
259 interbuffer[i + j * size_x] =
260 *get_field_at(&conn->screenbuffer, i, j);
261 }
262 /* This call can preempt, but we are already at the end */
[3ad953c]263 rc = async_req_0_0(fb_info.phone, FB_DRAW_TEXT_DATA);
[76fca31]264 }
265
266 if ((!interbuffer) || (rc != 0)) {
[9805cde]267 set_attrs(&conn->screenbuffer.attrs);
[76fca31]268 clrscr();
[9805cde]269 attrs = &conn->screenbuffer.attrs;
[76fca31]270
[3ad953c]271 for (j = 0; j < conn->screenbuffer.size_y; j++)
[76fca31]272 for (i = 0; i < conn->screenbuffer.size_x; i++) {
273 field = get_field_at(&conn->screenbuffer, i, j);
[9805cde]274 if (!attrs_same(*attrs, field->attrs))
275 set_attrs(&field->attrs);
276 attrs = &field->attrs;
[76fca31]277 if ((field->character == ' ') &&
[9805cde]278 (attrs_same(field->attrs,
279 conn->screenbuffer.attrs)))
[76fca31]280 continue;
[9805cde]281
[76fca31]282 prtchr(field->character, j, i);
283 }
284 }
285
286 curs_goto(conn->screenbuffer.position_y,
287 conn->screenbuffer.position_x);
288 curs_visibility(conn->screenbuffer.is_cursor_visible);
289
290 async_serialize_end();
[429acb9]291 }
292}
[10569b1]293
[e87e18f]294/** Handler for keyboard */
[eaf34f7]295static void keyboard_events(ipc_callid_t iid, ipc_call_t *icall)
[51c1b003]296{
[eaf34f7]297 ipc_callid_t callid;
[51c1b003]298 ipc_call_t call;
[eaf34f7]299 int retval;
[dd641e3]300 int c;
[c1d2c9d]301 connection_t *conn;
[1f83244]302 int newcon;
[bb51e9a8]303
[eaf34f7]304 /* Ignore parameters, the connection is alread opened */
305 while (1) {
306 callid = async_get_call(&call);
307 switch (IPC_GET_METHOD(call)) {
308 case IPC_M_PHONE_HUNGUP:
309 /* TODO: Handle hangup */
310 return;
[1f83244]311 case KBD_MS_LEFT:
312 newcon = gcons_mouse_btn(IPC_GET_ARG1(call));
313 if (newcon != -1)
314 change_console(newcon);
[501a8ba]315 retval = 0;
[1f83244]316 break;
[830ac99]317 case KBD_MS_MOVE:
[00bb6965]318 gcons_mouse_move(IPC_GET_ARG1(call),
[01f5e17]319 IPC_GET_ARG2(call));
[501a8ba]320 retval = 0;
[830ac99]321 break;
[eaf34f7]322 case KBD_PUSHCHAR:
323 /* got key from keyboard driver */
324 retval = 0;
[a805c24]325 c = IPC_GET_ARG1(call);
[eaf34f7]326 /* switch to another virtual console */
[cf28036c]327
[c1d2c9d]328 conn = &connections[active_console];
[00bb6965]329/*
330 * if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 +
331 * CONSOLE_COUNT)) {
332 */
[dd641e3]333 if ((c >= 0x101) && (c < 0x101 + CONSOLE_COUNT)) {
334 if (c == 0x112)
[a7d2d78]335 change_console(KERNEL_CONSOLE);
[429acb9]336 else
[dd641e3]337 change_console(c - 0x101);
[eaf34f7]338 break;
339 }
[cf28036c]340
341 /* if client is awaiting key, send it */
[c1d2c9d]342 if (conn->keyrequest_counter > 0) {
343 conn->keyrequest_counter--;
[b74959bd]344 ipc_answer_1(fifo_pop(conn->keyrequests), EOK,
345 c);
[cf28036c]346 break;
347 }
348
[c1d2c9d]349 keybuffer_push(&conn->keybuffer, c);
[501a8ba]350 retval = 0;
[ad123964]351
[eaf34f7]352 break;
353 default:
[1029d3d3]354 retval = ENOENT;
[085bd54]355 }
[b74959bd]356 ipc_answer_0(callid, retval);
[eaf34f7]357 }
358}
359
360/** Default thread for new connections */
[b1f51f0]361static void client_connection(ipc_callid_t iid, ipc_call_t *icall)
[eaf34f7]362{
[51c1b003]363 ipc_callid_t callid;
[eaf34f7]364 ipc_call_t call;
365 int consnum;
[9805cde]366 ipcarg_t arg1, arg2, arg3;
[e9073f2]367 connection_t *conn;
[3ad953c]368
[d32af35]369 if ((consnum = find_free_connection()) == -1) {
[b74959bd]370 ipc_answer_0(iid, ELIMIT);
[eaf34f7]371 return;
372 }
[e9073f2]373 conn = &connections[consnum];
[085bd54]374 conn->used = 1;
[a7d2d78]375
[085bd54]376 async_serialize_start();
[a7d2d78]377 gcons_notify_connect(consnum);
[38c706cc]378 conn->client_phone = IPC_GET_ARG5(*icall);
[e9073f2]379 screenbuffer_clear(&conn->screenbuffer);
[10569b1]380
[eaf34f7]381 /* Accept the connection */
[b74959bd]382 ipc_answer_0(iid, EOK);
[3ad953c]383
[eaf34f7]384 while (1) {
[085bd54]385 async_serialize_end();
[eaf34f7]386 callid = async_get_call(&call);
[085bd54]387 async_serialize_start();
[3ad953c]388
[96858e8]389 arg1 = 0;
390 arg2 = 0;
[eaf34f7]391 switch (IPC_GET_METHOD(call)) {
392 case IPC_M_PHONE_HUNGUP:
[e9073f2]393 gcons_notify_disconnect(consnum);
[085bd54]394
[e9073f2]395 /* Answer all pending requests */
[3ad953c]396 while (conn->keyrequest_counter > 0) {
[e9073f2]397 conn->keyrequest_counter--;
[b74959bd]398 ipc_answer_0(fifo_pop(conn->keyrequests),
399 ENOENT);
[e9073f2]400 break;
401 }
[0d11fc1c]402 conn->used = 0;
[eaf34f7]403 return;
404 case CONSOLE_PUTCHAR:
[10569b1]405 write_char(consnum, IPC_GET_ARG1(call));
[d6cc453]406 gcons_notify_char(consnum);
[ad123964]407 break;
408 case CONSOLE_CLEAR:
[3993b3d]409 /* Send message to fb */
410 if (consnum == active_console) {
[0cc4313]411 async_msg_0(fb_info.phone, FB_CLEAR);
[3993b3d]412 }
413
[e9073f2]414 screenbuffer_clear(&conn->screenbuffer);
[3993b3d]415
[eaf34f7]416 break;
[ad123964]417 case CONSOLE_GOTO:
[00bb6965]418 screenbuffer_goto(&conn->screenbuffer,
[01f5e17]419 IPC_GET_ARG2(call), IPC_GET_ARG1(call));
[6118e5f6]420 if (consnum == active_console)
[00bb6965]421 curs_goto(IPC_GET_ARG1(call),
[01f5e17]422 IPC_GET_ARG2(call));
[ad123964]423 break;
[3756912]424 case CONSOLE_GETSIZE:
[d6cc453]425 arg1 = fb_info.rows;
426 arg2 = fb_info.cols;
[3756912]427 break;
[0c6984e]428 case CONSOLE_FLUSH:
[a3d2939]429 if (consnum == active_console)
[0cc4313]430 async_req_0_0(fb_info.phone, FB_FLUSH);
[a9bd960c]431 break;
432 case CONSOLE_SET_STYLE:
[9805cde]433 arg1 = IPC_GET_ARG1(call);
434 screenbuffer_set_style(&conn->screenbuffer, arg1);
435 if (consnum == active_console)
436 set_style(arg1);
437 break;
438 case CONSOLE_SET_COLOR:
439 arg1 = IPC_GET_ARG1(call);
440 arg2 = IPC_GET_ARG2(call);
441 arg3 = IPC_GET_ARG3(call);
442 screenbuffer_set_color(&conn->screenbuffer, arg1,
443 arg2, arg3);
444 if (consnum == active_console)
445 set_color(arg1, arg2, arg3);
446 break;
447 case CONSOLE_SET_RGB_COLOR:
[a9bd960c]448 arg1 = IPC_GET_ARG1(call);
449 arg2 = IPC_GET_ARG2(call);
[9805cde]450 screenbuffer_set_rgb_color(&conn->screenbuffer, arg1,
[01f5e17]451 arg2);
[a9bd960c]452 if (consnum == active_console)
[9805cde]453 set_rgb_color(arg1, arg2);
[0c6984e]454 break;
[a8b2b5b2]455 case CONSOLE_CURSOR_VISIBILITY:
456 arg1 = IPC_GET_ARG1(call);
[e9073f2]457 conn->screenbuffer.is_cursor_visible = arg1;
[a8b2b5b2]458 if (consnum == active_console)
459 curs_visibility(arg1);
460 break;
[eaf34f7]461 case CONSOLE_GETCHAR:
[e9073f2]462 if (keybuffer_empty(&conn->keybuffer)) {
[cf28036c]463 /* buffer is empty -> store request */
[00bb6965]464 if (conn->keyrequest_counter <
465 MAX_KEYREQUESTS_BUFFERED) {
[e9073f2]466 fifo_push(conn->keyrequests, callid);
467 conn->keyrequest_counter++;
[cf28036c]468 } else {
[00bb6965]469 /*
470 * No key available and too many
471 * requests => fail.
472 */
[b74959bd]473 ipc_answer_0(callid, ELIMIT);
[cf28036c]474 }
475 continue;
[00bb6965]476 }
[18c485a]477 int ch;
478 keybuffer_pop(&conn->keybuffer, &ch);
479 arg1 = ch;
[eaf34f7]480 break;
481 }
[b74959bd]482 ipc_answer_2(callid, EOK, arg1, arg2);
[eaf34f7]483 }
484}
485
[3ad953c]486static void interrupt_received(ipc_callid_t callid, ipc_call_t *call)
487{
488 change_console(prev_console);
489}
490
[eaf34f7]491int main(int argc, char *argv[])
492{
[271b540]493 printf(NAME ": HelenOS Console service\n");
494
[eaf34f7]495 ipcarg_t phonehash;
[501a8ba]496 int kbd_phone;
[7447572]497 size_t ib_size;
[79460ae]498 int i;
[3ad953c]499
[da0c91e7]500 async_set_client_connection(client_connection);
[51c1b003]501
502 /* Connect to keyboard driver */
[3ad953c]503
[b61d47d]504 kbd_phone = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0, 0);
[c738d65]505 while (kbd_phone < 0) {
[eaf34f7]506 usleep(10000);
[b61d47d]507 kbd_phone = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0, 0);
[00bb6965]508 }
[51c1b003]509
[38c706cc]510 if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0)
[51c1b003]511 return -1;
[290c0db]512 async_new_connection(phonehash, 0, NULL, keyboard_events);
513
[51c1b003]514 /* Connect to framebuffer driver */
[b61d47d]515 fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0, 0);
[c738d65]516 while (fb_info.phone < 0) {
[3993b3d]517 usleep(10000);
[b61d47d]518 fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0, 0);
[3993b3d]519 }
[429acb9]520
[e1c4849]521 /* Initialize gcons */
522 gcons_init(fb_info.phone);
523 /* Synchronize, the gcons can have something in queue */
[0cc4313]524 async_req_0_0(fb_info.phone, FB_FLUSH);
[3993b3d]525
[0cc4313]526 async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.rows,
[01f5e17]527 &fb_info.cols);
[9805cde]528 set_rgb_color(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND);
[429acb9]529 clrscr();
[3993b3d]530
531 /* Init virtual consoles */
[79460ae]532 for (i = 0; i < CONSOLE_COUNT; i++) {
533 connections[i].used = 0;
[01f5e17]534 keybuffer_init(&connections[i].keybuffer);
[cf28036c]535
[01f5e17]536 connections[i].keyrequests.head = 0;
537 connections[i].keyrequests.tail = 0;
[cf28036c]538 connections[i].keyrequests.items = MAX_KEYREQUESTS_BUFFERED;
539 connections[i].keyrequest_counter = 0;
[3993b3d]540
[01f5e17]541 if (screenbuffer_init(&connections[i].screenbuffer,
542 fb_info.cols, fb_info.rows) == NULL) {
[c738d65]543 /* FIXME: handle error */
[3993b3d]544 return -1;
545 }
[79460ae]546 }
[d32af35]547 connections[KERNEL_CONSOLE].used = 1;
[7447572]548
549 /* Set up shared memory buffer. */
550 ib_size = sizeof(keyfield_t) * fb_info.cols * fb_info.rows;
551 interbuffer = as_get_mappable_page(ib_size);
552
553 if (as_area_create(interbuffer, ib_size, AS_AREA_READ |
554 AS_AREA_WRITE | AS_AREA_CACHEABLE) != interbuffer) {
555 interbuffer = NULL;
556 }
557
558 if (interbuffer) {
[215e375]559 if (ipc_share_out_start(fb_info.phone, interbuffer,
[27d293a]560 AS_AREA_READ) != EOK) {
[7447572]561 as_area_destroy(interbuffer);
[390a678]562 interbuffer = NULL;
563 }
564 }
[3ad953c]565
[c738d65]566 curs_goto(0, 0);
[01f5e17]567 curs_visibility(
568 connections[active_console].screenbuffer.is_cursor_visible);
[3ad953c]569
[b1f51f0]570 /* Register at NS */
[271b540]571 if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, 0, &phonehash) != 0)
[51c1b003]572 return -1;
573
[3ad953c]574 /* Receive kernel notifications */
575 if (sysinfo_value("kconsole.present")) {
576 int devno = sysinfo_value("kconsole.devno");
577 int inr = sysinfo_value("kconsole.inr");
578 if (ipc_register_irq(inr, devno, 0, NULL) != EOK)
579 printf(NAME ": Error registering kconsole notifications\n");
580
581 async_set_interrupt_received(interrupt_received);
582 }
583
[271b540]584 // FIXME: avoid connectiong to itself, keep using klog
585 // printf(NAME ": Accepting connections\n");
[eaf34f7]586 async_manager();
[3ad953c]587
588 return 0;
[51c1b003]589}
[ce5bcb4]590
591/** @}
592 */
Note: See TracBrowser for help on using the repository browser.