Index: uspace/app/virtusbkbd/virtusbkbd.c
===================================================================
--- uspace/app/virtusbkbd/virtusbkbd.c	(revision 37f7cfe6ab80448fed991af05947b5c57080be0f)
+++ uspace/app/virtusbkbd/virtusbkbd.c	(revision 682b6975f8a183bb1f605afed230dd1411a1ab5f)
@@ -55,6 +55,5 @@
 #include "stdreq.h"
 
-/** Pause between individual key-presses in seconds. */
-#define KEY_PRESS_DELAY 2
+#define LOOPS 5
 #define NAME "virt-usb-kbd"
 
@@ -84,32 +83,7 @@
 }
 
-/** Compares current and last status of pressed keys.
- *
- * @warning Has side-efect - changes status_last field.
- *
- * @param status_now Status now.
- * @param status_last Last status.
- * @param len Size of status.
- * @return Whether they are the same.
- */
-static bool keypress_check_with_last_request(uint8_t *status_now,
-    uint8_t *status_last, size_t len)
-{
-	bool same = true;
-	size_t i;
-	for (i = 0; i < len; i++) {
-		if (status_now[i] != status_last[i]) {
-			status_last[i] = status_now[i];
-			same = false;
-		}
-	}
-	return same;
-}
-
 static int on_request_for_data(struct usbvirt_device *dev,
     usb_endpoint_t endpoint, void *buffer, size_t size, size_t *actual_size)
 {
-	static uint8_t last_data[2 + KB_MAX_KEYS_AT_ONCE];
-
 	if (size < 2 + KB_MAX_KEYS_AT_ONCE) {
 		return EINVAL;
@@ -127,10 +101,4 @@
 	}
 	
-	if (keypress_check_with_last_request(data, last_data,
-	    2 + KB_MAX_KEYS_AT_ONCE)) {
-		*actual_size = 0;
-		return EOK;
-	}
-
 	memcpy(buffer, &data, *actual_size);
 	
@@ -184,6 +152,4 @@
 	.ops = &keyboard_ops,
 	.descriptors = &descriptors,
-	.lib_debug_level = 3,
-	.lib_debug_enabled_tags = USBVIRT_DEBUGTAG_ALL,
 	.name = "keyboard"
 };
@@ -211,5 +177,5 @@
 	printf("\n");
 	
-	fibril_sleep(KEY_PRESS_DELAY);
+	fibril_sleep(1);
 }
 
@@ -257,5 +223,5 @@
 	
 	printf("%s: Simulating keyboard events...\n", NAME);
