Index: uspace/drv/uhci-rhd/debug.h
===================================================================
--- uspace/drv/uhci-rhd/debug.h	(revision 993a1e1995b1035532146dda015f2c0bc264569e)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * 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 usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_ROOT_HUB_DEBUG_H
-#define DRV_UHCI_ROOT_HUB_DEBUG_H
-
-#include <stdio.h>
-#include <usb/debug.h>
-
-#include "name.h"
-
-
-enum debug_levels {
-	DEBUG_LEVEL_FATAL_ERROR = 1,
-	DEBUG_LEVEL_ERROR = 2,
-	DEBUG_LEVEL_WARNING = 3,
-	DEBUG_LEVEL_INFO = 4,
-	DEBUG_LEVEL_VERBOSE = 5,
-	DEBUG_LEVEL_MAX = DEBUG_LEVEL_VERBOSE
-};
-
-#define uhci_printf( level, fmt, args...) \
-	usb_dprintf(NAME, level, fmt, ##args)
-
-#define uhci_print_fatal( fmt, args... ) \
-	fprintf(stderr, "[" NAME ":FATAL ERROR]: " fmt, ##args)
-
-#define uhci_print_error( fmt, args... ) \
-	fprintf(stderr, "[" NAME ":ERROR]: " fmt, ##args)
-
-#define uhci_print_warning( fmt, args... ) \
-	usb_dprintf( NAME, DEBUG_LEVEL_WARNING, fmt, ##args )
-
-#define uhci_print_info( fmt, args... ) \
-	usb_dprintf( NAME, DEBUG_LEVEL_INFO, fmt, ##args )
-
-#define uhci_print_verbose( fmt, args... ) \
-	usb_dprintf( NAME, DEBUG_LEVEL_VERBOSE, fmt, ##args )
-
-#endif
-/**
- * @}
- */
Index: uspace/drv/uhci-rhd/main.c
===================================================================
--- uspace/drv/uhci-rhd/main.c	(revision 993a1e1995b1035532146dda015f2c0bc264569e)
+++ uspace/drv/uhci-rhd/main.c	(revision 7ce0fe353ce29538995c8bc73076b8da8ca5cde4)
@@ -28,17 +28,20 @@
 #include <driver.h>
 #include <errno.h>
-#include <str_error.h>
+
 #include <usb_iface.h>
+#include <usb/debug.h>
 
-#include "debug.h"
-//#include "iface.h"
 #include "root_hub.h"
+
+#define NAME "uhci-rhd"
 
 static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle)
 {
-	/* This shall be called only for the UHCI itself. */
 	assert(dev);
 	assert(dev->driver_data);
+	assert(handle);
+
 	*handle = ((uhci_root_hub_t*)dev->driver_data)->hc_handle;
+	usb_log_debug("Answering HC handle: %d.\n", *handle);
 
 	return EOK;
@@ -58,17 +61,24 @@
 		return ENOTSUP;
 
-	uhci_print_info("%s called device %d\n", __FUNCTION__, device->handle);
+	usb_log_debug2("%s called device %d\n", __FUNCTION__, device->handle);
 	device->ops = &uhci_rh_ops;
 
 	uhci_root_hub_t *rh = malloc(sizeof(uhci_root_hub_t));
 	if (!rh) {
+		usb_log_error("Failed to allocate memory for driver instance.\n");
 		return ENOMEM;
 	}
+
+	/* TODO: get register values from hc */
 	int ret = uhci_root_hub_init(rh, (void*)0xc030, 4, device);
 	if (ret != EOK) {
+		usb_log_error("Failed(%d) to initialize driver instance.\n", ret);
 		free(rh);
 		return ret;
 	}
+
 	device->driver_data = rh;
+	usb_log_info("Sucessfully initialized driver isntance for device:%d.\n",
+	    device->handle);
 	return EOK;
 }
@@ -85,9 +95,5 @@
 int main(int argc, char *argv[])
 {
-	/*
-	 * Do some global initializations.
-	 */
-	usb_dprintf_enable(NAME, DEBUG_LEVEL_INFO);
-
+	usb_log_enable(USB_LOG_LEVEL_INFO, NAME);
 	return driver_main(&uhci_rh_driver);
 }
Index: uspace/drv/uhci-rhd/name.h
===================================================================
--- uspace/drv/uhci-rhd/name.h	(revision 993a1e1995b1035532146dda015f2c0bc264569e)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * 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 usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_RHD_NAME_H
-#define DRV_UHCI_RHD_NAME_H
-
-#define NAME "uhci-rhd"
-
-#endif
-/**
- * @}
- */
Index: uspace/drv/uhci-rhd/port.c
===================================================================
--- uspace/drv/uhci-rhd/port.c	(revision 993a1e1995b1035532146dda015f2c0bc264569e)
+++ uspace/drv/uhci-rhd/port.c	(revision 7ce0fe353ce29538995c8bc73076b8da8ca5cde4)
@@ -1,8 +1,9 @@
 
 #include <errno.h>
+
 #include <usb/usb.h>    /* usb_address_t */
 #include <usb/usbdrv.h> /* usb_drv_*     */
+#include <usb/debug.h>
 
-#include "debug.h"
 #include "port.h"
 #include "port_status.h"
@@ -27,9 +28,9 @@
 	port->checker = fibril_create(uhci_port_check, port);
 	if (port->checker == 0) {
-		uhci_print_error(": failed to launch root hub fibril.");
+		usb_log_error(": failed to launch root hub fibril.");
 		return ENOMEM;
 	}
 	fibril_add_ready(port->checker);
-	uhci_print_verbose(
+	usb_log_debug(
 	  "Added fibril for port %d: %p.\n", number, port->checker);
 	return EOK;
@@ -49,5 +50,5 @@
 
 	while (1) {
-		uhci_print_verbose("Port(%d) status address %p:\n",
+		usb_log_debug("Port(%d) status address %p:\n",
 		  port_instance->number, port_instance->address);
 
@@ -57,5 +58,5 @@
 
 		/* debug print */
-		uhci_print_info("Port(%d) status %#.4x\n",
+		usb_log_info("Port(%d) status %#.4x\n",
 		  port_instance->number, port_status);
 		print_port_status(port_status);
@@ -79,5 +80,5 @@
 	assert(port->hc_phone);
 
-	uhci_print_info("Adding new device on port %d.\n", port->number);
+	usb_log_info("Adding new device on port %d.\n", port->number);
 
 
@@ -85,5 +86,5 @@
 	int ret = usb_drv_reserve_default_address(port->hc_phone);
 	if (ret != EOK) {
-		uhci_print_error("Failed to reserve default address.\n");
+		usb_log_error("Failed to reserve default address.\n");
 		return ret;
 	}
@@ -92,5 +93,5 @@
 
 	if (usb_address <= 0) {
-		uhci_print_error("Recieved invalid address(%d).\n", usb_address);
+		usb_log_error("Recieved invalid address(%d).\n", usb_address);
 		return usb_address;
 	}
@@ -122,9 +123,9 @@
 
 	if (ret != EOK) { /* address assigning went wrong */
-		uhci_print_error("Failed(%d) to assign address to the device.\n", ret);
+		usb_log_error("Failed(%d) to assign address to the device.\n", ret);
 		uhci_port_set_enabled(port, false);
 		int release = usb_drv_release_default_address(port->hc_phone);
 		if (release != EOK) {
-			uhci_print_fatal("Failed to release default address.\n");
+			usb_log_error("Failed to release default address.\n");
 			return release;
 		}
@@ -135,5 +136,5 @@
 	ret = usb_drv_release_default_address(port->hc_phone);
 	if (ret != EOK) {
-		uhci_print_fatal("Failed to release default address.\n");
+		usb_log_error("Failed to release default address.\n");
 		return ret;
 	}
@@ -146,9 +147,9 @@
 
 	if (ret != EOK) { /* something went wrong */
-		uhci_print_error("Failed(%d) in usb_drv_register_child.\n", ret);
+		usb_log_error("Failed(%d) in usb_drv_register_child.\n", ret);
 		uhci_port_set_enabled(port, false);
 		return ENOMEM;
 	}
-	uhci_print_info("Sucessfully added device on port(%d) address(%d).\n",
+	usb_log_info("Sucessfully added device on port(%d) address(%d).\n",
 		port->number, usb_address);
 
@@ -160,5 +161,5 @@
 static int uhci_port_remove_device(uhci_port_t *port)
 {
-	uhci_print_error("Don't know how to remove device %#x.\n",
+	usb_log_error("Don't know how to remove device %#x.\n",
 		(unsigned int)port->attached_device);
 	uhci_port_set_enabled(port, false);
@@ -182,5 +183,5 @@
 	port_status_write(port->address, port_status);
 
-	uhci_print_info("%s port %d.\n",
+	usb_log_info("%s port %d.\n",
 	  enabled ? "Enabled" : "Disabled", port->number);
 	return EOK;
Index: uspace/drv/uhci-rhd/port_status.c
===================================================================
--- uspace/drv/uhci-rhd/port_status.c	(revision 993a1e1995b1035532146dda015f2c0bc264569e)
+++ uspace/drv/uhci-rhd/port_status.c	(revision 7ce0fe353ce29538995c8bc73076b8da8ca5cde4)
@@ -2,5 +2,6 @@
 #include <stdio.h>
 
-#include "debug.h"
+#include <usb/debug.h>
+
 #include "port_status.h"
 
@@ -30,5 +31,5 @@
 	unsigned i = 0;
 	for (;i < sizeof(flags)/sizeof(struct flag_name); ++i) {
-		uhci_print_verbose("\t%s status: %s.\n", flags[i].name,
+		usb_log_debug("\t%s status: %s.\n", flags[i].name,
 		  value & flags[i].flag ? "YES" : "NO");
 	}
Index: uspace/drv/uhci-rhd/port_status.h
===================================================================
--- uspace/drv/uhci-rhd/port_status.h	(revision 993a1e1995b1035532146dda015f2c0bc264569e)
+++ uspace/drv/uhci-rhd/port_status.h	(revision 7ce0fe353ce29538995c8bc73076b8da8ca5cde4)
@@ -35,5 +35,6 @@
 #define DRV_UHCI_TD_PORT_STATUS_H
 
-#include <libarch/ddi.h>
+#include <libarch/ddi.h> /* pio_read and pio_write */
+
 #include <stdint.h>
 
@@ -59,5 +60,5 @@
 
 static inline void port_status_write(
-  port_status_t * address, port_status_t value)
+  port_status_t *address, port_status_t value)
 	{ pio_write_16(address, value); }
 
Index: uspace/drv/uhci-rhd/root_hub.c
===================================================================
--- uspace/drv/uhci-rhd/root_hub.c	(revision 993a1e1995b1035532146dda015f2c0bc264569e)
+++ uspace/drv/uhci-rhd/root_hub.c	(revision 7ce0fe353ce29538995c8bc73076b8da8ca5cde4)
@@ -6,6 +6,6 @@
 
 #include <usb/usbdrv.h>
+#include <usb/debug.h>
 
-#include "debug.h"
 #include "root_hub.h"
 
@@ -18,5 +18,5 @@
 	int ret;
 	ret = usb_drv_find_hc(rh, &instance->hc_handle);
-	uhci_print_info("rh found(%d) hc handle: %d.\n", ret, instance->hc_handle);
+	usb_log_info("rh found(%d) hc handle: %d.\n", ret, instance->hc_handle);
 	if (ret != EOK) {
 		return ret;
@@ -27,5 +27,5 @@
 	//usb_drv_hc_connect(rh, instance->hc_handle, 0);
 	if (rh->parent_phone < 0) {
-		uhci_print_error("Failed to connect to the HC device.\n");
+		usb_log_error("Failed to connect to the HC device.\n");
 		return rh->parent_phone;
 	}
@@ -38,5 +38,5 @@
 
 	if (ret < 0) {
-		uhci_print_error(": Failed to gain access to port registers at %p\n", regs);
+		usb_log_error("Failed to gain access to port registers at %p\n", regs);
 		return ret;
 	}
Index: uspace/drv/uhci-rhd/root_hub.h
===================================================================
--- uspace/drv/uhci-rhd/root_hub.h	(revision 993a1e1995b1035532146dda015f2c0bc264569e)
+++ uspace/drv/uhci-rhd/root_hub.h	(revision 7ce0fe353ce29538995c8bc73076b8da8ca5cde4)
@@ -52,5 +52,5 @@
   uhci_root_hub_t *instance, void *addr, size_t size, device_t *rh);
 
-int uhci_root_hub_fini(uhci_root_hub_t* instance);
+int uhci_root_hub_fini(uhci_root_hub_t *instance);
 #endif
 /**
