Changeset 3ad953c in mainline for uspace


Ignore:
Timestamp:
2008-12-30T19:55:10Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f58321c4
Parents:
6b21292
Message:

send notification to uspace console when switching from kernel console

Location:
uspace
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/klog/klog.c

    r6b21292 r3ad953c  
    8787                return -1;
    8888        }
    89 
     89       
     90        int devno = sysinfo_value("klog.devno");
    9091        int inr = sysinfo_value("klog.inr");
    91         int devno = sysinfo_value("klog.devno");
    9292        if (ipc_register_irq(inr, devno, 0, NULL) != EOK) {
    9393                printf(NAME ": Error registering klog notifications\n");
  • uspace/srv/console/console.c

    r6b21292 r3ad953c  
    4949#include <sys/mman.h>
    5050#include <stdio.h>
     51#include <sysinfo.h>
    5152
    5253#include "gcons.h"
     
    5960 */
    6061int active_console = 0;
     62int prev_console = 0;
    6163
    6264/** Information about framebuffer
     
    208210                async_serialize_end();
    209211               
    210                 if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE))
     212                if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) {
     213                        prev_console = active_console;
    211214                        active_console = KERNEL_CONSOLE;
    212                 else
     215                } else
    213216                        newcons = active_console;
    214217        }
     
    236239                                }
    237240                        /* This call can preempt, but we are already at the end */
    238                         rc = async_req_0_0(fb_info.phone, FB_DRAW_TEXT_DATA);           
     241                        rc = async_req_0_0(fb_info.phone, FB_DRAW_TEXT_DATA);
    239242                }
    240243               
     
    244247                        style = &conn->screenbuffer.style;
    245248                       
    246                         for (j = 0; j < conn->screenbuffer.size_y; j++) 
     249                        for (j = 0; j < conn->screenbuffer.size_y; j++)
    247250                                for (i = 0; i < conn->screenbuffer.size_x; i++) {
    248251                                        field = get_field_at(&conn->screenbuffer, i, j);
     
    341344        ipcarg_t arg1, arg2;
    342345        connection_t *conn;
    343 
     346       
    344347        if ((consnum = find_free_connection()) == -1) {
    345348                ipc_answer_0(iid, ELIMIT);
     
    356359        /* Accept the connection */
    357360        ipc_answer_0(iid, EOK);
    358 
     361       
    359362        while (1) {
    360363                async_serialize_end();
    361364                callid = async_get_call(&call);
    362365                async_serialize_start();
    363 
     366               
    364367                arg1 = 0;
    365368                arg2 = 0;
     
    369372                       
    370373                        /* Answer all pending requests */
    371                         while (conn->keyrequest_counter > 0) {         
     374                        while (conn->keyrequest_counter > 0) {
    372375                                conn->keyrequest_counter--;
    373376                                ipc_answer_0(fifo_pop(conn->keyrequests),
     
    444447}
    445448
     449static void interrupt_received(ipc_callid_t callid, ipc_call_t *call)
     450{
     451        change_console(prev_console);
     452}
     453
    446454int main(int argc, char *argv[])
    447455{
     
    451459        int kbd_phone;
    452460        int i;
    453 
     461       
    454462        async_set_client_connection(client_connection);
    455463       
    456464        /* Connect to keyboard driver */
    457 
     465       
    458466        kbd_phone = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0, 0);
    459467        while (kbd_phone < 0) {
     
    512520                }
    513521        }
    514 
     522       
    515523        curs_goto(0, 0);
    516524        curs_visibility(
    517525            connections[active_console].screenbuffer.is_cursor_visible);
    518 
     526       
    519527        /* Register at NS */
    520528        if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, 0, &phonehash) != 0)
    521529                return -1;
    522530       
     531        /* Receive kernel notifications */
     532        if (sysinfo_value("kconsole.present")) {
     533                int devno = sysinfo_value("kconsole.devno");
     534                int inr = sysinfo_value("kconsole.inr");
     535                if (ipc_register_irq(inr, devno, 0, NULL) != EOK)
     536                        printf(NAME ": Error registering kconsole notifications\n");
     537               
     538                async_set_interrupt_received(interrupt_received);
     539        }
     540       
    523541        // FIXME: avoid connectiong to itself, keep using klog
    524542        // printf(NAME ": Accepting connections\n");
    525543        async_manager();
    526 
    527         return 0;       
     544       
     545        return 0;
    528546}
    529547 
Note: See TracChangeset for help on using the changeset viewer.