-	while (1) {
+	while(1){
 		kb_process_events(&status, keyboard_events, keyboard_events_count,
 			on_keyboard_change);
Index: uspace/drv/usbhub/main.c
===================================================================
--- uspace/drv/usbhub/main.c	(revision 37f7cfe6ab80448fed991af05947b5c57080be0f)
+++ uspace/drv/usbhub/main.c	(revision 682b6975f8a183bb1f605afed230dd1411a1ab5f)
@@ -50,5 +50,5 @@
 	while(true){
 		usb_hub_check_hub_changes();
-		async_usleep(1000 * 1000);
+		async_usleep(10000000);
 	}
 	return 0;
Index: uspace/drv/usbhub/usbhub_private.h
===================================================================
--- uspace/drv/usbhub/usbhub_private.h	(revision 37f7cfe6ab80448fed991af05947b5c57080be0f)
+++ uspace/drv/usbhub/usbhub_private.h	(revision 682b6975f8a183bb1f605afed230dd1411a1ab5f)
@@ -182,22 +182,4 @@
 }
 
-static inline int usb_hub_clear_port_feature(int hc, usb_address_t address,
-    int port_index,
-    usb_hub_class_feature_t feature) {
-	usb_target_t target = {
-		.address = address,
-		.endpoint = 0
-	};
-	usb_device_request_setup_packet_t clear_request = {
-		.request_type = USB_HUB_REQ_TYPE_CLEAR_PORT_FEATURE,
-		.request = USB_DEVREQ_CLEAR_FEATURE,
-		.length = 0,
-		.index = port_index
-	};
-	clear_request.value = feature;
-	return usb_drv_psync_control_write(hc, target, &clear_request,
-	    sizeof(clear_request), NULL, 0);
-}
-
 
 
Index: uspace/drv/usbhub/utils.c
===================================================================
--- uspace/drv/usbhub/utils.c	(revision 37f7cfe6ab80448fed991af05947b5c57080be0f)
+++ uspace/drv/usbhub/utils.c	(revision 682b6975f8a183bb1f605afed230dd1411a1ab5f)
@@ -506,38 +506,27 @@
 		int hc, uint16_t port, usb_target_t target) {
 
+	usb_device_request_setup_packet_t request;
 	int opResult;
 	printf("[usb_hub] finalizing add device\n");
-	opResult = usb_hub_clear_port_feature(hc, target.address,
-	    port, USB_HUB_FEATURE_C_PORT_RESET);
-	if (opResult != EOK) {
-		goto release;
-	}
-
-	/* Request address at from host controller. */
-	usb_address_t new_device_address = usb_drv_request_address(hc);
-	if (new_device_address < 0) {
-		printf("[usb_hub] failed to get free USB address\n");
-		opResult = new_device_address;
-		goto release;
-	}
-	printf("[usb_hub] setting new address\n");
-	opResult = usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT,
-	    new_device_address);
-
+	usb_address_t new_device_address =
+			usb_drv_request_address(hc);
+	usb_hub_set_set_address_request
+			(&request, new_device_address);
+	opResult = usb_drv_sync_control_write(
+			hc, target,
+			&request,
+			NULL, 0
+			);
 	if (opResult != EOK) {
 		printf("[usb_hub] could not set address for new device\n");
-		goto release;
-	}
-
-release:
-	printf("[usb_hub] releasing default address\n");
+		//will retry later...
+		return;
+	}
+
 	usb_drv_release_default_address(hc);
-	if (opResult != EOK) {
-		return;
-	}
 
 	devman_handle_t child_handle;
 	opResult = usb_drv_register_child_in_devman(hc, hub->device,
-            new_device_address, &child_handle);
+        new_device_address, &child_handle);
 	if (opResult != EOK) {
 		printf("[usb_hub] could not start driver for new device \n");
@@ -554,4 +543,5 @@
 	printf("[usb_hub] new device address %d, handle %d\n",
 	    new_device_address, child_handle);
+	sleep(60);
 	
 }
