Subversion Repositories HelenOS

Rev

Rev 2025 | Rev 2070 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2025 Rev 2069
Line 95... Line 95...
95
/** Find unused virtual console.
95
/** Find unused virtual console.
96
 *
96
 *
97
 */
97
 */
98
static int find_free_connection(void)
98
static int find_free_connection(void)
99
{
99
{
100
    int i = 0;
100
    int i;
101
   
101
   
102
    for (i=0; i < CONSOLE_COUNT; i++) {
102
    for (i = 0; i < CONSOLE_COUNT; i++) {
103
        if (!connections[i].used)
103
        if (!connections[i].used)
104
            return i;
104
            return i;
105
    }
105
    }
Line 146... Line 146...
146
{
146
{
147
    screenbuffer_t *scr = &(connections[console].screenbuffer);
147
    screenbuffer_t *scr = &(connections[console].screenbuffer);
148
   
148
   
149
    switch (key) {
149
    switch (key) {
150
    case '\n':
150
    case '\n':
151
        scr->position_y += 1;
151
        scr->position_y++;
152
        scr->position_x =  0;
152
        scr->position_x = 0;
153
        break;
153
        break;
154
    case '\r':
154
    case '\r':
155
        break;
155
        break;
156
    case '\t':
156
    case '\t':
Line 261... Line 261...
261
    set_style(&conn->screenbuffer.style);
261
    set_style(&conn->screenbuffer.style);
262
    curs_visibility(0);
262
    curs_visibility(0);
263
    if (interbuffer) {
263
    if (interbuffer) {
264
        for (i = 0; i < conn->screenbuffer.size_x; i++)
264
        for (i = 0; i < conn->screenbuffer.size_x; i++)
265
            for (j = 0; j < conn->screenbuffer.size_y; j++)
265
            for (j = 0; j < conn->screenbuffer.size_y; j++)
266
                interbuffer[i + j * conn->screenbuffer.size_x]
266
                interbuffer[i + j * conn->screenbuffer.size_x] =
267
                    = *get_field_at(&(conn->screenbuffer),
267
                    *get_field_at(&(conn->screenbuffer),
268
                    i, j);
268
                    i, j);
269
        /* This call can preempt, but we are already at the end */
269
        /* This call can preempt, but we are already at the end */
270
        rc = async_req_2(fb_info.phone, FB_DRAW_TEXT_DATA, 0, 0, NULL,
270
        rc = async_req_2(fb_info.phone, FB_DRAW_TEXT_DATA, 0, 0, NULL,
271
            NULL);     
271
            NULL);     
272
    };
272
    };
Line 482... Line 482...
482
 
482
 
483
    async_set_client_connection(client_connection);
483
    async_set_client_connection(client_connection);
484
   
484
   
485
    /* Connect to keyboard driver */
485
    /* Connect to keyboard driver */
486
 
486
 
487
    while ((kbd_phone = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0))
487
    kbd_phone = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0);
488
        < 0) {
488
    while (kbd_phone < 0) {
489
        usleep(10000);
489
        usleep(10000);
-
 
490
        kbd_phone = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0);
490
    }
491
    }
491
   
492
   
492
    if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, &phonehash) != 0)
493
    if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, &phonehash) != 0)
493
        {
-
 
494
        return -1;
494
        return -1;
495
    }
-
 
496
    async_new_connection(phonehash, 0, NULL, keyboard_events);
495
    async_new_connection(phonehash, 0, NULL, keyboard_events);
497
   
496
   
498
    /* Connect to framebuffer driver */
497
    /* Connect to framebuffer driver */
499
   
498
   
500
    while ((fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0))
499
    fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0);
501
        < 0) {
500
    while (fb_info.phone < 0) {
502
        usleep(10000);
501
        usleep(10000);
-
 
502
        fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0);
503
    }
503
    }
504
   
504
   
505
    /* Save old kernel screen */
505
    /* Save old kernel screen */
506
    kernel_pixmap = switch_screens(-1);
506
    kernel_pixmap = switch_screens(-1);
507
 
507
 
Line 533... Line 533...
533
            return -1;
533
            return -1;
534
        }
534
        }
535
    }
535
    }
536
    connections[KERNEL_CONSOLE].used = 1;
536
    connections[KERNEL_CONSOLE].used = 1;
537
   
537
   
-
 
538
    interbuffer = mmap(NULL,
538
    if ((interbuffer = mmap(NULL, sizeof(keyfield_t) * fb_info.cols *
539
        sizeof(keyfield_t) * fb_info.cols * fb_info.rows,
539
        fb_info.rows, PROTO_READ | PROTO_WRITE, MAP_ANONYMOUS |
540
        PROTO_READ | PROTO_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
540
        MAP_PRIVATE, 0, 0)) != NULL) {
541
    if (!interbuffer) {
541
        if (async_req_3(fb_info.phone, IPC_M_AS_AREA_SEND, (ipcarg_t)
542
        if (async_req_3(fb_info.phone, IPC_M_AS_AREA_SEND, (ipcarg_t)
542
            interbuffer, 0, AS_AREA_READ, NULL, NULL, NULL) != 0) {
543
            interbuffer, 0, AS_AREA_READ, NULL, NULL, NULL) != 0) {
543
            munmap(interbuffer, sizeof(keyfield_t) * fb_info.cols
544
            munmap(interbuffer, sizeof(keyfield_t) * fb_info.cols
544
                * fb_info.rows);
545
                * fb_info.rows);
545
            interbuffer = NULL;
546
            interbuffer = NULL;