Index: boot/generic/src/version.c
===================================================================
--- boot/generic/src/version.c	(revision 503e4e397822db7b83740354007cc744b68b906b)
+++ boot/generic/src/version.c	(revision b6705231494868e9a4b9fd8c473f361b554cc79c)
@@ -32,5 +32,5 @@
 
 static const char *project = "HelenOS bootloader";
-static const char *copyright = "Copyright (c) 2001-2010 HelenOS project";
+static const char *copyright = "Copyright (c) 2001-2011 HelenOS project";
 static const char *release = STRING(RELEASE);
 static const char *name = STRING(NAME);
Index: kernel/generic/src/main/version.c
===================================================================
--- kernel/generic/src/main/version.c	(revision 503e4e397822db7b83740354007cc744b68b906b)
+++ kernel/generic/src/main/version.c	(revision b6705231494868e9a4b9fd8c473f361b554cc79c)
@@ -38,5 +38,5 @@
 
 static const char *project = "SPARTAN kernel";
-static const char *copyright = "Copyright (c) 2001-2010 HelenOS project";
+static const char *copyright = "Copyright (c) 2001-2011 HelenOS project";
 static const char *release = STRING(RELEASE);
 static const char *name = STRING(NAME);
Index: uspace/app/getterm/version.c
===================================================================
--- uspace/app/getterm/version.c	(revision 503e4e397822db7b83740354007cc744b68b906b)
+++ uspace/app/getterm/version.c	(revision b6705231494868e9a4b9fd8c473f361b554cc79c)
@@ -61,5 +61,5 @@
 	printf("HelenOS release %s (%s)%s%s\n", release, name, revision, timestamp);
 	printf("Running on %s (%s)\n", arch, term);
-	printf("Copyright (c) 2001-2010 HelenOS project\n\n");
+	printf("Copyright (c) 2001-2011 HelenOS project\n\n");
 }
 
Index: uspace/drv/usbmouse/init.c
===================================================================
--- uspace/drv/usbmouse/init.c	(revision 503e4e397822db7b83740354007cc744b68b906b)
+++ uspace/drv/usbmouse/init.c	(revision b6705231494868e9a4b9fd8c473f361b554cc79c)
@@ -43,7 +43,4 @@
 #include <errno.h>
 
-// FIXME: remove this header
-#include <kernel/ipc/ipc_methods.h>
-
 /** Mouse polling endpoint description for boot protocol subclass. */
 usb_endpoint_description_t poll_endpoint_description = {
@@ -56,39 +53,34 @@
 };
 
-static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
+/** Default handler for IPC methods not handled by DDF.
+ *
+ * @param fun     Device function handling the call.
+ * @param icallid Call ID.
+ * @param icall   Call data.
+ *
+ */
+static void default_connection_handler(ddf_fun_t *fun, ipc_callid_t icallid,
+    ipc_call_t *icall)
+{
+	usb_mouse_t *mouse = (usb_mouse_t *) fun->driver_data;
+	assert(mouse != NULL);
+	
+	async_sess_t *callback =
+	    async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
+	
+	if (callback) {
+		if (mouse->console_sess == NULL) {
+			mouse->console_sess = callback;
+			async_answer_0(icallid, EOK);
+		} else
+			async_answer_0(icallid, ELIMIT);
+	} else
+		async_answer_0(icallid, EINVAL);
+}
+
 /** Device ops for USB mouse. */
 static ddf_dev_ops_t mouse_ops = {
 	.default_handler = default_connection_handler
 };
-
-/** Default handler for IPC methods not handled by DDF.
- *
- * @param fun Device function handling the call.
- * @param icallid Call id.
- * @param icall Call data.
- */
-void default_connection_handler(ddf_fun_t *fun,
-    ipc_callid_t icallid, ipc_call_t *icall)
-{
-	sysarg_t method = IPC_GET_IMETHOD(*icall);
-
-	usb_mouse_t *mouse = (usb_mouse_t *) fun->driver_data;
-	assert(mouse != NULL);
-
-	if (method == IPC_M_CONNECT_TO_ME) {
-		int callback = IPC_GET_ARG5(*icall);
-
-		if (mouse->console_phone != -1) {
-			async_answer_0(icallid, ELIMIT);
-			return;
-		}
-
-		mouse->console_phone = callback;
-		async_answer_0(icallid, EOK);
-		return;
-	}
-
-	async_answer_0(icallid, EINVAL);
-}
 
 /** Create USB mouse device.
@@ -102,12 +94,12 @@
 {
 	usb_mouse_t *mouse = malloc(sizeof(usb_mouse_t));
-	if (mouse == NULL) {
+	if (mouse == NULL)
 		return ENOMEM;
-	}
+	
 	mouse->dev = dev;
-	mouse->console_phone = -1;
-
+	mouse->console_sess = NULL;
+	
 	int rc;
-
+	
 	/* Create DDF function. */
 	mouse->mouse_fun = ddf_fun_create(dev->ddf_dev, fun_exposed, "mouse");