@@ -630,7 +620,4 @@
 	//something connected/disconnected
 	if (usb_port_connect_change(&status)) {
-		opResult = usb_hub_clear_port_feature(hc, target.address,
-		    port, USB_HUB_FEATURE_C_PORT_CONNECTION);
-		// TODO: check opResult
 		if (usb_port_dev_connected(&status)) {
 			printf("[usb_hub] some connection changed\n");
@@ -642,5 +629,5 @@
 	//port reset
 	if (usb_port_reset_completed(&status)) {
-		printf("[usb_hub] port reset complete\n");
+		printf("[usb_hub] finalizing add device\n");
 		if (usb_port_enabled(&status)) {
 			usb_hub_finalize_add_device(hub, hc, port, target);
@@ -683,4 +670,5 @@
 			lst_item != &usb_hub_list;
 			lst_item = lst_item->next) {
+		printf("[usb_hub] checking hub changes\n");
 		usb_hub_info_t * hub_info = ((usb_hub_info_t*)lst_item->data);
 		/*
@@ -691,6 +679,5 @@
 		target.address = hub_info->usb_device->address;
 		target.endpoint = 1;/// \TODO get from endpoint descriptor
-		printf("[usb_hub] checking changes for hub at addr %d\n",
-		    target.address);
+		printf("checking changes for hub at addr %d \n",target.address);
 
 		size_t port_count = hub_info->port_count;
Index: uspace/drv/usbkbd/main.c
===================================================================
--- uspace/drv/usbkbd/main.c	(revision 37f7cfe6ab80448fed991af05947b5c57080be0f)
+++ uspace/drv/usbkbd/main.c	(revision 682b6975f8a183bb1f605afed230dd1411a1ab5f)
@@ -39,5 +39,5 @@
 #define NAME "usbkbd"
 
-#define GUESSED_POLL_ENDPOINT 1
+static const usb_endpoint_t CONTROL_EP = 0;
 
 /*
@@ -155,5 +155,5 @@
 
 	// default endpoint
-	kbd_dev->poll_endpoint = GUESSED_POLL_ENDPOINT;
+	kbd_dev->default_ep = CONTROL_EP;
 	
 	/*
@@ -204,9 +204,8 @@
 	usb_target_t poll_target = {
 		.address = kbd_dev->address,
-		.endpoint = kbd_dev->poll_endpoint
+		.endpoint = kbd_dev->default_ep
 	};
 
 	while (true) {
-		async_usleep(1000 * 1000);
 		rc = usb_drv_async_interrupt_in(kbd_dev->device->parent_phone,
 		    poll_target, buffer, BUFFER_SIZE, &actual_size, &handle);
Index: uspace/drv/vhc/hc.c
===================================================================
--- uspace/drv/vhc/hc.c	(revision 37f7cfe6ab80448fed991af05947b5c57080be0f)
+++ uspace/drv/vhc/hc.c	(revision 682b6975f8a183bb1f605afed230dd1411a1ab5f)
@@ -50,7 +50,7 @@
 #include "hub.h"
 
-#define USLEEP_BASE (0 * 5 * 1000)
+#define USLEEP_BASE (0 * 500 * 1000)
 
-#define USLEEP_VAR 50
+#define USLEEP_VAR 5000
 
 #define SHORTENING_VAR 15
@@ -89,5 +89,5 @@
     usb_transaction_outcome_t outcome)
 {
-	dprintf(3, "transaction " TRANSACTION_FORMAT " done, outcome: %s",
+	dprintf(3, "processing transaction " TRANSACTION_FORMAT ", outcome: %s",
 	    TRANSACTION_PRINTF(*transaction),
 	    usb_str_transaction_outcome(outcome));
@@ -116,5 +116,5 @@
 		char ports[HUB_PORT_COUNT + 2];
 		hub_get_port_statuses(ports, HUB_PORT_COUNT + 1);
-		dprintf(4, "virtual hub: addr=%d ports=%s",
+		dprintf(0, "virtual hub: addr=%d ports=%s",
 		    virthub_dev.address, ports);
 		
@@ -124,8 +124,4 @@
 		list_remove(first_transaction_link);
 		
-
-		dprintf(0, "about to process " TRANSACTION_FORMAT " (vhub:%s)",
-		    TRANSACTION_PRINTF(*transaction), ports);
-
 		dprintf(3, "processing transaction " TRANSACTION_FORMAT "",
 		    TRANSACTION_PRINTF(*transaction));
Index: uspace/drv/vhc/hcd.c
===================================================================
--- uspace/drv/vhc/hcd.c	(revision 37f7cfe6ab80448fed991af05947b5c57080be0f)
+++ uspace/drv/vhc/hcd.c	(revision 682b6975f8a183bb1f605afed230dd1411a1ab5f)
@@ -110,5 +110,5 @@
 	printf("%s: virtual USB host controller driver.\n", NAME);
 
-	usb_dprintf_enable(NAME, 0);
+	usb_dprintf_enable(NAME, 2);
 
 	fid_t fid = fibril_create(hc_manager_fibril, NULL);
Index: uspace/drv/vhc/hub.c
===================================================================
--- uspace/drv/vhc/hub.c	(revision 37f7cfe6ab80448fed991af05947b5c57080be0f)
+++ uspace/drv/vhc/hub.c	(revision 682b6975f8a183bb1f605afed230dd1411a1ab5f)
@@ -144,5 +144,5 @@
 	.ops = &hub_ops,
 	.descriptors = &descriptors,
-	.lib_debug_level = 0,
+	.lib_debug_level = 1,
 	.lib_debug_enabled_tags = USBVIRT_DEBUGTAG_ALL
 };
@@ -181,9 +181,8 @@
 		hub_port_t *port = &hub_dev.ports[i];
 		
-		port->index = (int) i + 1;
+		port->index = (int) i;
 		port->device = NULL;
 		port->state = HUB_PORT_STATE_NOT_CONFIGURED;
 		port->status_change = 0;
-		fibril_mutex_initialize(&port->guard);
 	}
 	
@@ -226,8 +225,6 @@
 	for (i = 0; i < HUB_PORT_COUNT; i++) {
 		hub_port_t *port = &hub_dev.ports[i];
-		fibril_mutex_lock(&port->guard);
 		
 		if (port->device != NULL) {
-			fibril_mutex_unlock(&port->guard);
 			continue;
 		}
@@ -244,9 +241,7 @@
 		//if (port->state == HUB_PORT_STATE_DISCONNECTED) {
 			port->state = HUB_PORT_STATE_DISABLED;
-			set_port_status_change_nl(port, HUB_STATUS_C_PORT_CONNECTION);
+			set_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION);
 		//}
 		
-		fibril_mutex_unlock(&port->guard);
-
 		return i;
 	}
Index: uspace/drv/vhc/hubintern.h
===================================================================
--- uspace/drv/vhc/hubintern.h	(revision 37f7cfe6ab80448fed991af05947b5c57080be0f)
+++ uspace/drv/vhc/hubintern.h	(revision 682b6975f8a183bb1f605afed230dd1411a1ab5f)
@@ -37,5 +37,4 @@
 
 #include "hub.h"
-#include <fibril_synch.h>
 
 /** Endpoint number for status change pipe. */
@@ -125,5 +124,4 @@
 	hub_port_state_t state;
 	uint16_t status_change;
-	fibril_mutex_t guard;
 } hub_port_t;
 
@@ -141,5 +139,4 @@
 void clear_port_status_change(hub_port_t *, uint16_t);
 void set_port_status_change(hub_port_t *, uint16_t);
-void set_port_status_change_nl(hub_port_t *, uint16_t);
 
 
Index: uspace/drv/vhc/hubops.c
===================================================================
--- uspace/drv/vhc/hubops.c	(revision 37f7cfe6ab80448fed991af05947b5c57080be0f)
+++ uspace/drv/vhc/hubops.c	(revision 682b6975f8a183bb1f605afed230dd1411a1ab5f)
@@ -67,6 +67,4 @@
     void *buffer, size_t size, size_t *actual_size);
 static void set_port_state(hub_port_t *, hub_port_state_t);
-static void clear_port_status_change_nl(hub_port_t *, uint16_t);
-static void set_port_state_nl(hub_port_t *, hub_port_state_t);
 
 /** Standard USB requests. */
@@ -137,9 +135,7 @@
 	async_usleep(change->delay);
 	
-	fibril_mutex_lock(&change->port->guard);
 	if (change->port->state == change->old_state) {
-		set_port_state_nl(change->port, change->new_state);
-	}
-	fibril_mutex_unlock(&change->port->guard);
+		set_port_state(change->port, change->new_state);
+	}
 	
 	free(change);
@@ -170,22 +166,11 @@
 void set_port_state(hub_port_t *port, hub_port_state_t state)
 {
-	fibril_mutex_lock(&port->guard);
-	set_port_state_nl(port, state);
-	fibril_mutex_unlock(&port->guard);
-}
-
-void set_port_state_nl(hub_port_t *port, hub_port_state_t state)
-{
-
-	dprintf(2, "setting port %d state to %d (%c) from %c (change=%u)",
-	    port->index,
-	    state, hub_port_state_as_char(state),
-	    hub_port_state_as_char(port->state),
-	    (unsigned int) port->status_change);
+	dprintf(1, "setting port %d state to %d (%c)", port->index,
+	    state, hub_port_state_as_char(state));
 	
 	if (state == HUB_PORT_STATE_POWERED_OFF) {
-		clear_port_status_change_nl(port, HUB_STATUS_C_PORT_CONNECTION);
-		clear_port_status_change_nl(port, HUB_STATUS_C_PORT_ENABLE);
-		clear_port_status_change_nl(port, HUB_STATUS_C_PORT_RESET);
+		clear_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION);
+		clear_port_status_change(port, HUB_STATUS_C_PORT_ENABLE);
+		clear_port_status_change(port, HUB_STATUS_C_PORT_RESET);
 	}
 	if (state == HUB_PORT_STATE_RESUMING) {
@@ -199,5 +184,5 @@
 	if ((port->state == HUB_PORT_STATE_RESETTING)
 	    && (state == HUB_PORT_STATE_ENABLED)) {
-		set_port_status_change_nl(port, HUB_STATUS_C_PORT_RESET);
+		set_port_status_change(port, HUB_STATUS_C_PORT_RESET);
 	}
 	
@@ -227,61 +212,43 @@
 	_GET_PORT(port, portindex);
 	
-	fibril_mutex_lock(&port->guard);
-	int rc = ENOTSUP;
-
 	switch (feature) {
 		case USB_HUB_FEATURE_PORT_ENABLE:
 			if ((port->state != HUB_PORT_STATE_NOT_CONFIGURED)
 			    && (port->state != HUB_PORT_STATE_POWERED_OFF)) {
-				set_port_state_nl(port, HUB_PORT_STATE_DISABLED);
-			}
-			rc = EOK;
-			break;
+				set_port_state(port, HUB_PORT_STATE_DISABLED);
+			}
+			return EOK;
 		
 		case USB_HUB_FEATURE_PORT_SUSPEND:
 			if (port->state != HUB_PORT_STATE_SUSPENDED) {
-				rc = EOK;
-				break;
-			}
-			set_port_state_nl(port, HUB_PORT_STATE_RESUMING);
-			rc = EOK;
-			break;
+				return EOK;
+			}
+			set_port_state(port, HUB_PORT_STATE_RESUMING);
+			return EOK;
 			
 		case USB_HUB_FEATURE_PORT_POWER:
 			if (port->state != HUB_PORT_STATE_NOT_CONFIGURED) {
-				set_port_state_nl(port, HUB_PORT_STATE_POWERED_OFF);
-			}
-			rc = EOK;
-			break;
+				set_port_state(port, HUB_PORT_STATE_POWERED_OFF);
+			}
+			return EOK;
 		
 		case USB_HUB_FEATURE_C_PORT_CONNECTION:
