Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ uspace/Makefile	(revision 41ebc36bbe2b8fb1b2ac81a65869d1a0b8499f2e)
@@ -241,5 +241,4 @@
 	lib/usbhost \
 	lib/usbdev \
-	lib/usbdiag \
 	lib/usbhid \
 	lib/usbvirt \
Index: uspace/app/tmon/Makefile
===================================================================
--- uspace/app/tmon/Makefile	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ uspace/app/tmon/Makefile	(revision 41ebc36bbe2b8fb1b2ac81a65869d1a0b8499f2e)
@@ -30,5 +30,5 @@
 BINARY = tmon
 
-LIBS = drv usbdiag
+LIBS = drv
 
 SOURCES = \
Index: uspace/app/tmon/list.c
===================================================================
--- uspace/app/tmon/list.c	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ uspace/app/tmon/list.c	(revision 41ebc36bbe2b8fb1b2ac81a65869d1a0b8499f2e)
@@ -38,5 +38,5 @@
 #include <devman.h>
 #include <loc.h>
-#include <usb/diag/diag.h>
+#include <usbdiag_iface.h>
 #include "commands.h"
 
@@ -70,6 +70,6 @@
 	int rc;
 
-	if ((rc = loc_category_get_id(USB_DIAG_CATEGORY, &diag_cat, 0))) {
-		printf(NAME ": Error resolving category '%s'", USB_DIAG_CATEGORY);
+	if ((rc = loc_category_get_id(USBDIAG_CATEGORY, &diag_cat, 0))) {
+		printf(NAME ": Error resolving category '%s'", USBDIAG_CATEGORY);
 		return 1;
 	}
Index: uspace/app/tmon/test.c
===================================================================
--- uspace/app/tmon/test.c	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ uspace/app/tmon/test.c	(revision 41ebc36bbe2b8fb1b2ac81a65869d1a0b8499f2e)
@@ -40,6 +40,5 @@
 #include <errno.h>
 #include <str_error.h>
-#include <usb/diag/diag.h>
-#include <usb/diag/iface.h>
+#include <usbdiag_iface.h>
 #include "commands.h"
 
@@ -53,6 +52,6 @@
 	int rc;
 
-	if ((rc = loc_category_get_id(USB_DIAG_CATEGORY, &diag_cat, 0))) {
-		printf(NAME ": Error resolving category '%s'", USB_DIAG_CATEGORY);
+	if ((rc = loc_category_get_id(USBDIAG_CATEGORY, &diag_cat, 0))) {
+		printf(NAME ": Error resolving category '%s'", USBDIAG_CATEGORY);
 		return rc;
 	}
@@ -116,10 +115,10 @@
 
 static int bulk_worker(devman_handle_t fun) {
-	async_sess_t *sess = usb_diag_connect(fun);
+	async_sess_t *sess = usbdiag_connect(fun);
 	async_exch_t *exch = async_exchange_begin(sess);
 
 	// TODO: do some testing
 	int y;
-	int rc = usb_diag_test(exch, 4200, &y);
+	int rc = usbdiag_test(exch, 4200, &y);
 
 	if (rc) {
@@ -130,5 +129,5 @@
 
 	async_exchange_end(exch);
-	usb_diag_disconnect(sess);
+	usbdiag_disconnect(sess);
 	return 0;
 }
Index: uspace/drv/bus/usb/usbdiag/Makefile
===================================================================
--- uspace/drv/bus/usb/usbdiag/Makefile	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ uspace/drv/bus/usb/usbdiag/Makefile	(revision 41ebc36bbe2b8fb1b2ac81a65869d1a0b8499f2e)
@@ -29,5 +29,5 @@
 USPACE_PREFIX = ../../../..
 
-LIBS = usbdiag usbdev usb drv
+LIBS = usbdev usb drv
 
 BINARY = usbdiag
Index: uspace/drv/bus/usb/usbdiag/device.c
===================================================================
--- uspace/drv/bus/usb/usbdiag/device.c	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ uspace/drv/bus/usb/usbdiag/device.c	(revision 41ebc36bbe2b8fb1b2ac81a65869d1a0b8499f2e)
@@ -36,5 +36,5 @@
 #include <errno.h>
 #include <usb/debug.h>
-#include <usb/diag/iface.h>
+#include <usbdiag_iface.h>
 
 #include "device.h"
@@ -48,5 +48,5 @@
 }
 
-static usb_diag_iface_t diag_interface = {
+static usbdiag_iface_t diag_interface = {
 	.test = some_test,
 };
Index: uspace/drv/bus/usb/usbdiag/main.c
===================================================================
--- uspace/drv/bus/usb/usbdiag/main.c	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ uspace/drv/bus/usb/usbdiag/main.c	(revision 41ebc36bbe2b8fb1b2ac81a65869d1a0b8499f2e)
@@ -37,5 +37,5 @@
 #include <usb/debug.h>
 #include <usb/dev/driver.h>
-#include <usb/diag/diag.h>
+#include <usbdiag_iface.h>
 #include <str_error.h>
 
@@ -61,7 +61,7 @@
 	}
 
-	if ((rc = ddf_fun_add_to_category(diag_dev->fun, USB_DIAG_CATEGORY))) {
+	if ((rc = ddf_fun_add_to_category(diag_dev->fun, USBDIAG_CATEGORY))) {
 		usb_log_error("Failed add DDF to category '"
-		    USB_DIAG_CATEGORY "': %s.\n", str_error(rc));
+		    USBDIAG_CATEGORY "': %s.\n", str_error(rc));
 		goto err_bind;
 	}
Index: uspace/lib/drv/Makefile
===================================================================
--- uspace/lib/drv/Makefile	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ uspace/lib/drv/Makefile	(revision 41ebc36bbe2b8fb1b2ac81a65869d1a0b8499f2e)
@@ -48,4 +48,5 @@
 	generic/remote_usb.c \
 	generic/remote_pci.c \
+	generic/remote_usbdiag.c \
 	generic/remote_usbhc.c \
 	generic/remote_usbhid.c \
Index: uspace/lib/drv/generic/dev_iface.c
===================================================================
--- uspace/lib/drv/generic/dev_iface.c	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ uspace/lib/drv/generic/dev_iface.c	(revision 41ebc36bbe2b8fb1b2ac81a65869d1a0b8499f2e)
@@ -49,4 +49,5 @@
 #include "remote_ieee80211.h"
 #include "remote_usb.h"
+#include "remote_usbdiag.h"
 #include "remote_usbhc.h"
 #include "remote_usbhid.h"
@@ -67,4 +68,5 @@
 		[PCI_DEV_IFACE] = &remote_pci_iface,
 		[USB_DEV_IFACE] = &remote_usb_iface,
+		[USBDIAG_DEV_IFACE] = &remote_usbdiag_iface,
 		[USBHC_DEV_IFACE] = &remote_usbhc_iface,
 		[USBHID_DEV_IFACE] = &remote_usbhid_iface,
@@ -87,5 +89,5 @@
 	if (iface_method_idx >= rem_iface->method_count)
 		return NULL;
-	
+
 	return rem_iface->methods[iface_method_idx];
 }
Index: uspace/lib/usbdiag/Makefile
===================================================================
--- uspace/lib/usbdiag/Makefile	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2017 Petr Manek
-# 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.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libusbdiag
-LIBS = drv usb
-
-SOURCES = \
-	src/remote_usbdiag.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/usbdiag/include/usb/diag/diag.h
===================================================================
--- uspace/lib/usbdiag/include/usb/diag/diag.h	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * 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.
- */
-
-/** @addtogroup libusbdiag
- * @{
- */
-/** @file
- * @brief USB diagnostic device related types.
- */
-#ifndef LIBUSBDIAG_DIAG_H_
-#define LIBUSBDIAG_DIAG_H_
-
-#define USB_DIAG_CATEGORY "usbdiag"
-
-#endif
-/**
- * @}
- */
Index: uspace/lib/usbdiag/include/usb/diag/iface.h
===================================================================
--- uspace/lib/usbdiag/include/usb/diag/iface.h	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * 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.
- */
-
-/** @addtogroup libusbdiag
- * @{
- */
-/** @file
- * @brief USB diagnostic device communication interface.
- */
-#ifndef LIBUSBDIAG_IFACE_H_
-#define LIBUSBDIAG_IFACE_H_
-
-#include <async.h>
-#include <ddf/driver.h>
-
-async_sess_t *usb_diag_connect(devman_handle_t);
-void usb_diag_disconnect(async_sess_t*);
-int usb_diag_test(async_exch_t*, int, int*);
-
-/** USB diagnostic device communication interface. */
-typedef struct {
-	int (*test)(ddf_fun_t*, int, int*);
-} usb_diag_iface_t;
-
-#endif
-/**
- * @}
- */
Index: uspace/lib/usbdiag/src/remote_usbdiag.c
===================================================================
--- uspace/lib/usbdiag/src/remote_usbdiag.c	(revision fc338e0106f262c2c03301e6708b4ee2a6b365ef)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * 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.
- */
-
-/** @addtogroup libusbdiag
- * @{
- */
-/** @file
- * USB diagnostic device remote interface.
- */
-
-#include <async.h>
-#include <assert.h>
-#include <macros.h>
-#include <errno.h>
-#include <devman.h>
-
-#include <usb/diag/iface.h>
-#include "ddf/driver.h"
-
-typedef enum {
-	IPC_M_USB_DIAG_TEST,
-} usb_iface_funcs_t;
-
-async_sess_t *usb_diag_connect(devman_handle_t handle)
-{
-	return devman_device_connect(handle, IPC_FLAG_BLOCKING);
-}
-
-void usb_diag_disconnect(async_sess_t *sess)
-{
-	if (sess)
-		async_hangup(sess);
-}
-
-int usb_diag_test(async_exch_t *exch, int x, int *y)
-{
-	if (!exch)
-		return EBADMEM;
-
-	sysarg_t y_;
-	const int ret = async_req_2_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USB_DIAG_TEST, x, &y_);
-
-	if (y)
-		*y = (int) y_;
-
-	return ret;
-}
-
-static void remote_usb_diag_test(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
-
-/** Remote USB diagnostic interface operations. */
-static const remote_iface_func_ptr_t remote_usb_diag_iface_ops [] = {
-	[IPC_M_USB_DIAG_TEST] = remote_usb_diag_test,
-};
-
-/** Remote USB diagnostic interface structure. */
-const remote_iface_t remote_usb_diag_iface = {
-	.method_count = ARRAY_SIZE(remote_usb_diag_iface_ops),
-	.methods = remote_usb_diag_iface_ops,
-};
-
-void remote_usb_diag_test(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
-{
-	const usb_diag_iface_t *diag_iface = (usb_diag_iface_t *) iface;
-
-	if (diag_iface->test == NULL) {
-		async_answer_0(callid, ENOTSUP);
-		return;
-	}
-
-	int x = DEV_IPC_GET_ARG1(*call);
-	int y;
-	const int ret = diag_iface->test(fun, x, &y);
-	if (ret != EOK) {
-		async_answer_0(callid, ret);
-	} else {
-		async_answer_1(callid, EOK, y);
-	}
-}
-
-/**
- * @}
- */