@@ -116,34 +108,30 @@
 		goto leave;
 	}
-
+	
 	mouse->mouse_fun->ops = &mouse_ops;
-
+	
 	rc = ddf_fun_bind(mouse->mouse_fun);
-	if (rc != EOK) {
+	if (rc != EOK)
 		goto leave;
-	}
-
+	
 	/* Add the function to mouse class. */
 	rc = ddf_fun_add_to_class(mouse->mouse_fun, "mouse");
-	if (rc != EOK) {
+	if (rc != EOK)
 		goto leave;
-	}
 	
 	/* Set the boot protocol. */
 	rc = usbhid_req_set_protocol(&dev->ctrl_pipe, dev->interface_no,
 	    USB_HID_PROTOCOL_BOOT);
-	if (rc != EOK) {
+	if (rc != EOK)
 		goto leave;
-	}
 	
-	/* Everything all right. */
+	/* Everything allright. */
 	dev->driver_data = mouse;
 	mouse->mouse_fun->driver_data = mouse;
-
+	
 	return EOK;
-
+	
 leave:
 	free(mouse);
-
 	return rc;
 }
Index: uspace/drv/usbmouse/main.c
===================================================================
--- uspace/drv/usbmouse/main.c	(revision 503e4e397822db7b83740354007cc744b68b906b)
+++ uspace/drv/usbmouse/main.c	(revision b6705231494868e9a4b9fd8c473f361b554cc79c)
@@ -34,4 +34,5 @@
  * Main routines of USB boot protocol mouse driver.
  */
+
 #include "mouse.h"
 #include <usb/debug.h>
@@ -40,8 +41,12 @@
 #include <str_error.h>
 
+#define NAME  "usbmouse"
+
 /** Callback when new mouse device is attached and recognised by DDF.
  *
  * @param dev Representation of a generic DDF device.
+ *
  * @return Error code.
+ *
  */
 static int usbmouse_add_device(usb_device_t *dev)
@@ -53,12 +58,12 @@
 		return rc;
 	}
-
+	
 	usb_log_debug("Polling pipe at endpoint %d.\n",
 	    dev->pipes[0].pipe->endpoint_no);
