Index: uspace/app/virtusbhub/Makefile
===================================================================
--- uspace/app/virtusbhub/Makefile	(revision 84a04dd25d7cd11efb773bec08ac26839806991d)
+++ 	(revision )
@@ -1,62 +1,0 @@
-#
-# Copyright (c) 2011 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.
-#
-
-USPACE_PREFIX = ../..
-# acronym for virtual USB hub
-# (it is really annoying to write long names)
-BINARY = vuh
-
-LIBS = $(LIBUSB_PREFIX)/libusb.a $(LIBUSBVIRT_PREFIX)/libusbvirt.a
-EXTRA_CFLAGS = -DSTANDALONE_HUB \
-	-DHUB_PORT_COUNT=10 \
-	-I$(LIBUSB_PREFIX)/include -I$(LIBUSBVIRT_PREFIX)/include -I$(LIBDRV_PREFIX)/include
-
-SOURCES = \
-	main.c \
-	$(STOLEN_VHC_SOURCES)
-
-STOLEN_VHC_SOURCES = \
-	vhc_hub/hub.c \
-	vhc_hub/virthub.c \
-	vhc_hub/virthubops.c 
-STOLEN_VHC_HEADERS = \
-	vhc_hub/hub.h \
-	vhc_hub/virthub.h
-
-PRE_DEPEND = $(STOLEN_VHC_SOURCES) $(STOLEN_VHC_HEADERS)
-
-EXTRA_CLEAN = $(STOLEN_VHC_SOURCES) $(STOLEN_VHC_HEADERS)
-
-HUB_IN_VHC = $(USPACE_PREFIX)/drv/vhc/hub
-
-include $(USPACE_PREFIX)/Makefile.common
-
-vhc_hub/%.h: $(HUB_IN_VHC)/%.h
-	ln -sfn ../$(HUB_IN_VHC)/$*.h $@
-vhc_hub/%.c: $(HUB_IN_VHC)/%.c
-	ln -sfn ../$(HUB_IN_VHC)/$*.c $@
Index: uspace/app/virtusbhub/main.c
===================================================================
--- uspace/app/virtusbhub/main.c	(revision 84a04dd25d7cd11efb773bec08ac26839806991d)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2011 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 usbvirthub
- * @{
- */
-/**
- * @file
- * @brief Virtual USB hub.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <str_error.h>
-#include <bool.h>
-
-#include <usb/usb.h>
-#include <usb/descriptor.h>
-#include <usb/classes/hub.h>
-#include <usbvirt/device.h>
-#include <usbvirt/hub.h>
-
-#include "vhc_hub/virthub.h"
-
-#define NAME "vuh"
-
-static usbvirt_device_t hub_device;
-
-#define VERBOSE_SLEEP(sec, msg, ...) \
-	do { \
-		char _status[HUB_PORT_COUNT + 2]; \
-		printf(NAME ": doing nothing for %zu seconds...\n", \
-		    (size_t) (sec)); \
-		fibril_sleep((sec)); \
-		virthub_get_status(&hub_device, _status, HUB_PORT_COUNT + 1); \
-		printf(NAME ": " msg " [%s]\n" #__VA_ARGS__, _status); \
-	} while (0)
-
-static void fibril_sleep(size_t sec)
-{
-	while (sec-- > 0) {
-		async_usleep(1000*1000);
-	}
-}
-
-static int dev1 = 1;
-
-int main(int argc, char * argv[])
-{
-	int rc;
-
-	printf(NAME ": virtual USB hub.\n");
-
-	rc = virthub_init(&hub_device);
-	if (rc != EOK) {
-		printf(NAME ": Unable to start communication with VHCD (%s).\n",
-		    str_error(rc));
-		return rc;
-	}
-	
-	while (true) {
-		VERBOSE_SLEEP(8, "will pretend device plug-in...");
-		virthub_connect_device(&hub_device, &dev1);
-
-		VERBOSE_SLEEP(8, "will pretend device un-plug...");
-		virthub_disconnect_device(&hub_device, &dev1);
-	}
-
-	usbvirt_disconnect(&hub_device);
-	
-	return 0;
-}
-
-
-/** @}
- */
Index: uspace/app/virtusbkbd/Makefile
===================================================================
--- uspace/app/virtusbkbd/Makefile	(revision 84a04dd25d7cd11efb773bec08ac26839806991d)
+++ uspace/app/virtusbkbd/Makefile	(revision 6cb58e6c390c27448e632aaee17b98215c091f31)
@@ -32,5 +32,5 @@
 BINARY = vuk
 
-LIBS = $(LIBUSB_PREFIX)/libusb.a $(LIBUSBVIRT_PREFIX)/libusbvirt.a
+LIBS = $(LIBUSBVIRT_PREFIX)/libusbvirt.a $(LIBUSB_PREFIX)/libusb.a
 EXTRA_CFLAGS = -I$(LIBUSB_PREFIX)/include -I$(LIBUSBVIRT_PREFIX)/include -I$(LIBDRV_PREFIX)/include
 
Index: uspace/app/virtusbkbd/stdreq.c
===================================================================
--- uspace/app/virtusbkbd/stdreq.c	(revision 84a04dd25d7cd11efb773bec08ac26839806991d)
+++ uspace/app/virtusbkbd/stdreq.c	(revision 6cb58e6c390c27448e632aaee17b98215c091f31)
@@ -39,16 +39,18 @@
 #include "kbdconfig.h"
 
-int stdreq_on_get_descriptor(struct usbvirt_device *dev,
-    usb_device_request_setup_packet_t *request, uint8_t *data)
+int req_get_descriptor(usbvirt_device_t *device,
+    const usb_device_request_setup_packet_t *setup_packet,
+    uint8_t *data, size_t *act_size)
 {
-	if (request->value_high == USB_DESCTYPE_HID_REPORT) {
+	if (setup_packet->value_high == USB_DESCTYPE_HID_REPORT) {
 		/*
 		 * For simplicity, always return the same
 		 * report descriptor.
 		 */
-		int rc = dev->control_transfer_reply(dev, 0,
+		usbvirt_control_reply_helper(setup_packet,
+		    data, act_size,
 		    report_descriptor, report_descriptor_size);
-		
-		return rc;
+
+		return EOK;
 	}
 	
Index: uspace/app/virtusbkbd/stdreq.h
===================================================================
--- uspace/app/virtusbkbd/stdreq.h	(revision 84a04dd25d7cd11efb773bec08ac26839806991d)
+++ uspace/app/virtusbkbd/stdreq.h	(revision 6cb58e6c390c27448e632aaee17b98215c091f31)
@@ -38,6 +38,7 @@
 #include <usbvirt/device.h>
 
-int stdreq_on_get_descriptor(usbvirt_device_t *,
-    usb_device_request_setup_packet_t *, uint8_t *);
+int req_get_descriptor(usbvirt_device_t *device,
+    const usb_device_request_setup_packet_t *setup_packet,
+    uint8_t *data, size_t *act_size);
 
 #endif
Index: uspace/app/virtusbkbd/virtusbkbd.c
===================================================================
--- uspace/app/virtusbkbd/virtusbkbd.c	(revision 84a04dd25d7cd11efb773bec08ac26839806991d)
+++ uspace/app/virtusbkbd/virtusbkbd.c	(revision 6cb58e6c390c27448e632aaee17b98215c091f31)
@@ -48,6 +48,6 @@
 #include <usb/descriptor.h>
 #include <usb/classes/hid.h>
+#include <usb/debug.h>
 #include <usbvirt/device.h>
-#include <usbvirt/hub.h>
 
 #include "kbdconfig.h"
@@ -67,13 +67,4 @@
 
 kb_status_t status;
-
-static int on_incoming_data(struct usbvirt_device *dev,
-    usb_endpoint_t endpoint, void *buffer, size_t size)
-{
-	printf("%s: ignoring incomming data to endpoint %d\n", NAME, endpoint);
-	
-	return EOK;
-}
-
 
 /** Compares current and last status of pressed keys.
@@ -100,6 +91,7 @@
 }
 
-static int on_request_for_data(struct usbvirt_device *dev,
-    usb_endpoint_t endpoint, void *buffer, size_t size, size_t *actual_size)
+static int on_request_for_data(usbvirt_device_t *dev,
+    usb_endpoint_t endpoint, usb_transfer_type_t transfer_type,
+    void *buffer, size_t size, size_t *actual_size)
 {
 	static uint8_t last_data[2 + KB_MAX_KEYS_AT_ONCE];
@@ -122,6 +114,5 @@
 	if (keypress_check_with_last_request(data, last_data,
 	    2 + KB_MAX_KEYS_AT_ONCE)) {
-		*actual_size = 0;
-		return EOK;
+		return ENAK;
 	}
 
@@ -131,24 +122,16 @@
 }
 
-static usbvirt_control_transfer_handler_t endpoint_zero_handlers[] = {
-	{
-		.request_type = USBVIRT_MAKE_CONTROL_REQUEST_TYPE(
-		    USB_DIRECTION_IN,
-		    USBVIRT_REQUEST_TYPE_STANDARD,
-		    USBVIRT_REQUEST_RECIPIENT_DEVICE),
+static usbvirt_control_request_handler_t endpoint_zero_handlers[] = {
+	{
+		.req_direction = USB_DIRECTION_IN,
+		.req_type = USB_REQUEST_TYPE_STANDARD,
+		.req_recipient = USB_REQUEST_RECIPIENT_INTERFACE,
 		.request = USB_DEVREQ_GET_DESCRIPTOR,
 		.name = "GetDescriptor",
-		.callback = stdreq_on_get_descriptor
+		.callback = req_get_descriptor
 	},
 	{
-		.request_type = USBVIRT_MAKE_CONTROL_REQUEST_TYPE(
-		    USB_DIRECTION_IN,
-		    USBVIRT_REQUEST_TYPE_CLASS,
-		    USBVIRT_REQUEST_RECIPIENT_DEVICE),
-		.request = USB_DEVREQ_GET_DESCRIPTOR,
-		.name = "GetDescriptor",
-		.callback = stdreq_on_get_descriptor
-	},
-	USBVIRT_CONTROL_TRANSFER_HANDLER_LAST
+		.callback = NULL
+	}
 };
 
@@ -157,7 +140,6 @@
  */
 static usbvirt_device_ops_t keyboard_ops = {
-	.control_transfer_handlers = endpoint_zero_handlers,
-	.on_data = on_incoming_data,
-	.on_data_request = on_request_for_data
+	.control = endpoint_zero_handlers,
+	.data_in[1] = on_request_for_data
 };
 
@@ -197,6 +179,4 @@
 	.ops = &keyboard_ops,
 	.descriptors = &descriptors,
-	.lib_debug_level = 3,
-	.lib_debug_enabled_tags = USBVIRT_DEBUGTAG_ALL,
 	.name = "keyboard"
 };
@@ -262,5 +242,5 @@
 	
 	
-	int rc = usbvirt_connect(&keyboard_dev);
+	int rc = usbvirt_device_plug(&keyboard_dev, "/virt/usbhc/hc");
 	if (rc != EOK) {
 		printf("%s: Unable to start communication with VHCD (%s).\n",
@@ -278,5 +258,5 @@
 	printf("%s: Terminating...\n", NAME);
 	
-	usbvirt_disconnect(&keyboard_dev);
+	//usbvirt_disconnect(&keyboard_dev);
 	
 	return 0;
