Index: uspace/app/tmon/main.c
===================================================================
--- uspace/app/tmon/main.c	(revision 837d53df7e7cca6ce3ffd079108c600627b9c780)
+++ uspace/app/tmon/main.c	(revision a8723748f11aced50ec8c8b3ca56ba447f743ba0)
@@ -52,5 +52,11 @@
 	}
 
-	printf("The number is %d.\n", usb_diag_test(0));
+	int out;
+	const int rc = usb_diag_test(0, &out);
+	if (rc) {
+		printf("Error: %d\n", rc);
+	} else {
+		printf("The number is %d.\n", out);
+	}
 
 	return 0;
Index: uspace/drv/bus/usb/usbdiag/Makefile
===================================================================
--- uspace/drv/bus/usb/usbdiag/Makefile	(revision 837d53df7e7cca6ce3ffd079108c600627b9c780)
+++ uspace/drv/bus/usb/usbdiag/Makefile	(revision a8723748f11aced50ec8c8b3ca56ba447f743ba0)
@@ -29,5 +29,5 @@
 USPACE_PREFIX = ../../../..
 
-LIBS = usbdev usb drv
+LIBS = usbdiag usbdev usb drv
 
 BINARY = usbdiag
Index: uspace/drv/bus/usb/usbdiag/main.c
===================================================================
--- uspace/drv/bus/usb/usbdiag/main.c	(revision 837d53df7e7cca6ce3ffd079108c600627b9c780)
+++ uspace/drv/bus/usb/usbdiag/main.c	(revision a8723748f11aced50ec8c8b3ca56ba447f743ba0)
@@ -32,9 +32,10 @@
 /**
  * @file
- * Main routines of USB debug device driver.
+ * Main routines of USB diagnostic device driver.
  */
 #include <errno.h>
 #include <usb/debug.h>
 #include <usb/dev/driver.h>
+#include <usb/diag/diag.h>
 
 #include "usbdiag.h"
@@ -42,4 +43,11 @@
 
 #define NAME "usbdiag"
+
+static void usb_diag_test_impl(ipc_callid_t rid, ipc_call_t *request)
+{
+	int x = IPC_GET_ARG1(*request);
+	int ret = 4200 + x;
+	async_answer_0(rid, ret);
+}
 
 static int device_add(usb_device_t *dev)
@@ -99,5 +107,42 @@
 }
 
-/** USB debug driver ops. */
+static void connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
+{
+	bool cont = true;
+
+	async_answer_0(iid, EOK);
+
+	while (cont) {
+		ipc_call_t call;
+		ipc_callid_t callid = async_get_call(&call);
+
+		if (!IPC_GET_IMETHOD(call))
+			break;
+
+		switch (IPC_GET_IMETHOD(call)) {
+		case USB_DIAG_IN_TEST:
+			usb_diag_test_impl(callid, &call);
+			break;
+		default:
+			async_answer_0(callid, ENOTSUP);
+			break;
+		}
+	}
+}
+
+static int server_fibril(void *arg)
+{
+	// async_set_client_data_constructor(NULL);
+	// async_set_client_data_destructor(NULL);
+	async_set_fallback_port_handler(connection, NULL);
+	// async_event_task_subscribe();
+	// service_register();
+	async_manager();
+
+	/* Never reached. */
+	return EOK;
+}
+
+/** USB diagnostic driver ops. */
 static const usb_driver_ops_t diag_driver_ops = {
 	.device_add = device_add,
@@ -108,5 +153,5 @@
 };
 
-/** USB debug driver. */
+/** USB diagnostic driver. */
 static const usb_driver_t diag_driver = {
 	.name = NAME,
@@ -117,7 +162,13 @@
 int main(int argc, char *argv[])
 {
-	printf(NAME ": USB debug device driver.\n");
+	printf(NAME ": USB diagnostic device driver.\n");
 
 	log_init(NAME);
+
+	/* Start usbdiag service. */
+	fid_t srv = fibril_create(server_fibril, NULL);
+	if (!srv)
+		return ENOMEM;
+	fibril_add_ready(srv);
 
 	return usb_driver_main(&diag_driver);
Index: uspace/lib/usbdiag/Makefile
===================================================================
--- uspace/lib/usbdiag/Makefile	(revision 837d53df7e7cca6ce3ffd079108c600627b9c780)
+++ uspace/lib/usbdiag/Makefile	(revision a8723748f11aced50ec8c8b3ca56ba447f743ba0)
@@ -29,5 +29,5 @@
 USPACE_PREFIX = ../..
 LIBRARY = libusbdiag
-LIBS = usb
+LIBS = drv usb
 
 SOURCES = \
Index: uspace/lib/usbdiag/include/usb/diag/diag.h
===================================================================
--- uspace/lib/usbdiag/include/usb/diag/diag.h	(revision 837d53df7e7cca6ce3ffd079108c600627b9c780)
+++ uspace/lib/usbdiag/include/usb/diag/diag.h	(revision a8723748f11aced50ec8c8b3ca56ba447f743ba0)
@@ -36,6 +36,12 @@
 #define LIBUSBDIAG_DIAG_H_
 
+#include <ipc/common.h>
+
+typedef enum {
+  USB_DIAG_IN_TEST = IPC_FIRST_USER_METHOD,
+} usb_diag_in_request_t;
+
 /** Just a dummy symbol to make compiler happy. TODO: remove it */
-int usb_diag_test(int);
+int usb_diag_test(int, int*);
 
 #endif
Index: uspace/lib/usbdiag/src/test.c
===================================================================
--- uspace/lib/usbdiag/src/test.c	(revision 837d53df7e7cca6ce3ffd079108c600627b9c780)
+++ uspace/lib/usbdiag/src/test.c	(revision a8723748f11aced50ec8c8b3ca56ba447f743ba0)
@@ -34,9 +34,19 @@
  */
 
+#include <async.h>
 #include <usb/diag/diag.h>
 
-int usb_diag_test(int x)
+int usb_diag_test(int x, int *out)
 {
-	return x + 42;
+	sysarg_t _out;
+	async_sess_t *session = NULL;
+	async_exch_t *exch = async_exchange_begin(session);
+	const int rc = async_req_1_1(exch, USB_DIAG_IN_TEST, x, &_out);
+	async_exchange_end(exch);
+
+	if (out)
+		*out = (int) _out;
+
+	return rc;
 }
 