-
-	rc = usb_device_auto_poll(dev, 0,
-	    usb_mouse_polling_callback, dev->pipes[0].pipe->max_packet_size,
+	
+	rc = usb_device_auto_poll(dev, 0, usb_mouse_polling_callback,
+	    dev->pipes[0].pipe->max_packet_size,
 	    usb_mouse_polling_ended_callback, dev->driver_data);
-
+	
 	if (rc != EOK) {
 		usb_log_error("Failed to start polling fibril: %s.\n",
@@ -66,8 +71,8 @@
 		return rc;
 	}
-
+	
 	usb_log_info("controlling new mouse (handle %" PRIun ").\n",
 	    dev->ddf_dev->handle);
-
+	
 	return EOK;
 }
@@ -93,5 +98,4 @@
 {
 	usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
-
 	return usb_driver_main(&mouse_driver);
 }
Index: uspace/drv/usbmouse/mouse.c
===================================================================
--- uspace/drv/usbmouse/mouse.c	(revision 503e4e397822db7b83740354007cc744b68b906b)
+++ uspace/drv/usbmouse/mouse.c	(revision b6705231494868e9a4b9fd8c473f361b554cc79c)
@@ -40,23 +40,24 @@
 #include <ipc/mouse.h>
 #include <async.h>
-#include <async_obsolete.h>
 #include "mouse.h"
 
 /** Mouse polling callback.
  *
- * @param dev Device that is being polled.
+ * @param dev    Device that is being polled.
  * @param buffer Data buffer.
- * @param buffer_size Buffer size in bytes.
- * @param arg Custom argument - points to usb_mouse_t.
+ * @param size   Buffer size in bytes.
+ * @param arg    Pointer to usb_mouse_t.
+ *
  * @return Always true.
+ *
  */
-bool usb_mouse_polling_callback(usb_device_t *dev,
-    uint8_t *buffer, size_t buffer_size, void *arg)
+bool usb_mouse_polling_callback(usb_device_t *dev, uint8_t *buffer,
+    size_t size, void *arg)
 {
 	usb_mouse_t *mouse = (usb_mouse_t *) arg;
-
+	
 	usb_log_debug2("got buffer: %s.\n",
-	    usb_debug_str_buffer(buffer, buffer_size, 0));
-
+	    usb_debug_str_buffer(buffer, size, 0));
+	
 	uint8_t butt = buffer[0];
 	char str_buttons[4] = {
@@ -66,41 +67,42 @@
 		0
 	};
-
+	
 	int shift_x = ((int) buffer[1]) - 127;
 	int shift_y = ((int) buffer[2]) - 127;
 	int wheel = ((int) buffer[3]) - 127;
-
-	if (buffer[1] == 0) {
+	
+	if (buffer[1] == 0)
 		shift_x = 0;
-	}
-	if (buffer[2] == 0) {
+	
+	if (buffer[2] == 0)
 		shift_y = 0;
-	}
-	if (buffer[3] == 0) {
+	
+	if (buffer[3] == 0)
 		wheel = 0;
-	}
-
-	if (mouse->console_phone >= 0) {
+	
+	if (mouse->console_sess) {
 		if ((shift_x != 0) || (shift_y != 0)) {
-			/* FIXME: guessed for QEMU */
-			async_obsolete_req_2_0(mouse->console_phone,
-			    MEVENT_MOVE,
-			    - shift_x / 10,  - shift_y / 10);
+			// FIXME: guessed for QEMU
+			
+			async_exch_t *exch = async_exchange_begin(mouse->console_sess);
+			async_req_2_0(exch, MEVENT_MOVE, -shift_x / 10, -shift_y / 10);
+			async_exchange_end(exch);
 		}
 		if (butt) {
-			/* FIXME: proper button clicking. */
-			async_obsolete_req_2_0(mouse->console_phone,
-			    MEVENT_BUTTON, 1, 1);
-			async_obsolete_req_2_0(mouse->console_phone,
-			    MEVENT_BUTTON, 1, 0);
+			// FIXME: proper button clicking
+			
+			async_exch_t *exch = async_exchange_begin(mouse->console_sess);
+			async_req_2_0(exch, MEVENT_BUTTON, 1, 1);
+			async_req_2_0(exch, MEVENT_BUTTON, 1, 0);
+			async_exchange_end(exch);
 		}
 	}
-
+	
 	usb_log_debug("buttons=%s  dX=%+3d  dY=%+3d  wheel=%+3d\n",
 	    str_buttons, shift_x, shift_y, wheel);
-
+	
 	/* Guess. */
 	async_usleep(1000);
-
+	
 	return true;
 }
@@ -108,17 +110,18 @@
 /** Callback when polling is terminated.
  *
- * @param dev Device where the polling terminated.
+ * @param dev              Device where the polling terminated.
  * @param recurring_errors Whether the polling was terminated due to
- *	recurring errors.
- * @param arg Custom argument - points to usb_mouse_t.
+ *                         recurring errors.
+ * @param arg              Pointer to usb_mouse_t.
+ *
  */
-void usb_mouse_polling_ended_callback(usb_device_t *dev,
-    bool recurring_errors, void *arg)
+void usb_mouse_polling_ended_callback(usb_device_t *dev, bool recurring_errors,
+    void *arg)
 {
 	usb_mouse_t *mouse = (usb_mouse_t *) arg;
-
-	async_obsolete_hangup(mouse->console_phone);
-	mouse->console_phone = -1;
-
+	
+	async_hangup(mouse->console_sess);
+	mouse->console_sess = NULL;
+	
 	usb_device_destroy(dev);
 }
Index: uspace/drv/usbmouse/mouse.h
===================================================================
--- uspace/drv/usbmouse/mouse.h	(revision 503e4e397822db7b83740354007cc744b68b906b)
+++ uspace/drv/usbmouse/mouse.h	(revision b6705231494868e9a4b9fd8c473f361b554cc79c)
@@ -34,4 +34,5 @@
  * Common definitions for USB mouse driver.
  */
+
 #ifndef USBMOUSE_MOUSE_H_
 #define USBMOUSE_MOUSE_H_
@@ -40,6 +41,8 @@
 #include <usb/dev/pipes.h>
 #include <time.h>
+#include <async.h>
 
-#define NAME "usbmouse"
+#define POLL_PIPE(dev) \
+	((dev)->pipes[0].pipe)
 
 /** Container for USB mouse device. */
@@ -47,22 +50,24 @@
 	/** Generic device container. */
 	usb_device_t *dev;
+	
 	/** Function representing the device. */
 	ddf_fun_t *mouse_fun;
+	
 	/** Polling interval in microseconds. */
 	suseconds_t poll_interval_us;
-	/** IPC phone to console (consumer). */
-	int console_phone;
+	
+	/** Callback session to console (consumer). */
+	async_sess_t *console_sess;
 } usb_mouse_t;
