Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision 1814b4ae1c83d2368908d3447899a6d660c78660)
+++ uspace/Makefile	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
@@ -151,5 +151,5 @@
 	drv/bus/usb/ohci \
 	drv/bus/usb/uhci \
-	drv/bus/usb/usbdbg \
+	drv/bus/usb/usbdiag \
 	drv/bus/usb/usbflbk \
 	drv/bus/usb/usbhub \
Index: uspace/drv/bus/usb/usbdbg/Makefile
===================================================================
--- uspace/drv/bus/usb/usbdbg/Makefile	(revision 1814b4ae1c83d2368908d3447899a6d660c78660)
+++ 	(revision )
@@ -1,39 +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 = ../../../..
-
-LIBS = usbdev usb drv
-
-BINARY = usbdbg
-
-SOURCES = \
-	device.c \
-	main.c \
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/drv/bus/usb/usbdbg/device.c
===================================================================
--- uspace/drv/bus/usb/usbdbg/device.c	(revision 1814b4ae1c83d2368908d3447899a6d660c78660)
+++ 	(revision )
@@ -1,88 +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 drvusbdbg
- * @{
- */
-/**
- * @file
- * Code for managing debug device structures.
- */
-#include <errno.h>
-#include <usb/debug.h>
-
-#include "device.h"
-
-#define NAME "usbdbg"
-
-static int device_init(usb_dbg_dev_t *dev)
-{
-	// TODO: allocate data structures, set up stuffs
-
-	return EOK;
-}
-
-static void device_fini(usb_dbg_dev_t *dev)
-{
-	// TODO: tear down data structures
-}
-
-int usb_dbg_dev_create(usb_device_t *dev, usb_dbg_dev_t **out_dbg_dev)
-{
-	assert(dev);
-	assert(out_dbg_dev);
-
-	usb_dbg_dev_t *dbg_dev = usb_device_data_alloc(dev, sizeof(usb_dbg_dev_t));
-	if (!dbg_dev)
-		return ENOMEM;
-
-	dbg_dev->usb_dev = dev;
-
-	int err;
-	if ((err = device_init(dbg_dev)))
-		goto err_init;
-
-	*out_dbg_dev = dbg_dev;
-	return EOK;
-
-err_init:
-	/* There is no usb_device_data_free. */
-	return err;
-}
-
-void usb_dbg_dev_destroy(usb_dbg_dev_t *dev)
-{
-	assert(dev);
-
-	device_fini(dev);
-	/* There is no usb_device_data_free. */
-}
-
-/**
- * @}
- */
Index: uspace/drv/bus/usb/usbdbg/device.h
===================================================================
--- uspace/drv/bus/usb/usbdbg/device.h	(revision 1814b4ae1c83d2368908d3447899a6d660c78660)
+++ 	(revision )
@@ -1,61 +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 drvusbdbg
- * @{
- */
-/** @file
- * USB debug device structures.
- */
-
-#ifndef USB_DBG_DEVICE_H_
-#define USB_DBG_DEVICE_H_
-
-#include <usb/dev/device.h>
-
-/**
- * USB debug device.
- */
-typedef struct usb_dbg_dev {
-	usb_device_t *usb_dev;
-} usb_dbg_dev_t;
-
-int usb_dbg_dev_create(usb_device_t *, usb_dbg_dev_t **);
-void usb_dbg_dev_destroy(usb_dbg_dev_t *);
-
-static inline usb_dbg_dev_t * usb_dbg_dev_get(usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	return usb_device_data_get(usb_dev);
-}
-
-#endif /* USB_DBG_USBDBG_H_ */
-
-/**
- * @}
- */
Index: uspace/drv/bus/usb/usbdbg/main.c
===================================================================
--- uspace/drv/bus/usb/usbdbg/main.c	(revision 1814b4ae1c83d2368908d3447899a6d660c78660)
+++ 	(revision )
@@ -1,128 +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 drvusbdbg
- * @{
- */
-/**
- * @file
- * Main routines of USB debug device driver.
- */
-#include <errno.h>
-#include <usb/debug.h>
-#include <usb/dev/driver.h>
-
-#include "usbdbg.h"
-#include "device.h"
-
-#define NAME "usbdbg"
-
-static int device_add(usb_device_t *dev)
-{
-	usb_log_info("Adding device '%s'", usb_device_get_name(dev));
-
-	int err;
-
-	usb_dbg_dev_t *dbg_dev;
-	if ((err = usb_dbg_dev_create(dev, &dbg_dev)))
-		return err;
-
-	/* TODO: Register device in some list. */
-	/* TODO: Register device DDF function. */
-
-	return EOK;
-}
-
-static int device_remove(usb_device_t *dev)
-{
-	usb_log_info("Removing device '%s'", usb_device_get_name(dev));
-
-	usb_dbg_dev_t *dbg_dev = usb_dbg_dev_get(dev);
-
-	/* TODO: Make sure nothing is going on with the device. */
-	/* TODO: Unregister device DDF function. */
-	/* TODO: Remove device from list */
-
-	usb_dbg_dev_destroy(dbg_dev);
-
-	return EOK;
-}
-
-static int device_gone(usb_device_t *dev)
-{
-	usb_log_info("Device '%s' gone.", usb_device_get_name(dev));
-
-	usb_dbg_dev_t *dbg_dev = usb_dbg_dev_get(dev);
-
-	/* TODO: Make sure nothing is going on with the device. */
-	/* TODO: Unregister device DDF function. */
-	/* TODO: Remove device from list */
-
-	usb_dbg_dev_destroy(dbg_dev);
-
-	return EOK;
-}
-
-static int function_online(ddf_fun_t *fun)
-{
-	return ddf_fun_online(fun);
-}
-
-static int function_offline(ddf_fun_t *fun)
-{
-	return ddf_fun_offline(fun);
-}
-
-/** USB debug driver ops. */
-static const usb_driver_ops_t dbg_driver_ops = {
-	.device_add = device_add,
-	.device_rem = device_remove,
-	.device_gone = device_gone,
-	.function_online = function_online,
-	.function_offline = function_offline
-};
-
-/** USB debug driver. */
-static const usb_driver_t dbg_driver = {
-	.name = NAME,
-	.ops = &dbg_driver_ops,
-	.endpoints = NULL
-};
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": USB debug device driver.\n");
-
-	log_init(NAME);
-
-	return usb_driver_main(&dbg_driver);
-}
-
-/**
- * @}
- */
Index: uspace/drv/bus/usb/usbdbg/usbdbg.h
===================================================================
--- uspace/drv/bus/usb/usbdbg/usbdbg.h	(revision 1814b4ae1c83d2368908d3447899a6d660c78660)
+++ 	(revision )
@@ -1,45 +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 drvusbdbg
- * @{
- */
-/** @file
- * USB debug device driver API.
- */
-
-#ifndef USB_DBG_USBDBG_H_
-#define USB_DBG_USBDBG_H_
-
-// TODO: Add some API.
-
-#endif /* USB_DBG_USBDBG_H_ */
-
-/**
- * @}
- */
Index: uspace/drv/bus/usb/usbdbg/usbdbg.ma
===================================================================
--- uspace/drv/bus/usb/usbdbg/usbdbg.ma	(revision 1814b4ae1c83d2368908d3447899a6d660c78660)
+++ 	(revision )
@@ -1,2 +1,0 @@
-100 usb&diagnostic
-100 usb&class=diagnostic
Index: uspace/drv/bus/usb/usbdiag/Makefile
===================================================================
--- uspace/drv/bus/usb/usbdiag/Makefile	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
+++ uspace/drv/bus/usb/usbdiag/Makefile	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
@@ -0,0 +1,39 @@
+#
+# 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 = ../../../..
+
+LIBS = usbdev usb drv
+
+BINARY = usbdiag
+
+SOURCES = \
+	device.c \
+	main.c \
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/drv/bus/usb/usbdiag/device.c
===================================================================
--- uspace/drv/bus/usb/usbdiag/device.c	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
+++ uspace/drv/bus/usb/usbdiag/device.c	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
@@ -0,0 +1,88 @@
+/*
+ * 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 drvusbdiag
+ * @{
+ */
+/**
+ * @file
+ * Code for managing debug device structures.
+ */
+#include <errno.h>
+#include <usb/debug.h>
+
+#include "device.h"
+
+#define NAME "usbdiag"
+
+static int device_init(usb_diag_dev_t *dev)
+{
+	// TODO: allocate data structures, set up stuffs
+
+	return EOK;
+}
+
+static void device_fini(usb_diag_dev_t *dev)
+{
+	// TODO: tear down data structures
+}
+
+int usb_diag_dev_create(usb_device_t *dev, usb_diag_dev_t **out_diag_dev)
+{
+	assert(dev);
+	assert(out_diag_dev);
+
+	usb_diag_dev_t *diag_dev = usb_device_data_alloc(dev, sizeof(usb_diag_dev_t));
+	if (!diag_dev)
+		return ENOMEM;
+
+	diag_dev->usb_dev = dev;
+
+	int err;
+	if ((err = device_init(diag_dev)))
+		goto err_init;
+
+	*out_diag_dev = diag_dev;
+	return EOK;
+
+err_init:
+	/* There is no usb_device_data_free. */
+	return err;
+}
+
+void usb_diag_dev_destroy(usb_diag_dev_t *dev)
+{
+	assert(dev);
+
+	device_fini(dev);
+	/* There is no usb_device_data_free. */
+}
+
+/**
+ * @}
+ */
Index: uspace/drv/bus/usb/usbdiag/device.h
===================================================================
--- uspace/drv/bus/usb/usbdiag/device.h	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
+++ uspace/drv/bus/usb/usbdiag/device.h	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
@@ -0,0 +1,61 @@
+/*
+ * 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 drvusbdiag
+ * @{
+ */
+/** @file
+ * USB diagnostic device structures.
+ */
+
+#ifndef USB_DIAG_DEVICE_H_
+#define USB_DIAG_DEVICE_H_
+
+#include <usb/dev/device.h>
+
+/**
+ * USB debug device.
+ */
+typedef struct usb_diag_dev {
+	usb_device_t *usb_dev;
+} usb_diag_dev_t;
+
+int usb_diag_dev_create(usb_device_t *, usb_diag_dev_t **);
+void usb_diag_dev_destroy(usb_diag_dev_t *);
+
+static inline usb_diag_dev_t * usb_diag_dev_get(usb_device_t *usb_dev)
+{
+	assert(usb_dev);
+	return usb_device_data_get(usb_dev);
+}
+
+#endif /* USB_DIAG_USBDIAG_H_ */
+
+/**
+ * @}
+ */
Index: uspace/drv/bus/usb/usbdiag/main.c
===================================================================
--- uspace/drv/bus/usb/usbdiag/main.c	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
+++ uspace/drv/bus/usb/usbdiag/main.c	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
@@ -0,0 +1,128 @@
+/*
+ * 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 drvusbdiag
+ * @{
+ */
+/**
+ * @file
+ * Main routines of USB debug device driver.
+ */
+#include <errno.h>
+#include <usb/debug.h>
+#include <usb/dev/driver.h>
+
+#include "usbdiag.h"
+#include "device.h"
+
+#define NAME "usbdiag"
+
+static int device_add(usb_device_t *dev)
+{
+	usb_log_info("Adding device '%s'", usb_device_get_name(dev));
+
+	int err;
+
+	usb_diag_dev_t *diag_dev;
+	if ((err = usb_diag_dev_create(dev, &diag_dev)))
+		return err;
+
+	/* TODO: Register device in some list. */
+	/* TODO: Register device DDF function. */
+
+	return EOK;
+}
+
+static int device_remove(usb_device_t *dev)
+{
+	usb_log_info("Removing device '%s'", usb_device_get_name(dev));
+
+	usb_diag_dev_t *diag_dev = usb_diag_dev_get(dev);
+
+	/* TODO: Make sure nothing is going on with the device. */
+	/* TODO: Unregister device DDF function. */
+	/* TODO: Remove device from list */
+
+	usb_diag_dev_destroy(diag_dev);
+
+	return EOK;
+}
+
+static int device_gone(usb_device_t *dev)
+{
+	usb_log_info("Device '%s' gone.", usb_device_get_name(dev));
+
+	usb_diag_dev_t *diag_dev = usb_diag_dev_get(dev);
+
+	/* TODO: Make sure nothing is going on with the device. */
+	/* TODO: Unregister device DDF function. */
+	/* TODO: Remove device from list */
+
+	usb_diag_dev_destroy(diag_dev);
+
+	return EOK;
+}
+
+static int function_online(ddf_fun_t *fun)
+{
+	return ddf_fun_online(fun);
+}
+
+static int function_offline(ddf_fun_t *fun)
+{
+	return ddf_fun_offline(fun);
+}
+
+/** USB debug driver ops. */
+static const usb_driver_ops_t diag_driver_ops = {
+	.device_add = device_add,
+	.device_rem = device_remove,
+	.device_gone = device_gone,
+	.function_online = function_online,
+	.function_offline = function_offline
+};
+
+/** USB debug driver. */
+static const usb_driver_t diag_driver = {
+	.name = NAME,
+	.ops = &diag_driver_ops,
+	.endpoints = NULL
+};
+
+int main(int argc, char *argv[])
+{
+	printf(NAME ": USB debug device driver.\n");
+
+	log_init(NAME);
+
+	return usb_driver_main(&diag_driver);
+}
+
+/**
+ * @}
+ */
Index: uspace/drv/bus/usb/usbdiag/usbdiag.h
===================================================================
--- uspace/drv/bus/usb/usbdiag/usbdiag.h	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
+++ uspace/drv/bus/usb/usbdiag/usbdiag.h	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
@@ -0,0 +1,45 @@
+/*
+ * 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 drvusbdiag
+ * @{
+ */
+/** @file
+ * USB diagnostic device driver API.
+ */
+
+#ifndef USB_DIAG_USBDIAG_H_
+#define USB_DIAG_USBDIAG_H_
+
+// TODO: Add some API.
+
+#endif /* USB_DIAG_USBDIAG_H_ */
+
+/**
+ * @}
+ */
Index: uspace/drv/bus/usb/usbdiag/usbdiag.ma
===================================================================
--- uspace/drv/bus/usb/usbdiag/usbdiag.ma	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
+++ uspace/drv/bus/usb/usbdiag/usbdiag.ma	(revision b7e14584b4e20939996e7e6c14f2582bcbac580e)
@@ -0,0 +1,2 @@
+100 usb&diagnostic
+100 usb&class=diagnostic
