Index: uspace/drv/bus/usb/usbdbg/Makefile
===================================================================
--- uspace/drv/bus/usb/usbdbg/Makefile	(revision d23fab97e57b15cd1fbea89eab8cc010012d018b)
+++ uspace/drv/bus/usb/usbdbg/Makefile	(revision 6c8a221c66cdde9dbbef610536973040efb27a64)
@@ -34,4 +34,5 @@
 
 SOURCES = \
+	device.c \
 	main.c \
 
Index: uspace/drv/bus/usb/usbdbg/device.c
===================================================================
--- uspace/drv/bus/usb/usbdbg/device.c	(revision 6c8a221c66cdde9dbbef610536973040efb27a64)
+++ uspace/drv/bus/usb/usbdbg/device.c	(revision 6c8a221c66cdde9dbbef610536973040efb27a64)
@@ -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 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 6c8a221c66cdde9dbbef610536973040efb27a64)
+++ uspace/drv/bus/usb/usbdbg/device.h	(revision 6c8a221c66cdde9dbbef610536973040efb27a64)
@@ -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 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 d23fab97e57b15cd1fbea89eab8cc010012d018b)
+++ uspace/drv/bus/usb/usbdbg/main.c	(revision 6c8a221c66cdde9dbbef610536973040efb27a64)
@@ -38,33 +38,62 @@
 #include <usb/dev/driver.h>
 
+#include "usbdbg.h"
+#include "device.h"
+
 #define NAME "usbdbg"
 
-static int usbdbg_device_add(usb_device_t *dev)
+static int device_add(usb_device_t *dev)
 {
-	usb_log_info("usbdbg_device_add");
+	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 usbdbg_device_remove(usb_device_t *dev)
+static int device_remove(usb_device_t *dev)
 {
-	usb_log_info("usbdbg_device_remove");
+	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 usbdbg_device_gone(usb_device_t *dev)
+static int device_gone(usb_device_t *dev)
 {
-	usb_log_info("usbdbg_device_gone");
+	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 usbdbg_function_online(ddf_fun_t *fun)
+static int function_online(ddf_fun_t *fun)
 {
-	/* TODO: What if this is the control function? */
 	return ddf_fun_online(fun);
 }
 
-static int usbdbg_function_offline(ddf_fun_t *fun)
+static int function_offline(ddf_fun_t *fun)
 {
-	/* TODO: What if this is the control function? */
 	return ddf_fun_offline(fun);
 }
@@ -72,9 +101,9 @@
 /** USB debug driver ops. */
 static const usb_driver_ops_t dbg_driver_ops = {
-	.device_add = usbdbg_device_add,
-	.device_rem = usbdbg_device_remove,
-	.device_gone = usbdbg_device_gone,
-	.function_online = usbdbg_function_online,
-	.function_offline = usbdbg_function_offline
+	.device_add = device_add,
+	.device_rem = device_remove,
+	.device_gone = device_gone,
+	.function_online = function_online,
+	.function_offline = function_offline
 };
 
Index: uspace/drv/bus/usb/usbdbg/usbdbg.h
===================================================================
--- uspace/drv/bus/usb/usbdbg/usbdbg.h	(revision 6c8a221c66cdde9dbbef610536973040efb27a64)
+++ uspace/drv/bus/usb/usbdbg/usbdbg.h	(revision 6c8a221c66cdde9dbbef610536973040efb27a64)
@@ -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 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_ */
+
+/**
+ * @}
+ */