-
-#define POLL_PIPE(dev) ((dev)->pipes[0].pipe)
 
 extern usb_endpoint_description_t poll_endpoint_description;
 
-int usb_mouse_create(usb_device_t *);
-
-bool usb_mouse_polling_callback(usb_device_t *, uint8_t *, size_t, void *);
-void usb_mouse_polling_ended_callback(usb_device_t *, bool, void *);
+extern int usb_mouse_create(usb_device_t *);
+extern bool usb_mouse_polling_callback(usb_device_t *, uint8_t *, size_t,
+    void *);
+extern void usb_mouse_polling_ended_callback(usb_device_t *, bool, void *);
 
 #endif
+
 /**
  * @}
Index: uspace/drv/vhc/conndev.c
===================================================================
--- uspace/drv/vhc/conndev.c	(revision 503e4e397822db7b83740354007cc744b68b906b)
+++ uspace/drv/vhc/conndev.c	(revision b6705231494868e9a4b9fd8c473f361b554cc79c)
@@ -45,5 +45,4 @@
 static fibril_local char plugged_device_name[PLUGGED_DEVICE_NAME_MAXLEN + 1] = "<unknown>";
 
-#if 0
 /** Receive device name.
  *
@@ -85,5 +84,4 @@
 	plugged_device_name[len] = 0;
 }
-#endif
 
 /** Default handler for IPC methods not handled by DDF.
@@ -93,20 +91,14 @@
  * @param icall Call data.
  */
-void default_connection_handler(ddf_fun_t *fun,
-    ipc_callid_t icallid, ipc_call_t *icall)
+void default_connection_handler(ddf_fun_t *fun, ipc_callid_t icallid,
+    ipc_call_t *icall)
 {
-// FIXME:
-// This code needs to be refactored since the async
-// framework does not support automatic callback connections
-// yet.
-
-#if 0
 	vhc_data_t *vhc = fun->dev->driver_data;
-	sysarg_t method = IPC_GET_IMETHOD(*icall);
-
-	if (method == IPC_M_CONNECT_TO_ME) {
-		int callback = IPC_GET_ARG5(*icall);
-		int rc = vhc_virtdev_plug(vhc, callback,
-		    &plugged_device_handle);
+	
+	async_sess_t *callback =
+	    async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
+	
+	if (callback) {
+		int rc = vhc_virtdev_plug(vhc, callback, &plugged_device_handle);
 		if (rc != EOK) {
 			async_answer_0(icallid, rc);
@@ -114,17 +106,13 @@
 			return;
 		}
-
+		
 		async_answer_0(icallid, EOK);
-
+		
 		receive_device_name(callback);
-
+		
 		usb_log_info("New virtual device `%s' (id: %" PRIxn ").\n",
 		    plugged_device_name, plugged_device_handle);
-
-		return;
-	}
-#endif
-
-	async_answer_0(icallid, EINVAL);
+	} else
+		async_answer_0(icallid, EINVAL);
 }
 
Index: uspace/lib/c/generic/async.c
===================================================================
--- uspace/lib/c/generic/async.c	(revision 503e4e397822db7b83740354007cc744b68b906b)
+++ uspace/lib/c/generic/async.c	(revision b6705231494868e9a4b9fd8c473f361b554cc79c)
@@ -2339,5 +2339,6 @@
  * @param mgmt Exchange management style.
  *
