Rev 3747 | Rev 3767 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3747 | Rev 3761 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | #include <async.h> |
46 | #include <async.h> |
47 | #include <libadt/fifo.h> |
47 | #include <libadt/fifo.h> |
48 | #include <screenbuffer.h> |
48 | #include <screenbuffer.h> |
49 | #include <sys/mman.h> |
49 | #include <sys/mman.h> |
50 | #include <stdio.h> |
50 | #include <stdio.h> |
- | 51 | #include <sysinfo.h> |
|
51 | 52 | ||
52 | #include "gcons.h" |
53 | #include "gcons.h" |
53 | 54 | ||
54 | #define MAX_KEYREQUESTS_BUFFERED 32 |
55 | #define MAX_KEYREQUESTS_BUFFERED 32 |
55 | 56 | ||
56 | #define NAME "console" |
57 | #define NAME "console" |
57 | 58 | ||
58 | /** Index of currently used virtual console. |
59 | /** Index of currently used virtual console. |
59 | */ |
60 | */ |
60 | int active_console = 0; |
61 | int active_console = 0; |
- | 62 | int prev_console = 0; |
|
61 | 63 | ||
62 | /** Information about framebuffer |
64 | /** Information about framebuffer |
63 | */ |
65 | */ |
64 | struct { |
66 | struct { |
65 | int phone; /**< Framebuffer phone */ |
67 | int phone; /**< Framebuffer phone */ |
Line 205... | Line 207... | ||
205 | async_serialize_start(); |
207 | async_serialize_start(); |
206 | curs_hide_sync(); |
208 | curs_hide_sync(); |
207 | gcons_in_kernel(); |
209 | gcons_in_kernel(); |
208 | async_serialize_end(); |
210 | async_serialize_end(); |
209 | 211 | ||
210 | if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) |
212 | if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) { |
- | 213 | prev_console = active_console; |
|
211 | active_console = KERNEL_CONSOLE; |
214 | active_console = KERNEL_CONSOLE; |
212 | else |
215 | } else |
213 | newcons = active_console; |
216 | newcons = active_console; |
214 | } |
217 | } |
215 | 218 | ||
216 | if (newcons != KERNEL_CONSOLE) { |
219 | if (newcons != KERNEL_CONSOLE) { |
217 | async_serialize_start(); |
220 | async_serialize_start(); |
Line 441... | Line 444... | ||
441 | } |
444 | } |
442 | ipc_answer_2(callid, EOK, arg1, arg2); |
445 | ipc_answer_2(callid, EOK, arg1, arg2); |
443 | } |
446 | } |
444 | } |
447 | } |
445 | 448 | ||
- | 449 | static void interrupt_received(ipc_callid_t callid, ipc_call_t *call) |
|
- | 450 | { |
|
- | 451 | change_console(prev_console); |
|
- | 452 | } |
|
- | 453 | ||
446 | int main(int argc, char *argv[]) |
454 | int main(int argc, char *argv[]) |
447 | { |
455 | { |
448 | printf(NAME ": HelenOS Console service\n"); |
456 | printf(NAME ": HelenOS Console service\n"); |
449 | 457 | ||
450 | ipcarg_t phonehash; |
458 | ipcarg_t phonehash; |
Line 518... | Line 526... | ||
518 | 526 | ||
519 | /* Register at NS */ |
527 | /* Register at NS */ |
520 | if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) |
528 | if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) |
521 | return -1; |
529 | return -1; |
522 | 530 | ||
- | 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 | ||
523 | // FIXME: avoid connectiong to itself, keep using klog |
541 | // FIXME: avoid connectiong to itself, keep using klog |
524 | // printf(NAME ": Accepting connections\n"); |
542 | // printf(NAME ": Accepting connections\n"); |
525 | async_manager(); |
543 | async_manager(); |
526 | 544 | ||
527 | return 0; |
545 | return 0; |