-			clear_port_status_change_nl(port, HUB_STATUS_C_PORT_CONNECTION);
-			rc = EOK;
-			break;
+			clear_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION);
+			return EOK;
 		
 		case USB_HUB_FEATURE_C_PORT_ENABLE:
-			clear_port_status_change_nl(port, HUB_STATUS_C_PORT_ENABLE);
-			rc = EOK;
-			break;
+			clear_port_status_change(port, HUB_STATUS_C_PORT_ENABLE);
+			return EOK;
 		
 		case USB_HUB_FEATURE_C_PORT_SUSPEND:
-			clear_port_status_change_nl(port, HUB_STATUS_C_PORT_SUSPEND);
-			rc = EOK;
-			break;
+			clear_port_status_change(port, HUB_STATUS_C_PORT_SUSPEND);
+			return EOK;
 			
 		case USB_HUB_FEATURE_C_PORT_OVER_CURRENT:
-			clear_port_status_change_nl(port, HUB_STATUS_C_PORT_OVER_CURRENT);
-			rc = EOK;
-			break;
-
-		case USB_HUB_FEATURE_C_PORT_RESET:
-			clear_port_status_change_nl(port, HUB_STATUS_C_PORT_RESET);
-			rc = EOK;
-			break;
-	}
-	
-	fibril_mutex_unlock(&port->guard);
-
-	return rc;
+			clear_port_status_change(port, HUB_STATUS_C_PORT_OVER_CURRENT);
+			return EOK;
+	}
+	
+	return ENOTSUP;
 }
 