- * @return New async session or NULL on failure.
+ * @return New async session.
+ * @return NULL on failure.
  *
  */
@@ -2377,4 +2378,43 @@
 }
 
+/** Wrapper for receiving the IPC_M_CONNECT_TO_ME calls.
+ *
+ * If the call is IPC_M_CONNECT_TO_ME then a new
+ * async session is created. However, the phone is
+ * not accepted automatically.
+ *
+ * @param mgmt   Exchange management style.
+ * @param call   Call data.
+ *
+ * @return New async session.
+ * @return NULL on failure.
+ * @return NULL if the call is not IPC_M_CONNECT_TO_ME.
+ *
+ */
+async_sess_t *async_callback_receive_start(exch_mgmt_t mgmt, ipc_call_t *call)
+{
+	int phone = (int) IPC_GET_ARG5(*call);
+	
+	if ((IPC_GET_IMETHOD(*call) != IPC_M_CONNECT_TO_ME) ||
+	    (phone < 0))
+		return NULL;
+	
+	async_sess_t *sess = (async_sess_t *) malloc(sizeof(async_sess_t));
+	if (sess == NULL)
+		return NULL;
+	
+	sess->mgmt = mgmt;
+	sess->phone = phone;
+	sess->arg1 = 0;
+	sess->arg2 = 0;
+	sess->arg3 = 0;
+	
+	list_initialize(&sess->exch_list);
+	fibril_mutex_initialize(&sess->mutex);
+	atomic_set(&sess->refcnt, 0);
+	
+	return sess;
+}
+
 /** @}
  */
Index: uspace/lib/c/generic/devman.c
===================================================================
--- uspace/lib/c/generic/devman.c	(revision 503e4e397822db7b83740354007cc744b68b906b)
+++ uspace/lib/c/generic/devman.c	(revision b6705231494868e9a4b9fd8c473f361b554cc79c)
@@ -231,17 +231,4 @@
 	}
 	
-	async_wait_for(req, &retval);
-	if (retval != EOK) {
-		devman_exchange_end(exch);
-		
-		if (funh != NULL)
-			*funh = -1;
-		
-		return retval;
-	}
-	
-	if (funh != NULL)
-		*funh = (int) IPC_GET_ARG1(answer);
-	
 	link_t *link = match_ids->ids.next;
 	match_id_t *match_id = NULL;
@@ -250,9 +237,17 @@
 		match_id = list_get_instance(link, match_id_t, link);
 		
-		ipc_call_t answer;
-		aid_t req = async_send_1(exch, DEVMAN_ADD_MATCH_ID,
-		    match_id->score, &answer);
+		ipc_call_t answer2;
+		aid_t req2 = async_send_1(exch, DEVMAN_ADD_MATCH_ID,
+		    match_id->score, &answer2);
 		retval = async_data_write_start(exch, match_id->id,
 		    str_size(match_id->id));
+		if (retval != EOK) {
+			devman_exchange_end(exch);
+			async_wait_for(req2, NULL);
+			async_wait_for(req, NULL);
+			return retval;
+		}
+		
+		async_wait_for(req2, &retval);
 		if (retval != EOK) {
 			devman_exchange_end(exch);
@@ -261,15 +256,19 @@
 		}
 		
-		async_wait_for(req, &retval);
-		if (retval != EOK) {
-			devman_exchange_end(exch);
-			return retval;
-		}
-		
 		link = link->next;
 	}
 	
 	devman_exchange_end(exch);
-	return EOK;
+	
+	async_wait_for(req, &retval);
+	if (retval == EOK) {
+		if (funh != NULL)
+			*funh = (int) IPC_GET_ARG1(answer);
+	} else {
+		if (funh != NULL)
+			*funh = -1;
+	}
+	
+	return retval;
 }
 
Index: uspace/lib/c/include/async.h
===================================================================
--- uspace/lib/c/include/async.h	(revision 503e4e397822db7b83740354007cc744b68b906b)
+++ uspace/lib/c/include/async.h	(revision b6705231494868e9a4b9fd8c473f361b554cc79c)
@@ -464,4 +464,5 @@
 extern async_sess_t *async_clone_receive(exch_mgmt_t);
 extern async_sess_t *async_callback_receive(exch_mgmt_t);
+extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
 
 #endif
