Subversion Repositories HelenOS-historic

Rev

Rev 1518 | Rev 1521 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1518 Rev 1520
Line 169... Line 169...
169
            return;
169
            return;
170
        case KBD_PUSHCHAR:
170
        case KBD_PUSHCHAR:
171
            /* got key from keyboard driver */
171
            /* got key from keyboard driver */
172
           
172
           
173
            retval = 0;
173
            retval = 0;
174
            c = IPC_GET_ARG1(call) - '0';
174
            c = IPC_GET_ARG1(call);
175
            /* switch to another virtual console */
175
            /* switch to another virtual console */
176
           
176
           
177
            conn = &connections[active_console];
177
            conn = &connections[active_console];
178
//          if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 + CONSOLE_COUNT)) {
178
//          if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 + CONSOLE_COUNT)) {
179
            if ((c >= 0) && (c < CONSOLE_COUNT)) {
179
            if ((c >= '0') && (c < '0' + CONSOLE_COUNT)) {
180
                /*FIXME: draw another console content from buffer */
-
 
181
                if (c == active_console)
-
 
182
                        break;
-
 
183
               
180
               
184
                if (c == 0) {
181
                if (c == '0') {
185
                    /* switch to kernel console*/
182
                    /* switch to kernel console*/
-
 
183
                    sync_send_2(fb_info.phone, FB_CURSOR_VISIBILITY, 0, 0, NULL, NULL);
-
 
184
                    nsend_call_2(fb_info.phone, FB_SET_STYLE, DEFAULT_FOREGROUND_COLOR, DEFAULT_BACKGROUND_COLOR);
-
 
185
                    nsend_call(fb_info.phone, FB_CLEAR, 0);
-
 
186
                    /* FIXME: restore kernel console */
186
                     __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE);
187
                     __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE);
-
 
188
                     break;
187
                     
189
                     
188
                } else {
190
                } else {
-
 
191
                    c = c - '1';
-
 
192
                    if (c == active_console)
-
 
193
                        break;
189
                    active_console = c;
194
                    active_console = c;
190
                }
195
                }
191
               
196
               
192
               
-
 
193
                conn = &connections[active_console];
197
                conn = &connections[active_console];
194
 
198
 
195
                nsend_call(fb_info.phone, FB_CURSOR_VISIBILITY, 0);
199
                nsend_call(fb_info.phone, FB_CURSOR_VISIBILITY, 0);
196
       
200
       
197
                if (interbuffer) {
201
                if (interbuffer) {
Line 328... Line 332...
328
        usleep(10000);
332
        usleep(10000);
329
    }
333
    }
330
   
334
   
331
    ipc_call_sync_2(fb_info.phone, FB_GET_CSIZE, 0, 0, &(fb_info.rows), &(fb_info.cols));
335
    ipc_call_sync_2(fb_info.phone, FB_GET_CSIZE, 0, 0, &(fb_info.rows), &(fb_info.cols));
332
    nsend_call_2(fb_info.phone, FB_SET_STYLE, DEFAULT_FOREGROUND_COLOR, DEFAULT_BACKGROUND_COLOR);
336
    nsend_call_2(fb_info.phone, FB_SET_STYLE, DEFAULT_FOREGROUND_COLOR, DEFAULT_BACKGROUND_COLOR);
333
    nsend_call(fb_info.phone, FB_CURSOR_VISIBILITY, 1);
337
    nsend_call(fb_info.phone, FB_CLEAR, 0);
334
   
338
   
335
    /* Init virtual consoles */
339
    /* Init virtual consoles */
336
    for (i = 0; i < CONSOLE_COUNT; i++) {
340
    for (i = 0; i < CONSOLE_COUNT; i++) {
337
        connections[i].used = 0;
341
        connections[i].used = 0;
338
        keybuffer_init(&(connections[i].keybuffer));
342
        keybuffer_init(&(connections[i].keybuffer));
Line 347... Line 351...
347
        }
351
        }
348
    }
352
    }
349
   
353
   
350
    if ((interbuffer = mmap(NULL, sizeof(keyfield_t) * fb_info.cols * fb_info.rows , PROTO_READ|PROTO_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, 0 ,0 )) != NULL) {
354
    if ((interbuffer = mmap(NULL, sizeof(keyfield_t) * fb_info.cols * fb_info.rows , PROTO_READ|PROTO_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, 0 ,0 )) != NULL) {
351
        if (ipc_call_sync_3(fb_info.phone, IPC_M_AS_AREA_SEND, (ipcarg_t)interbuffer, 0, AS_AREA_READ | AS_AREA_CACHEABLE, NULL, NULL, NULL) != 0) {
355
        if (ipc_call_sync_3(fb_info.phone, IPC_M_AS_AREA_SEND, (ipcarg_t)interbuffer, 0, AS_AREA_READ | AS_AREA_CACHEABLE, NULL, NULL, NULL) != 0) {
352
//          ipc_call_async_3(fb_info.phone, FB_PUTCHAR, '?', 10, 10, NULL, NULL);
-
 
353
            munmap(interbuffer, sizeof(keyfield_t) * fb_info.cols * fb_info.rows);
356
            munmap(interbuffer, sizeof(keyfield_t) * fb_info.cols * fb_info.rows);
354
            interbuffer = NULL;
357
            interbuffer = NULL;
355
        }
358
        }
356
/*  } else {
-
 
357
        ipc_call_async_3(fb_info.phone, FB_PUTCHAR, '!', 10, 10, NULL, NULL);
-
 
358
*/
-
 
359
    }
359
    }
-
 
360
 
-
 
361
    /* FIXME: save kernel console screen */
360
   
362
   
361
    async_new_connection(phonehash, 0, NULL, keyboard_events);
363
    async_new_connection(phonehash, 0, NULL, keyboard_events);
362
   
364
   
363
    nsend_call_2(fb_info.phone, FB_CURSOR_GOTO, 0, 0);
365
    nsend_call_2(fb_info.phone, FB_CURSOR_GOTO, 0, 0);
-
 
366
    nsend_call(fb_info.phone, FB_CURSOR_VISIBILITY, 1);
364
 
367
 
365
    /* Register at NS */
368
    /* Register at NS */
366
    if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, &phonehash) != 0) {
369
    if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, &phonehash) != 0) {
367
        return -1;
370
        return -1;
368
    };
371
    };
369
   
372
   
370
    async_manager();
373
    async_manager();
371
 
374
 
372
    return 0;  
375
    return 0;  
373
}
376
}
-
 
377