Index: HelenOS.config
===================================================================
--- HelenOS.config	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ HelenOS.config	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -547,4 +547,4 @@
 
 % Launch (devman) test drivers
-! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (y/n)
-
+! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (n/y)
+
Index: uspace/app/virtusbkbd/virtusbkbd.c
===================================================================
--- uspace/app/virtusbkbd/virtusbkbd.c	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/app/virtusbkbd/virtusbkbd.c	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -202,5 +202,5 @@
 int main(int argc, char * argv[])
 {
-	printf("Dump of report descriptor (%u bytes):\n", report_descriptor_size);
+	printf("Dump of report descriptor (%zu bytes):\n", report_descriptor_size);
 	size_t i;
 	for (i = 0; i < report_descriptor_size; i++) {
Index: uspace/drv/root/root.c
===================================================================
--- uspace/drv/root/root.c	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/drv/root/root.c	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -87,5 +87,6 @@
 
 	int res = child_device_register_wrapper(parent, VIRTUAL_DEVICE_NAME,
-	    VIRTUAL_DEVICE_MATCH_ID, VIRTUAL_DEVICE_MATCH_SCORE);
+	    VIRTUAL_DEVICE_MATCH_ID, VIRTUAL_DEVICE_MATCH_SCORE,
+	    NULL);
 
 	return res;
@@ -104,5 +105,6 @@
 	
 	int res = child_device_register_wrapper(parent, PLATFORM_DEVICE_NAME,
-	    PLATFORM_DEVICE_MATCH_ID, PLATFORM_DEVICE_MATCH_SCORE);
+	    PLATFORM_DEVICE_MATCH_ID, PLATFORM_DEVICE_MATCH_SCORE,
+	    NULL);
 
 	return res;
