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

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

Keyboard driver overhaul — organize by hardware structure. This is w.i.p. Modifier keys, as well as ppc32, ia64 and sparc64 will not work yet.

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