Index: uspace/srv/hid/console/console.c
===================================================================
--- uspace/srv/hid/console/console.c	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
+++ uspace/srv/hid/console/console.c	(revision a40dea38c9d586aa4f82dcde5704326ff5abae9d)
@@ -54,5 +54,4 @@
 #include <event.h>
 #include <devmap.h>
-#include <devmap_obsolete.h>
 #include <fcntl.h>
 #include <vfs/vfs.h>
@@ -68,6 +67,6 @@
 #define NAMESPACE  "term"
 
-/** Phone to the input server. */
-static int input_phone;
+/** Session with the input server. */
+static async_sess_t *input_sess;
 
 /** Information about framebuffer */
@@ -109,4 +108,16 @@
 static FIBRIL_CONDVAR_INITIALIZE(input_cv);
 
+static FIBRIL_MUTEX_INITIALIZE(big_console_lock);
+
+static void console_serialize_start(void)
+{
+	fibril_mutex_lock(&big_console_lock);
+}
+
+static void console_serialize_end(void)
+{
+	fibril_mutex_unlock(&big_console_lock);
+}
+
 static void curs_visibility(bool visible)
 {
@@ -141,10 +152,26 @@
 static void input_yield(void)
 {
-	async_obsolete_req_0_0(input_phone, INPUT_YIELD);
+	async_exch_t *exch = async_exchange_begin(input_sess);
+	if (exch == NULL) {
+		printf("%s: Failed starting exchange with input device.\n",
+		    NAME);
+		return;
+	}
+	
+	async_req_0_0(exch, INPUT_YIELD);
+	async_exchange_end(exch);
 }
 
 static void input_reclaim(void)
 {
-	async_obsolete_req_0_0(input_phone, INPUT_RECLAIM);
+	async_exch_t *exch = async_exchange_begin(input_sess);
+	if (exch == NULL) {
+		printf("%s: Failed starting exchange with input device.\n",
+		    NAME);
+		return;
+	}
+	
+	async_req_0_0(exch, INPUT_RECLAIM);
+	async_exchange_end(exch);
 }
 
@@ -323,10 +350,10 @@
 	
 	if (cons == kernel_console) {
-		async_obsolete_serialize_start();
+		console_serialize_start();
 		curs_hide_sync();
 		gcons_in_kernel();
 		screen_yield();
 		input_yield();
-		async_obsolete_serialize_end();
+		console_serialize_end();
 		
 		if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) {
@@ -338,5 +365,5 @@
 	
 	if (cons != kernel_console) {
-		async_obsolete_serialize_start();
+		console_serialize_start();
 		
 		if (active_console == kernel_console) {
@@ -393,5 +420,5 @@
 		curs_visibility(cons->scr.is_cursor_visible);
 		
-		async_obsolete_serialize_end();
+		console_serialize_end();
 	}
 }
@@ -410,5 +437,5 @@
 		if (!IPC_GET_IMETHOD(call)) {
 			/* TODO: Handle hangup */
-			async_obsolete_hangup(input_phone);
+			async_hangup(input_sess);
 			return;
 		}
@@ -470,5 +497,5 @@
 	}
 	
-	async_obsolete_serialize_start();
+	console_serialize_start();
 	
 	size_t off = 0;
@@ -478,5 +505,5 @@
 	}
 	
-	async_obsolete_serialize_end();
+	console_serialize_end();
 	
 	gcons_notify_char(cons->index);
@@ -573,5 +600,5 @@
 	int rc;
 	
-	async_obsolete_serialize_start();
+	console_serialize_start();
 	if (cons->refcount == 0)
 		gcons_notify_connect(cons->index);
@@ -583,7 +610,7 @@
 	
 	while (true) {
-		async_obsolete_serialize_end();
+		console_serialize_end();
 		callid = async_get_call(&call);
-		async_obsolete_serialize_start();
+		console_serialize_start();
 		
 		arg1 = 0;
@@ -595,4 +622,5 @@
 			if (cons->refcount == 0)
 				gcons_notify_disconnect(cons->index);
+			console_serialize_end();
 			return;
 		}
@@ -600,12 +628,12 @@
 		switch (IPC_GET_IMETHOD(call)) {
 		case VFS_OUT_READ:
-			async_obsolete_serialize_end();
+			console_serialize_end();
 			cons_read(cons, callid, &call);
-			async_obsolete_serialize_start();
+			console_serialize_start();
 			continue;
 		case VFS_OUT_WRITE:
-			async_obsolete_serialize_end();
+			console_serialize_end();
 			cons_write(cons, callid, &call);
-			async_obsolete_serialize_start();
+			console_serialize_start();
 			continue;
 		case VFS_OUT_SYNC:
@@ -678,7 +706,7 @@
 			break;
 		case CONSOLE_GET_EVENT:
-			async_obsolete_serialize_end();
+			console_serialize_end();
 			cons_get_event(cons, callid, &call);
-			async_obsolete_serialize_start();
+			console_serialize_start();
 			continue;
 		case CONSOLE_KCON_ENABLE:
@@ -695,32 +723,41 @@
 }
 
-static int connect_input(const char *dev_path)
-{
-	int phone;
+static async_sess_t *connect_input(const char *dev_path)
+{
+	async_sess_t *sess;
+	async_exch_t *exch;
 	devmap_handle_t handle;
 	
 	int rc = devmap_device_get_handle(dev_path, &handle, 0);
 	if (rc == EOK) {
-		phone = devmap_obsolete_device_connect(handle, 0);
-		if (phone < 0) {
-			printf("%s: Failed to connect to input device\n", NAME);
-			return phone;
+		sess = devmap_device_connect(EXCHANGE_ATOMIC, handle, 0);
+		if (sess == NULL) {
+			printf("%s: Failed to connect to input server\n", NAME);
+			return NULL;
 		}
 	} else {
-		return rc;
+		return NULL;
+	}
+	
+	exch = async_exchange_begin(sess);
+	if (exch == NULL) {
+		printf("%s: Failed to create callback from input server.\n", NAME);
+		return NULL;
 	}
 	
 	/* NB: The callback connection is slotted for removal */
-	rc = async_obsolete_connect_to_me(phone, SERVICE_CONSOLE, 0, 0,
-	    input_events, NULL);
+	rc = async_connect_to_me(exch, SERVICE_CONSOLE, 0, 0, input_events,
+	    NULL);
+
+	async_exchange_end(exch);
 
 	if (rc != EOK) {
-		async_obsolete_hangup(phone);
-		printf("%s: Failed to create callback from input device (%s).\n",
+		async_hangup(sess);
+		printf("%s: Failed to create callback from input server (%s).\n",
 		    NAME, str_error(rc));
-		return rc;
-	}
-	
-	return phone;
+		return NULL;
+	}
+	
+	return sess;
 }
 
@@ -728,6 +765,6 @@
 {
 	/* Connect to input server */
-	input_phone = connect_input(input_dev);
-	if (input_phone < 0)
+	input_sess = connect_input(input_dev);
+	if (input_sess == NULL)
 		return false;
 	
@@ -800,5 +837,5 @@
 	
 	/* Initialize the screen */
-	async_obsolete_serialize_start();
+	console_serialize_start();
 	gcons_redraw_console();
 	set_style(STYLE_NORMAL);
@@ -806,5 +843,5 @@
 	curs_goto(0, 0);
 	curs_visibility(active_console->scr.is_cursor_visible);
-	async_obsolete_serialize_end();
+	console_serialize_end();
 	
 	/* Receive kernel notifications */