Index: uspace/drv/rootvirt/rootvirt.c
===================================================================
--- uspace/drv/rootvirt/rootvirt.c	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/drv/rootvirt/rootvirt.c	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -84,5 +84,5 @@
 
 	int rc = child_device_register_wrapper(parent, virt_dev->name,
-	    virt_dev->match_id, 10);
+	    virt_dev->match_id, 10, NULL);
 
 	if (rc == EOK) {
Index: uspace/drv/test1/test1.c
===================================================================
--- uspace/drv/test1/test1.c	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/drv/test1/test1.c	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -64,5 +64,5 @@
 
 	int rc = child_device_register_wrapper(parent, name,
-	    match_id, match_score);
+	    match_id, match_score, NULL);
 
 	if (rc == EOK) {
Index: uspace/drv/test2/test2.c
===================================================================
--- uspace/drv/test2/test2.c	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/drv/test2/test2.c	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -64,5 +64,5 @@
 
 	int rc = child_device_register_wrapper(parent, name,
-	    match_id, match_score);
+	    match_id, match_score, NULL);
 
 	if (rc == EOK) {
Index: uspace/drv/vhc/connhost.c
===================================================================
--- uspace/drv/vhc/connhost.c	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/drv/vhc/connhost.c	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -93,5 +93,5 @@
     usbhc_iface_transfer_out_callback_t callback, void *arg)
 {
-	printf(NAME ": transfer OUT [%d.%d (%s); %u]\n",
+	printf(NAME ": transfer OUT [%d.%d (%s); %zu]\n",
 	    target.address, target.endpoint,
 	    usb_str_transfer_type(transfer_type),
@@ -113,5 +113,5 @@
     usbhc_iface_transfer_out_callback_t callback, void *arg)
 {
-	printf(NAME ": transfer SETUP [%d.%d (%s); %u]\n",
+	printf(NAME ": transfer SETUP [%d.%d (%s); %zu]\n",
 	    target.address, target.endpoint,
 	    usb_str_transfer_type(transfer_type),
@@ -133,5 +133,5 @@
     usbhc_iface_transfer_in_callback_t callback, void *arg)
 {
-	printf(NAME ": transfer IN [%d.%d (%s); %u]\n",
+	printf(NAME ": transfer IN [%d.%d (%s); %zu]\n",
 	    target.address, target.endpoint,
 	    usb_str_transfer_type(transfer_type),
Index: uspace/drv/vhc/hcd.c
===================================================================
--- uspace/drv/vhc/hcd.c	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/drv/vhc/hcd.c	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -79,6 +79,5 @@
 	 * Initialize our hub and announce its presence.
 	 */
-	hub_init();
-	usb_hcd_add_root_hub(dev);
+	hub_init(dev);
 
 	printf("%s: virtual USB host controller ready.\n", NAME);
Index: uspace/drv/vhc/hub.c
===================================================================
--- uspace/drv/vhc/hub.c	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/drv/vhc/hub.c	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -37,9 +37,12 @@
 #include <usbvirt/device.h>
 #include <errno.h>
+#include <str_error.h>
 #include <stdlib.h>
+#include <driver.h>
 
 #include "vhcd.h"
 #include "hub.h"
 #include "hubintern.h"
+#include "conn.h"
 
 
@@ -148,6 +151,28 @@
 hub_device_t hub_dev;
 
+static usb_address_t hub_set_address(usbvirt_device_t *hub)
+{
+	usb_address_t new_address;
+	int rc = vhc_iface.request_address(NULL, &new_address);
+	if (rc != EOK) {
+		return rc;
+	}
+	
+	usb_device_request_setup_packet_t setup_packet = {
+		.request_type = 0,
+		.request = USB_DEVREQ_SET_ADDRESS,
+		.index = 0,
+		.length = 0,
+	};
+	setup_packet.value = new_address;
+
+	hub->transaction_setup(hub, 0, &setup_packet, sizeof(setup_packet));
+	hub->transaction_in(hub, 0, NULL, 0, NULL);
+	
+	return new_address;
+}
+
 /** Initialize virtual hub. */
-void hub_init(void)
+void hub_init(device_t *hc_dev)
 {
 	size_t i;
@@ -165,4 +190,27 @@
 	
 	dprintf(1, "virtual hub (%d ports) created", HUB_PORT_COUNT);
+
+	usb_address_t hub_address = hub_set_address(&virthub_dev);
+	if (hub_address < 0) {
+		dprintf(1, "problem changing hub address (%s)",
+		    str_error(hub_address));
+	}
+
+	dprintf(2, "virtual hub address changed to %d", hub_address);
+
+	char *id;
+	int rc = asprintf(&id, "usb&hub");
+	if (rc <= 0) {
+		return;
+	}
+	devman_handle_t hub_handle;
+	rc = child_device_register_wrapper(hc_dev, "hub", id, 10, &hub_handle);
+	if (rc != EOK) {
+		free(id);
+	}
+
+	vhc_iface.bind_address(NULL, hub_address, hub_handle);	
+
+	dprintf(2, "virtual hub has devman handle %d", (int) hub_handle);
 }
 
Index: uspace/drv/vhc/hub.h
===================================================================
--- uspace/drv/vhc/hub.h	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/drv/vhc/hub.h	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -37,4 +37,5 @@
 
 #include <usbvirt/device.h>
+#include <driver.h>
 
 #include "devices.h"
@@ -47,5 +48,5 @@
 extern usbvirt_device_t virthub_dev;
 
-void hub_init(void);
+void hub_init(device_t *);
 size_t hub_add_device(virtdev_connection_t *);
 void hub_remove_device(virtdev_connection_t *);
Index: uspace/lib/drv/generic/driver.c
===================================================================
--- uspace/lib/drv/generic/driver.c	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/lib/drv/generic/driver.c	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -390,5 +390,6 @@
  */
 int child_device_register_wrapper(device_t *parent, const char *child_name,
-    const char *child_match_id, int child_match_score)
+    const char *child_match_id, int child_match_score,
+    devman_handle_t *child_handle)
 {
 	device_t *child = NULL;
@@ -418,4 +419,7 @@
 		goto failure;
 
+	if (child_handle != NULL) {
+		*child_handle = child->handle;
+	}
 	return EOK;
 
Index: uspace/lib/drv/include/driver.h
===================================================================
--- uspace/lib/drv/include/driver.h	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/lib/drv/include/driver.h	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -199,5 +199,6 @@
 
 int child_device_register(device_t *, device_t *);
-int child_device_register_wrapper(device_t *, const char *, const char *, int);
+int child_device_register_wrapper(device_t *, const char *, const char *, int,
+    devman_handle_t *);
 
 
Index: uspace/lib/usb/Makefile
===================================================================
--- uspace/lib/usb/Makefile	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/lib/usb/Makefile	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -38,4 +38,5 @@
 	src/hcdhubd.c \
 	src/hcdrv.c \
+	src/hidparser.c \
 	src/localdrv.c \
 	src/remotedrv.c \
Index: uspace/lib/usb/include/usb/classes/hidparser.h
===================================================================
--- uspace/lib/usb/include/usb/classes/hidparser.h	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
+++ uspace/lib/usb/include/usb/classes/hidparser.h	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2010 Vojtech Horky
+ * 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 libusb usb
+ * @{
+ */
+/** @file
+ * @brief USB HID parser.
+ */
+#ifndef LIBUSB_HIDPARSER_H_
+#define LIBUSB_HIDPARSER_H_
+
+#include <stdint.h>
+
+/** HID report parser structure. */
+typedef struct {
+} usb_hid_report_parser_t;
+
+/** HID parser callbacks for IN items. */
+typedef struct {
+	/** Callback for keyboard.
+	 *
+	 * @param key_codes Array of pressed key (including modifiers).
+	 * @param count Length of @p key_codes.
+	 * @param arg Custom argument.
+	 */
+	void (*keyboard)(const uint32_t *key_codes, size_t count, void *arg);
+} usb_hid_report_in_callbacks_t;
+
+int usb_hid_parse_report_descriptor(usb_hid_report_parser_t *parser, 
+    const uint8_t *data);
+
+int usb_hid_parse_report(const usb_hid_report_parser_t *parser,  
+    const uint8_t *data,
+    const usb_hid_report_in_callbacks_t *callbacks, void *arg);
+
+#endif
+/**
+ * @}
+ */
Index: uspace/lib/usb/src/hidparser.c
===================================================================
--- uspace/lib/usb/src/hidparser.c	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
+++ uspace/lib/usb/src/hidparser.c	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2010 Vojtech Horky
+ * 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 libusb usb
+ * @{
+ */
+/** @file
+ * @brief HID parser implementation.
+ */
+#include <usb/classes/hidparser.h>
+#include <errno.h>
+
+/** Parse HID report descriptor.
+ *
+ * @param parser Opaque HID report parser structure.
+ * @param data Data describing the report.
+ * @return Error code.
+ */
+int usb_hid_parse_report_descriptor(usb_hid_report_parser_t *parser, 
+    const uint8_t *data)
+{
+	return ENOTSUP;
+}
+
+/** Parse and act upon a HID report.
+ *
+ * @see usb_hid_parse_report_descriptor
+ *
+ * @param parser Opaque HID report parser structure.
+ * @param data Data for the report.
+ * @param callbacks Callbacks for report actions.
+ * @param arg Custom argument (passed through to the callbacks).
+ * @return Error code.
+ */
+int usb_hid_parse_report(const usb_hid_report_parser_t *parser,  
+    const uint8_t *data,
+    const usb_hid_report_in_callbacks_t *callbacks, void *arg)
+{
+	return ENOTSUP;
+}
+
+
+/**
+ * @}
+ */
Index: uspace/lib/usb/src/remotedrv.c
===================================================================
--- uspace/lib/usb/src/remotedrv.c	(revision 100962316f11f4d28cc4be7eaf39ac3705dc69ca)
+++ uspace/lib/usb/src/remotedrv.c	(revision fa9b606e0a4d7d2b81ec316d32d2e9c5ba285fc1)
@@ -300,5 +300,5 @@
  */
 static void remote_in_callback(usb_hc_device_t *hc,
-    usb_transaction_outcome_t outcome, size_t actual_size, void *arg)
+    size_t actual_size, usb_transaction_outcome_t outcome, void *arg)
 {
 	transfer_info_t *transfer = (transfer_info_t *) arg;