@@ -318,6 +285,4 @@
 	_GET_PORT(port, portindex);
 	
-	fibril_mutex_lock(&port->guard);
-
 	uint32_t status;
 	status = MAKE_BYTE(
@@ -347,6 +312,4 @@
 	status |= (port->status_change << 16);
 	
-	fibril_mutex_unlock(&port->guard);
-
 	dprintf(2, "GetPortStatus(port=%d, status=%u)\n", (int)portindex,
 	    (unsigned int) status);
@@ -364,33 +327,24 @@
 	_GET_PORT(port, portindex);
 	
-	fibril_mutex_lock(&port->guard);
-
-	int rc = ENOTSUP;
-
 	switch (feature) {
 		case USB_HUB_FEATURE_PORT_RESET:
 			if (port->state != HUB_PORT_STATE_POWERED_OFF) {
-				set_port_state_nl(port, HUB_PORT_STATE_RESETTING);
-			}
-			rc = EOK;
-			break;
+				set_port_state(port, HUB_PORT_STATE_RESETTING);
+			}
+			return EOK;
 		
 		case USB_HUB_FEATURE_PORT_SUSPEND:
 			if (port->state == HUB_PORT_STATE_ENABLED) {
-				set_port_state_nl(port, HUB_PORT_STATE_SUSPENDED);
-			}
-			rc = EOK;
-			break;
+				set_port_state(port, HUB_PORT_STATE_SUSPENDED);
+			}
+			return EOK;
 		
 		case USB_HUB_FEATURE_PORT_POWER:
 			if (port->state == HUB_PORT_STATE_POWERED_OFF) {
-				set_port_state_nl(port, HUB_PORT_STATE_DISCONNECTED);
-			}
-			rc = EOK;
-			break;
-	}
-
-	fibril_mutex_unlock(&port->guard);
-	return rc;
+				set_port_state(port, HUB_PORT_STATE_DISCONNECTED);
+			}
+			return EOK;
+	}
+	return ENOTSUP;
 }
 
