Index: console/Makefile
===================================================================
--- console/Makefile	(revision 375691248865a96405aedd242f1a7c5992b1d23e)
+++ console/Makefile	(revision e1c48496341d45b9f2059a63d35c10fb1d3fb28a)
@@ -45,5 +45,6 @@
 	console.c \
 	screenbuffer.c \
-	../kbd/generic/key_buffer.c
+	../kbd/generic/key_buffer.c \
+	gcons.c
 
 ARCH_SOURCES = 
Index: console/console.c
===================================================================
--- console/console.c	(revision 375691248865a96405aedd242f1a7c5992b1d23e)
+++ console/console.c	(revision e1c48496341d45b9f2059a63d35c10fb1d3fb28a)
@@ -42,4 +42,6 @@
 #include <sys/mman.h>
 
+#include "gcons.h"
+
 #define MAX_KEYREQUESTS_BUFFERED 32
 
@@ -178,5 +180,4 @@
 //			if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 + CONSOLE_COUNT)) {
 			if ((c >= '0') && (c < '0' + CONSOLE_COUNT)) {
-				
 				if (c == '0') {
 					/* switch to kernel console*/
@@ -193,4 +194,6 @@
 						break;
 					active_console = c;
+					gcons_change_console(c);
+				
 				}
 				
@@ -337,4 +340,10 @@
 		usleep(10000);
 	}
+
+	/* Initialize gcons */
+	gcons_init(fb_info.phone);
+	/* Synchronize, the gcons can have something in queue */
+	sync_send_2(fb_info.phone, FB_GET_CSIZE, 0, 0, NULL, NULL);
+
 	
 	ipc_call_sync_2(fb_info.phone, FB_GET_CSIZE, 0, 0, &(fb_info.rows), &(fb_info.cols)); 
@@ -368,5 +377,5 @@
 	async_new_connection(phonehash, 0, NULL, keyboard_events);
 	
-	nsend_call_2(fb_info.phone, FB_CURSOR_GOTO, 0, 0); 
+	sync_send_2(fb_info.phone, FB_CURSOR_GOTO, 0, 0, NULL, NULL); 
 	nsend_call(fb_info.phone, FB_CURSOR_VISIBILITY, 1); 
 
Index: console/gcons.c
===================================================================
--- console/gcons.c	(revision 375691248865a96405aedd242f1a7c5992b1d23e)
+++ console/gcons.c	(revision e1c48496341d45b9f2059a63d35c10fb1d3fb28a)
@@ -29,6 +29,9 @@
 #include <ipc/fb.h>
 #include <ipc/ipc.h>
+#include <async.h>
+#include <stdio.h>
 
 #include "console.h"
+#include "gcons.h"
 
 #define CONSOLE_TOP      50
@@ -39,4 +42,6 @@
 #define STATUS_HEIGHT   30
 
+#define MAIN_COLOR      0x118811
+
 static int use_gcons = 0;
 static ipcarg_t xres,yres;
@@ -44,28 +49,67 @@
 static int console_vp;
 static int cstatus_vp[CONSOLE_COUNT];
+static int cstat_row, cstat_col; /* Size of cstatus buttons */
 
 static int fbphone;
 
+enum butstate {
+	CONS_ACTIVE = 0,
+	CONS_IDLE,
+	CONS_HAS_INPUT
+};
+
+static struct {
+	int fgcolor;
+	int bgcolor;
+} stat_colors[] = {
+	{0xd0d0d0, 0x808080},
+	{0xd0d0d0, 0x0},
+	{0xd0d0d0, 0xa04040}
+};
+
+static int active_console = 0;
+
 static void vp_switch(int vp)
 {
-	ipc_call_sync_2(fbphone,FB_VIEWPORT_SWITCH, vp, 0, NULL, NULL);
+	nsend_call(fbphone,FB_VIEWPORT_SWITCH, vp);
 }
 
+/** Create view port */
 static int vp_create(unsigned int x, unsigned int y, 
-		     unsigned int width, unsgined int height)
+		     unsigned int width, unsigned int height)
 {
-	return  ipc_call_sync_2(fbphone, (x << 16) | y, (width << 16) | height,
-				NULL, NULL);
+	/* Init function, use ipc_call_sync */
+	return ipc_call_sync_2(fbphone, FB_VIEWPORT_CREATE,
+			       (x << 16) | y, (width << 16) | height,
+			       NULL, NULL);
 }
 
-static void fb_clear(void)
+static void clear(void)
 {
-	ipc_call_sync_2(fbphone, FB_CLEAR, 0, 0, NULL, NULL);
+	nsend_call(fbphone, FB_CLEAR, 0);
 	
 }
 
-static void fb_set_style(int fgcolor, int bgcolor)
+static void set_style(int fgcolor, int bgcolor)
 {
-	ipc_call_sync_2(fbphone, );
+	nsend_call_2(fbphone, FB_SET_STYLE, fgcolor, bgcolor);
+}
+
+static void putch(char c, int row, int col)
+{
+	nsend_call_3(fbphone, FB_PUTCHAR, c, row, col);
+}
+
+static void draw_stat(int consnum, enum butstate state)
+{
+	char data[5];
+	int i;
+	
+	vp_switch(cstatus_vp[consnum]);
+	set_style(stat_colors[state].fgcolor, stat_colors[state].bgcolor);
+	clear();
+	snprintf(data, 5, "%d", consnum+1);
+	for (i=0;data[i];i++)
+		putch(data[i], 0, i);
 }
 
@@ -74,5 +118,8 @@
 	if (!use_gcons)
 		return;
-
+	
+	draw_stat(active_console, CONS_IDLE);
+	active_console = consnum;
+	draw_stat(consnum, CONS_ACTIVE);
 	vp_switch(console_vp);
 }
@@ -86,13 +133,17 @@
 }
 
-void gcons_redraw_console(int phone)
+void gcons_redraw_console(void)
 {
+	int i;
+
 	if (!use_gcons)
 		return;
 	
 	vp_switch(0);
-	/* Set style...*/
-	fb_clear();
-	
+	set_style(MAIN_COLOR, MAIN_COLOR);
+	clear();
+
+	for (i=0;i < CONSOLE_COUNT; i++) 
+		draw_stat(i, i == active_console ? CONS_ACTIVE : CONS_IDLE);
 	vp_switch(console_vp);
 }
@@ -121,5 +172,5 @@
 	/* Create status buttons */
 	for (i=0; i < CONSOLE_COUNT; i++) {
-		cstatus_vp[i] = vp_create(phone, CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE),
+		cstatus_vp[i] = vp_create(CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE),
 					  CONSOLE_MARGIN, STATUS_WIDTH, STATUS_HEIGHT);
 		if (cstatus_vp[i] < 0)
@@ -128,4 +179,4 @@
 	
 	use_gcons = 1;
-	gcons_draw_console();
+	gcons_redraw_console();
 }
Index: console/gcons.h
===================================================================
--- console/gcons.h	(revision e1c48496341d45b9f2059a63d35c10fb1d3fb28a)
+++ console/gcons.h	(revision e1c48496341d45b9f2059a63d35c10fb1d3fb28a)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2006 Ondrej Palkovsky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _GCONS_H_
+#define _GCONS_H_
+
+void gcons_init(int phone);
+void gcons_change_console(int consnum);
+
+#endif
