Index: uspace/drv/vhc/hub.c
===================================================================
--- uspace/drv/vhc/hub.c	(revision f8597cabdd3924895ee98ca094e1d0c0220e85a7)
+++ uspace/drv/vhc/hub.c	(revision 1e32a63ee7521e8888774112ab783b2922419b6d)
@@ -181,8 +181,9 @@
 		hub_port_t *port = &hub_dev.ports[i];
 		
-		port->index = (int) i;
+		port->index = (int) i + 1;
 		port->device = NULL;
 		port->state = HUB_PORT_STATE_NOT_CONFIGURED;
 		port->status_change = 0;
+		fibril_mutex_initialize(&port->guard);
 	}
 	
@@ -225,6 +226,8 @@
 	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;
 		}
@@ -241,7 +244,9 @@
 		//if (port->state == HUB_PORT_STATE_DISCONNECTED) {
 			port->state = HUB_PORT_STATE_DISABLED;
-			set_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION);
+			set_port_status_change_nl(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 f8597cabdd3924895ee98ca094e1d0c0220e85a7)
+++ uspace/drv/vhc/hubintern.h	(revision 1e32a63ee7521e8888774112ab783b2922419b6d)
@@ -37,4 +37,5 @@
 
 #include "hub.h"
+#include <fibril_synch.h>
 
 /** Endpoint number for status change pipe. */
@@ -124,4 +125,5 @@
 	hub_port_state_t state;
 	uint16_t status_change;
+	fibril_mutex_t guard;
 } hub_port_t;
 
@@ -139,4 +141,5 @@
 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 f8597cabdd3924895ee98ca094e1d0c0220e85a7)
+++ uspace/drv/vhc/hubops.c	(revision 1e32a63ee7521e8888774112ab783b2922419b6d)
@@ -67,4 +67,6 @@
     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. */
@@ -135,7 +137,9 @@
 	async_usleep(change->delay);
 	
+	fibril_mutex_lock(&change->port->guard);
 	if (change->port->state == change->old_state) {
-		set_port_state(change->port, change->new_state);
-	}
+		set_port_state_nl(change->port, change->new_state);
+	}
+	fibril_mutex_unlock(&change->port->guard);
 	
 	free(change);
@@ -166,11 +170,22 @@
 void set_port_state(hub_port_t *port, hub_port_state_t state)
 {
-	dprintf(1, "setting port %d state to %d (%c)", port->index,
-	    state, hub_port_state_as_char(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);
 	
 	if (state == HUB_PORT_STATE_POWERED_OFF) {
-		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);
+		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);
 	}
 	if (state == HUB_PORT_STATE_RESUMING) {
@@ -184,5 +199,5 @@
 	if ((port->state == HUB_PORT_STATE_RESETTING)
 	    && (state == HUB_PORT_STATE_ENABLED)) {
-		set_port_status_change(port, HUB_STATUS_C_PORT_RESET);
+		set_port_status_change_nl(port, HUB_STATUS_C_PORT_RESET);
 	}
 	
@@ -212,43 +227,61 @@
 	_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(port, HUB_PORT_STATE_DISABLED);
-			}
-			return EOK;
+				set_port_state_nl(port, HUB_PORT_STATE_DISABLED);
+			}
+			rc = EOK;
+			break;
 		
 		case USB_HUB_FEATURE_PORT_SUSPEND:
 			if (port->state != HUB_PORT_STATE_SUSPENDED) {
-				return EOK;
-			}
-			set_port_state(port, HUB_PORT_STATE_RESUMING);
-			return EOK;
+				rc = EOK;
+				break;
+			}
+			set_port_state_nl(port, HUB_PORT_STATE_RESUMING);
+			rc = EOK;
+			break;
 			
 		case USB_HUB_FEATURE_PORT_POWER:
 			if (port->state != HUB_PORT_STATE_NOT_CONFIGURED) {
-				set_port_state(port, HUB_PORT_STATE_POWERED_OFF);
-			}
-			return EOK;
+				set_port_state_nl(port, HUB_PORT_STATE_POWERED_OFF);
+			}
+			rc = EOK;
+			break;
 		
 		case USB_HUB_FEATURE_C_PORT_CONNECTION:
-			clear_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION);
-			return EOK;
+			clear_port_status_change_nl(port, HUB_STATUS_C_PORT_CONNECTION);
+			rc = EOK;
+			break;
 		
 		case USB_HUB_FEATURE_C_PORT_ENABLE:
-			clear_port_status_change(port, HUB_STATUS_C_PORT_ENABLE);
-			return EOK;
+			clear_port_status_change_nl(port, HUB_STATUS_C_PORT_ENABLE);
+			rc = EOK;
+			break;
 		
 		case USB_HUB_FEATURE_C_PORT_SUSPEND:
-			clear_port_status_change(port, HUB_STATUS_C_PORT_SUSPEND);
-			return EOK;
+			clear_port_status_change_nl(port, HUB_STATUS_C_PORT_SUSPEND);
+			rc = EOK;
+			break;
 			
 		case USB_HUB_FEATURE_C_PORT_OVER_CURRENT:
-			clear_port_status_change(port, HUB_STATUS_C_PORT_OVER_CURRENT);
-			return EOK;
-	}
-	
-	return ENOTSUP;
+			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;
 }
 
@@ -285,4 +318,6 @@
 	_GET_PORT(port, portindex);
 	
+	fibril_mutex_lock(&port->guard);
+
 	uint32_t status;
 	status = MAKE_BYTE(
@@ -312,4 +347,6 @@
 	status |= (port->status_change << 16);
 	
+	fibril_mutex_unlock(&port->guard);
+
 	dprintf(2, "GetPortStatus(port=%d, status=%u)\n", (int)portindex,
 	    (unsigned int) status);
@@ -327,24 +364,33 @@
 	_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(port, HUB_PORT_STATE_RESETTING);
-			}
-			return EOK;
+				set_port_state_nl(port, HUB_PORT_STATE_RESETTING);
+			}
+			rc = EOK;
+			break;
 		
 		case USB_HUB_FEATURE_PORT_SUSPEND:
 			if (port->state == HUB_PORT_STATE_ENABLED) {
-				set_port_state(port, HUB_PORT_STATE_SUSPENDED);
-			}
-			return EOK;
+				set_port_state_nl(port, HUB_PORT_STATE_SUSPENDED);
+			}
+			rc = EOK;
+			break;
 		
 		case USB_HUB_FEATURE_PORT_POWER:
 			if (port->state == HUB_PORT_STATE_POWERED_OFF) {
-				set_port_state(port, HUB_PORT_STATE_DISCONNECTED);
-			}
-			return EOK;
-	}
-	return ENOTSUP;
+				set_port_state_nl(port, HUB_PORT_STATE_DISCONNECTED);
+			}
+			rc = EOK;
+			break;
+	}
+
+	fibril_mutex_unlock(&port->guard);
+	return rc;
 }
 
@@ -416,12 +462,31 @@
 }
 
+void clear_port_status_change_nl(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)
+{
+	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)
 {
-	port->status_change &= (~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)
 {
-	port->status_change |= change;
+	fibril_mutex_lock(&port->guard);
+	set_port_status_change_nl(port, change);
+	fibril_mutex_unlock(&port->guard);
 }
 
@@ -441,7 +506,9 @@
 		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);
 	}
 	