@@ -462,31 +416,12 @@
 }
 
-void clear_port_status_change_nl(hub_port_t *port, uint16_t change)
+void clear_port_status_change(hub_port_t *port, uint16_t change)
 {
 	port->status_change &= (~change);
-	dprintf(2, "cleared port %d status change %d (%u)", port->index,
-	    (int)change, (unsigned int) port->status_change);
-}
-
-void set_port_status_change_nl(hub_port_t *port, uint16_t change)
+}
+
+void set_port_status_change(hub_port_t *port, uint16_t change)
 {
 	port->status_change |= change;
-	dprintf(2, "set port %d status change %d (%u)", port->index,
-	    (int)change, (unsigned int) port->status_change);
-
-}
-
-void clear_port_status_change(hub_port_t *port, uint16_t change)
-{
-	fibril_mutex_lock(&port->guard);
-	clear_port_status_change_nl(port, change);
-	fibril_mutex_unlock(&port->guard);
-}
-
-void set_port_status_change(hub_port_t *port, uint16_t change)
-{
-	fibril_mutex_lock(&port->guard);
-	set_port_status_change_nl(port, change);
-	fibril_mutex_unlock(&port->guard);
 }
 
@@ -506,9 +441,7 @@
 		hub_port_t *port = &hub_dev.ports[i];
 		
-		fibril_mutex_lock(&port->guard);
 		if (port->status_change != 0) {
 			change_map |= (1 << (i + 1));
 		}
-		fibril_mutex_unlock(&port->guard);
 	}
 	
Index: uspace/lib/usb/include/usb/classes/hid.h
===================================================================
--- uspace/lib/usb/include/usb/classes/hid.h	(revision 37f7cfe6ab80448fed991af05947b5c57080be0f)
+++ uspace/lib/usb/include/usb/classes/hid.h	(revision 682b6975f8a183bb1f605afed230dd1411a1ab5f)
@@ -100,5 +100,5 @@
 	device_t *device;
 	usb_address_t address;
-	usb_endpoint_t poll_endpoint;
+	usb_endpoint_t default_ep;
 	usb_hid_report_parser_t *parser;
 } usb_hid_dev_kbd_t;
Index: uspace/lib/usbvirt/callback.c
===================================================================
--- uspace/lib/usbvirt/callback.c	(revision 37f7cfe6ab80448fed991af05947b5c57080be0f)
+++ uspace/lib/usbvirt/callback.c	(revision 682b6975f8a183bb1f605afed230dd1411a1ab5f)
@@ -155,5 +155,5 @@
 	 * If the request was processed, we will send data back.
 	 */
-	if ((rc == EOK) && (expected_len > 0)) {
+	if (rc == EOK) {
 		size_t receive_len;
 		ipc_callid_t callid;
