Index: uspace/drv/usbhid/hiddev.c
===================================================================
--- uspace/drv/usbhid/hiddev.c	(revision 054ed846de9c6f3dabfc1f854569a8bf0abe0484)
+++ uspace/drv/usbhid/hiddev.c	(revision 382f32662aa02f5dcfd7631f34cc56ff47b61575)
@@ -158,4 +158,6 @@
 	}
 	
+	hid_dev->report_desc_size = length;
+	
 	usb_log_debug("Done.\n");
 	
@@ -262,8 +264,18 @@
 	
 	if (rc != EOK) {
-		usb_log_warning("Problem with parsing Report descriptor: %s.\n",
-		    str_error(rc));
-		return rc;
-	}
+		usb_log_warning("Problem with getting Report descriptor: %s.\n",
+		    str_error(rc));
+		return rc;
+	}
+	
+	rc = usb_hid_parse_report_descriptor(hid_dev->parser, 
+	    hid_dev->report_desc, hid_dev->report_desc_size);
+	if (rc != EOK) {
+		usb_log_warning("Problem parsing Report descriptor: %s.\n",
+		    str_error(rc));
+		return rc;
+	}
+	
+	usb_hid_descriptor_print(hid_dev->parser);
 	
 	return EOK;
@@ -289,4 +301,12 @@
 	
 	memset(dev, 0, sizeof(usbhid_dev_t));
+	
+	dev->parser = (usb_hid_report_parser_t *)(malloc(sizeof(
+	    usb_hid_report_parser_t)));
+	if (dev->parser == NULL) {
+		usb_log_fatal("No memory!\n");
+		free(dev);
+		return NULL;
+	}
 	
 	dev->initialized = 0;
@@ -399,4 +419,13 @@
 
 	/*
+	 * Initialize the report parser.
+	 */
+	rc = usb_hid_parser_init(hid_dev->parser);
+	if (rc != EOK) {
+		usb_log_error("Failed to initialize report parser.\n");
+		return rc;
+	}
+
+	/*
 	 * Get descriptors, parse descriptors and save endpoints.
 	 */
Index: uspace/drv/usbhid/hiddev.h
===================================================================
--- uspace/drv/usbhid/hiddev.h	(revision 054ed846de9c6f3dabfc1f854569a8bf0abe0484)
+++ uspace/drv/usbhid/hiddev.h	(revision 382f32662aa02f5dcfd7631f34cc56ff47b61575)
@@ -75,4 +75,7 @@
 	/** Report descriptor. */
 	uint8_t *report_desc;
+
+	size_t report_desc_size;
+
 	/** HID Report parser. */
 	usb_hid_report_parser_t *parser;
Index: uspace/drv/usbhid/kbddev.c
===================================================================
--- uspace/drv/usbhid/kbddev.c	(revision 054ed846de9c6f3dabfc1f854569a8bf0abe0484)
+++ uspace/drv/usbhid/kbddev.c	(revision 382f32662aa02f5dcfd7631f34cc56ff47b61575)
@@ -51,4 +51,5 @@
 #include <usb/classes/hidparser.h>
 #include <usb/classes/classes.h>
+#include <usb/classes/hidut.h>
 
 #include "kbddev.h"
@@ -122,4 +123,17 @@
 	KC_RALT,          /* USB_HID_MOD_RALT */
 	0,                /* USB_HID_MOD_RGUI */
+};
+
+typedef enum usbhid_lock_code {
+	USBHID_LOCK_NUM = 0x53,
+	USBHID_LOCK_CAPS = 0x39,
+	USBHID_LOCK_SCROLL = 0x47,
+	USBHID_LOCK_COUNT = 3
+} usbhid_lock_code;
+
+static const usbhid_lock_code usbhid_lock_codes[USBHID_LOCK_COUNT] = {
+	USBHID_LOCK_NUM,
+	USBHID_LOCK_CAPS,
+	USBHID_LOCK_SCROLL
 };
 
@@ -346,36 +360,45 @@
  * @sa usbhid_kbd_push_ev()
  */
-static void usbhid_kbd_check_modifier_changes(usbhid_kbd_t *kbd_dev,
-    uint8_t modifiers)
-{
-	/*
-	 * TODO: why the USB keyboard has NUM_, SCROLL_ and CAPS_LOCK
-	 *       both as modifiers and as keys with their own scancodes???
-	 *
-	 * modifiers should be sent as normal keys to usbhid_parse_scancode()!!
-	 * so maybe it would be better if I received it from report parser in 
-	 * that way
-	 */
-	
-	int i;
-	for (i = 0; i < USB_HID_MOD_COUNT; ++i) {
-		if ((modifiers & usb_hid_modifiers_consts[i]) &&
-		    !(kbd_dev->modifiers & usb_hid_modifiers_consts[i])) {
-			// modifier pressed
-			if (usbhid_modifiers_keycodes[i] != 0) {
-				usbhid_kbd_push_ev(kbd_dev, KEY_PRESS, 
-				    usbhid_modifiers_keycodes[i]);
-			}
-		} else if (!(modifiers & usb_hid_modifiers_consts[i]) &&
-		    (kbd_dev->modifiers & usb_hid_modifiers_consts[i])) {
-			// modifier released
-			if (usbhid_modifiers_keycodes[i] != 0) {
-				usbhid_kbd_push_ev(kbd_dev, KEY_RELEASE, 
-				    usbhid_modifiers_keycodes[i]);
-			}
-		}	// no change
-	}
-	
-	kbd_dev->modifiers = modifiers;
+//static void usbhid_kbd_check_modifier_changes(usbhid_kbd_t *kbd_dev, 
+//    const uint8_t *key_codes, size_t count)
+//{
+//	/*
+//	 * TODO: why the USB keyboard has NUM_, SCROLL_ and CAPS_LOCK
+//	 *       both as modifiers and as keyUSB_HID_LOCK_COUNTs with their own scancodes???
+//	 *
+//	 * modifiers should be sent as normal keys to usbhid_parse_scancode()!!
+//	 * so maybe it would be better if I received it from report parser in 
+//	 * that way
+//	 */
+	
+//	int i;
+//	for (i = 0; i < count; ++i) {
+//		if ((modifiers & usb_hid_modifiers_consts[i]) &&
+//		    !(kbd_dev->modifiers & usb_hid_modifiers_consts[i])) {
+//			// modifier pressed
+//			if (usbhid_modifiers_keycodes[i] != 0) {
+//				usbhid_kbd_push_ev(kbd_dev, KEY_PRESS, 
+//				    usbhid_modifiers_keycodes[i]);
+//			}
+//		} else if (!(modifiers & usb_hid_modifiers_consts[i]) &&
+//		    (kbd_dev->modifiers & usb_hid_modifiers_consts[i])) {
+//			// modifier released
+//			if (usbhid_modifiers_keycodes[i] != 0) {
+//				usbhid_kbd_push_ev(kbd_dev, KEY_RELEASE, 
+//				    usbhid_modifiers_keycodes[i]);
+//			}
+//		}	// no change
+//	}
+	
+//	kbd_dev->modifiers = modifiers;
+//}
+
+/*----------------------------------------------------------------------------*/
+
+static inline int usbhid_kbd_is_lock(unsigned int key_code) 
+{
+	return (key_code == KC_NUM_LOCK
+	    || key_code == KC_SCROLL_LOCK
+	    || key_code == KC_CAPS_LOCK);
 }
 
@@ -404,4 +427,7 @@
 	/*
 	 * First of all, check if the kbd have reported phantom state.
+	 *
+	 * TODO: this must be changed as we don't know which keys are modifiers
+	 *       and which are regular keys.
 	 */
 	i = 0;
@@ -434,5 +460,7 @@
 			// not found, i.e. the key was released
 			key = usbhid_parse_scancode(kbd_dev->keys[j]);
-			usbhid_kbd_repeat_stop(kbd_dev, key);
+			if (!usbhid_kbd_is_lock(key)) {
+				usbhid_kbd_repeat_stop(kbd_dev, key);
+			}
 			usbhid_kbd_push_ev(kbd_dev, KEY_RELEASE, key);
 			usb_log_debug2("Key released: %d\n", key);
@@ -458,5 +486,7 @@
 			    key_codes[i]);
 			usbhid_kbd_push_ev(kbd_dev, KEY_PRESS, key);
-			usbhid_kbd_repeat_start(kbd_dev, key);
+			if (!usbhid_kbd_is_lock(key)) {
+				usbhid_kbd_repeat_start(kbd_dev, key);
+			}
 		} else {
 			// found, nothing happens
@@ -502,5 +532,5 @@
 
 	usb_log_debug("Got keys from parser: %s\n", 
-	    usb_debug_str_buffer(key_codes, kbd_dev->key_count, 0));
+	    usb_debug_str_buffer(key_codes, count, 0));
 	
 	if (count != kbd_dev->key_count) {
@@ -510,5 +540,5 @@
 	}
 	
-	usbhid_kbd_check_modifier_changes(kbd_dev, modifiers);
+	///usbhid_kbd_check_modifier_changes(kbd_dev, key_codes, count);
 	usbhid_kbd_check_key_changes(kbd_dev, key_codes, count);
 }
@@ -535,4 +565,7 @@
                                     uint8_t *buffer, size_t actual_size)
 {
+	assert(kbd_dev->initialized);
+	assert(kbd_dev->hid_dev->parser != NULL);
+	
 	usb_hid_report_in_callbacks_t *callbacks =
 	    (usb_hid_report_in_callbacks_t *)malloc(
@@ -541,9 +574,11 @@
 	callbacks->keyboard = usbhid_kbd_process_keycodes;
 
-	usb_log_debug("Calling usb_hid_boot_keyboard_input_report() with "
+	usb_log_debug("Calling usb_hid_parse_report() with "
 	    "buffer %s\n", usb_debug_str_buffer(buffer, actual_size, 0));
 	
-	int rc = usb_hid_boot_keyboard_input_report(buffer, actual_size,
-	    callbacks, kbd_dev);
+//	int rc = usb_hid_boot_keyboard_input_report(buffer, actual_size,
+//	    callbacks, kbd_dev);
+	int rc = usb_hid_parse_report(kbd_dev->hid_dev->parser, buffer,
+	    actual_size, callbacks, kbd_dev);
 	
 	if (rc != EOK) {
@@ -614,5 +649,5 @@
 		free((*kbd_dev)->repeat_mtx);
 	}
-	
+
 	free(*kbd_dev);
 	*kbd_dev = NULL;
@@ -674,5 +709,13 @@
 	
 	// save the size of the report (boot protocol report by default)
-	kbd_dev->key_count = BOOTP_REPORT_SIZE;
+//	kbd_dev->key_count = BOOTP_REPORT_SIZE;
+	
+	usb_hid_report_path_t path;
+	path.usage_page = USB_HIDUT_PAGE_KEYBOARD;
+	kbd_dev->key_count = usb_hid_report_input_length(
+	    kbd_dev->hid_dev->parser, &path);
+	
+	usb_log_debug("Size of the input report: %zu\n", kbd_dev->key_count);
+	
 	kbd_dev->keys = (uint8_t *)calloc(
 	    kbd_dev->key_count, sizeof(uint8_t));
@@ -709,5 +752,5 @@
 	assert(kbd_dev->hid_dev != NULL);
 	assert(kbd_dev->hid_dev->initialized);
-	usbhid_req_set_protocol(kbd_dev->hid_dev, USB_HID_PROTOCOL_BOOT);
+	//usbhid_req_set_protocol(kbd_dev->hid_dev, USB_HID_PROTOCOL_BOOT);
 	
 	usbhid_kbd_set_led(kbd_dev);
Index: uspace/drv/usbhid/kbddev.h
===================================================================
--- uspace/drv/usbhid/kbddev.h	(revision 054ed846de9c6f3dabfc1f854569a8bf0abe0484)
+++ uspace/drv/usbhid/kbddev.h	(revision 382f32662aa02f5dcfd7631f34cc56ff47b61575)
@@ -42,4 +42,5 @@
 
 #include <usb/classes/hid.h>
+#include <usb/classes/hidparser.h>
 #include <ddf/driver.h>
 #include <usb/pipes.h>
Index: uspace/drv/usbhub/port_status.h
===================================================================
--- uspace/drv/usbhub/port_status.h	(revision 054ed846de9c6f3dabfc1f854569a8bf0abe0484)
+++ uspace/drv/usbhub/port_status.h	(revision 382f32662aa02f5dcfd7631f34cc56ff47b61575)
@@ -270,4 +270,21 @@
 }
 
+//low speed device attached
+static inline bool usb_port_high_speed(usb_port_status_t * status){
+	return usb_port_get_bit(status,10);
+}
+
+static inline void usb_port_set_high_speed(usb_port_status_t * status,bool high_speed){
+	usb_port_set_bit(status,10,high_speed);
+}
+
+static inline usb_speed_t usb_port_speed(usb_port_status_t * status){
+	if(usb_port_low_speed(status))
+		return USB_SPEED_LOW;
+	if(usb_port_high_speed(status))
+		return USB_SPEED_HIGH;
+	return USB_SPEED_FULL;
+}
+
 
 //connect change
Index: uspace/drv/usbhub/usbhub.c
===================================================================
--- uspace/drv/usbhub/usbhub.c	(revision 054ed846de9c6f3dabfc1f854569a8bf0abe0484)
+++ uspace/drv/usbhub/usbhub.c	(revision 382f32662aa02f5dcfd7631f34cc56ff47b61575)
@@ -78,6 +78,6 @@
 		async_usleep(1000 * 1000 );/// \TODO proper number once
 	}
-	dprintf(USB_LOG_LEVEL_ERROR,
-				"something in ctrl loop went wrong, errno %d",errorCode);
+	usb_log_error("something in ctrl loop went wrong, errno %d",errorCode);
+
 	return 0;
 }
@@ -104,6 +104,5 @@
 			hub->device);
 	if(opResult != EOK){
-		dprintf(USB_LOG_LEVEL_ERROR,
-				"could not initialize connection to hc, errno %d",opResult);
+		usb_log_error("could not initialize connection to hc, errno %d",opResult);
 		return opResult;
 	}
@@ -112,6 +111,6 @@
 			hub->device);
 	if(opResult != EOK){
-		dprintf(USB_LOG_LEVEL_ERROR,
-				"could not initialize connection to device, errno %d",opResult);
+		usb_log_error("could not initialize connection to device, errno %d",
+				opResult);
 		return opResult;
 	}
@@ -120,6 +119,6 @@
             &hub->device_connection);
 	if(opResult != EOK){
-		dprintf(USB_LOG_LEVEL_ERROR,
-				"could not initialize connection to device endpoint, errno %d",opResult);
+		usb_log_error("could not initialize connection to device endpoint, errno %d",
+				opResult);
 		return opResult;
 	}
@@ -127,5 +126,5 @@
 	opResult = usb_endpoint_pipe_probe_default_control(&hub->endpoints.control);
 	if (opResult != EOK) {
-		dprintf(USB_LOG_LEVEL_ERROR, "failed probing endpoint 0, %d", opResult);
+		usb_log_error("failed probing endpoint 0, %d", opResult);
 		return opResult;
 	}
@@ -151,11 +150,11 @@
 	    &std_descriptor);
 	if(opResult!=EOK){
-		dprintf(USB_LOG_LEVEL_ERROR, "could not get device descriptor, %d",opResult);
-		return opResult;
-	}
-	dprintf(USB_LOG_LEVEL_INFO, "hub has %d configurations",
+		usb_log_error("could not get device descriptor, %d",opResult);
+		return opResult;
+	}
+	usb_log_info("hub has %d configurations",
 			std_descriptor.configuration_count);
 	if(std_descriptor.configuration_count<1){
-		dprintf(USB_LOG_LEVEL_ERROR, "THERE ARE NO CONFIGURATIONS AVAILABLE");
+		usb_log_error("THERE ARE NO CONFIGURATIONS AVAILABLE");
 		//shouldn`t I return?
 	}
@@ -184,5 +183,5 @@
 		return opResult;
 	}
-	dprintf(USB_LOG_LEVEL_DEBUG, "\tused configuration %d",
+	usb_log_debug("\tused configuration %d",
 			config_descriptor->configuration_number);
 
@@ -200,11 +199,10 @@
 	    &hub->device_connection);
 	if (opResult != EOK) {
-		dprintf(USB_LOG_LEVEL_ERROR,
-				"Failed to initialize status change pipe: %s",
+		usb_log_error("Failed to initialize status change pipe: %s",
 		    str_error(opResult));
 		return opResult;
 	}
 	if (!endpoint_mapping[0].present) {
-		dprintf(USB_LOG_LEVEL_ERROR,"Not accepting device, " \
+		usb_log_error("Not accepting device, " \
 		    "cannot understand what is happenning");
 		return EREFUSED;
@@ -235,4 +233,5 @@
 	result->port_count = -1;
 	result->device = device;
+	result->is_default_address_used = false;
 
 	//result->usb_device = usb_new(usb_hcd_attached_device_info_t);
@@ -240,8 +239,8 @@
 
 	// get hub descriptor
-	dprintf(USB_LOG_LEVEL_DEBUG, "creating serialized descripton");
+	usb_log_debug("creating serialized descripton");
 	void * serialized_descriptor = malloc(USB_HUB_MAX_DESCRIPTOR_SIZE);
 	usb_hub_descriptor_t * descriptor;
-	dprintf(USB_LOG_LEVEL_DEBUG, "starting control transaction");
+	usb_log_debug("starting control transaction");
 	usb_endpoint_pipe_start_session(&result->endpoints.control);
 	opResult = usb_request_set_configuration(&result->endpoints.control, 1);
@@ -256,18 +255,19 @@
 
 	if (opResult != EOK) {
-		dprintf(USB_LOG_LEVEL_ERROR, "failed when receiving hub descriptor, badcode = %d",opResult);
+		usb_log_error("failed when receiving hub descriptor, badcode = %d",
+				opResult);
 		free(serialized_descriptor);
 		free(result);
 		return NULL;
 	}
-	dprintf(USB_LOG_LEVEL_DEBUG2, "deserializing descriptor");
+	usb_log_debug2("deserializing descriptor");
 	descriptor = usb_deserialize_hub_desriptor(serialized_descriptor);
 	if(descriptor==NULL){
-		dprintf(USB_LOG_LEVEL_WARNING, "could not deserialize descriptor ");
+		usb_log_warning("could not deserialize descriptor ");
 		free(result);
 		return NULL;
 	}
 
-	dprintf(USB_LOG_LEVEL_INFO, "setting port count to %d",descriptor->ports_count);
+	usb_log_info("setting port count to %d",descriptor->ports_count);
 	result->port_count = descriptor->ports_count;
 	result->attached_devs = (usb_hc_attached_device_t*)
@@ -278,5 +278,5 @@
 		result->attached_devs[i].address=0;
 	}
-	dprintf(USB_LOG_LEVEL_DEBUG2, "freeing data");
+	usb_log_debug2("freeing data");
 	free(serialized_descriptor);
 	free(descriptor->devices_removable);
@@ -285,5 +285,5 @@
 	//finish
 
-	dprintf(USB_LOG_LEVEL_INFO, "hub info created");
+	usb_log_info("hub info created");
 
 	return result;
@@ -296,5 +296,5 @@
  */
 int usb_add_hub_device(ddf_dev_t *dev) {
-	dprintf(USB_LOG_LEVEL_INFO, "add_hub_device(handle=%d)", (int) dev->handle);
+	usb_log_info("add_hub_device(handle=%d)", (int) dev->handle);
 
 	//dev->ops = &hub_device_ops;
@@ -313,5 +313,5 @@
 	opResult = usb_hub_process_configuration_descriptors(hub_info);
 	if(opResult != EOK){
-		dprintf(USB_LOG_LEVEL_ERROR,"could not get configuration descriptors, %d",
+		usb_log_error("could not get configuration descriptors, %d",
 				opResult);
 		return opResult;
@@ -324,7 +324,7 @@
 		opResult = usb_endpoint_pipe_control_write(&hub_info->endpoints.control,
 				&request,sizeof(usb_device_request_setup_packet_t), NULL, 0);
-		dprintf(USB_LOG_LEVEL_INFO, "powering port %d",port);
+		usb_log_info("powering port %d",port);
 		if (opResult != EOK) {
-			dprintf(USB_LOG_LEVEL_WARNING, "something went wrong when setting hub`s %dth port", port);
+			usb_log_warning("something went wrong when setting hub`s %dth port", port);
 		}
 	}
@@ -337,7 +337,7 @@
 	usb_lst_append(&usb_hub_list, hub_info);
 	fibril_mutex_unlock(&usb_hub_list_lock);
-	dprintf(USB_LOG_LEVEL_DEBUG, "hub info added to list");
-
-	dprintf(USB_LOG_LEVEL_DEBUG, "adding to ddf");
+	usb_log_debug("hub info added to list");
+
+	usb_log_debug("adding to ddf");
 	ddf_fun_t *hub_fun = ddf_fun_create(dev, fun_exposed, "hub");
 	assert(hub_fun != NULL);
@@ -351,17 +351,16 @@
 	fid_t fid = fibril_create(usb_hub_control_loop, hub_info);
 	if (fid == 0) {
-		dprintf(USB_LOG_LEVEL_ERROR, 
-				": failed to start monitoring fibril for new hub");
+		usb_log_error("failed to start monitoring fibril for new hub");
 		return ENOMEM;
 	}
 	fibril_add_ready(fid);
 
-	dprintf(USB_LOG_LEVEL_DEBUG, "hub fibril created");
+	usb_log_debug("hub fibril created");
 	//(void)hub_info;
 	//usb_hub_check_hub_changes();
 	
-	dprintf(USB_LOG_LEVEL_INFO, "hub dev added");
+	usb_log_info("hub dev added");
 	//address is lost...
-	dprintf(USB_LOG_LEVEL_DEBUG, "\taddress %d, has %d ports ",
+	usb_log_debug("\taddress %d, has %d ports ",
 			//hub_info->endpoints.control.,
 			hub_info->port_count);
@@ -379,4 +378,22 @@
 
 /**
+ * release default address used by given hub
+ *
+ * Also unsets hub->is_default_address_used. Convenience wrapper function.
+ * @note hub->connection MUST be open for communication
+ * @param hub hub representation
+ * @return error code
+ */
+static int usb_hub_release_default_address(usb_hub_info_t * hub){
+	int opResult = usb_hc_release_default_address(&hub->connection);
+	if(opResult!=EOK){
+		usb_log_error("could not release default address, errno %d",opResult);
+		return opResult;
+	}
+	hub->is_default_address_used = false;
+	return EOK;
+}
+
+/**
  * Reset the port with new device and reserve the default address.
  * @param hc
@@ -385,18 +402,25 @@
  */
 static void usb_hub_init_add_device(usb_hub_info_t * hub, uint16_t port,
-		bool isLowSpeed) {
+		usb_speed_t speed) {
+	//if this hub already uses default address, it cannot request it once more
+	if(hub->is_default_address_used) return;
+	int opResult = usb_hub_clear_port_feature(&hub->endpoints.control,
+				port, USB_HUB_FEATURE_C_PORT_CONNECTION);
+	if(opResult != EOK){
+		usb_log_warning("could not clear port-change-connection flag");
+	}
+
 	usb_device_request_setup_packet_t request;
-	int opResult;
-	dprintf(USB_LOG_LEVEL_INFO, "some connection changed");
+	usb_log_info("some connection changed");
 	assert(hub->endpoints.control.hc_phone);
 	//get default address
-	usb_speed_t speed = isLowSpeed?USB_SPEED_LOW:USB_SPEED_FULL;
 	opResult = usb_hc_reserve_default_address(&hub->connection, speed);
 	
 	if (opResult != EOK) {
-		dprintf(USB_LOG_LEVEL_WARNING, 
-				"cannot assign default address, it is probably used %d",opResult);
-		return;
-	}
+		usb_log_warning("cannot assign default address, it is probably used %d",
+				opResult);
+		return;
+	}
+	hub->is_default_address_used = true;
 	//reset port
 	usb_hub_set_reset_port_request(&request, port);
@@ -407,9 +431,9 @@
 			);
 	if (opResult != EOK) {
-		dprintf(USB_LOG_LEVEL_ERROR, 
-				"something went wrong when reseting a port %d",opResult);
+		usb_log_error("something went wrong when reseting a port %d",opResult);
 		//usb_hub_release_default_address(hc);
-		usb_hc_release_default_address(&hub->connection);
-	}
+		usb_hub_release_default_address(hub);
+	}
+	return;
 }
 
@@ -424,11 +448,11 @@
 
 	int opResult;
-	dprintf(USB_LOG_LEVEL_INFO, "finalizing add device");
+	usb_log_info("finalizing add device");
 	opResult = usb_hub_clear_port_feature(&hub->endpoints.control,
 	    port, USB_HUB_FEATURE_C_PORT_RESET);
 
 	if (opResult != EOK) {
-		dprintf(USB_LOG_LEVEL_ERROR, "failed to clear port reset feature");
-		usb_hc_release_default_address(&hub->connection);
+		usb_log_error("failed to clear port reset feature");
+		usb_hub_release_default_address(hub);
 		return;
 	}
@@ -454,10 +478,10 @@
 			);
 	if (new_device_address < 0) {
-		dprintf(USB_LOG_LEVEL_ERROR, "failed to get free USB address");
+		usb_log_error("failed to get free USB address");
 		opResult = new_device_address;
-		usb_hc_release_default_address(&hub->connection);
-		return;
-	}
-	dprintf(USB_LOG_LEVEL_INFO, "setting new address %d",new_device_address);
+		usb_hub_release_default_address(hub);
+		return;
+	}
+	usb_log_info("setting new address %d",new_device_address);
 	//opResult = usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT,
 	//    new_device_address);
@@ -466,7 +490,6 @@
 	usb_endpoint_pipe_end_session(&new_device_pipe);
 	if (opResult != EOK) {
-		dprintf(USB_LOG_LEVEL_ERROR, 
-				"could not set address for new device %d",opResult);
-		usb_hc_release_default_address(&hub->connection);
+		usb_log_error("could not set address for new device %d",opResult);
+		usb_hub_release_default_address(hub);
 		return;
 	}
@@ -474,5 +497,5 @@
 
 	//opResult = usb_hub_release_default_address(hc);
-	opResult = usb_hc_release_default_address(&hub->connection);
+	opResult = usb_hub_release_default_address(hub);
 	if(opResult!=EOK){
 		return;
@@ -486,6 +509,5 @@
 
 	if (opResult != EOK) {
-		dprintf(USB_LOG_LEVEL_ERROR, 
-				"could not start driver for new device %d",opResult);
+		usb_log_error("could not start driver for new device %d",opResult);
 		return;
 	}
@@ -498,9 +520,8 @@
 			&hub->attached_devs[port]);
 	if (opResult != EOK) {
-		dprintf(USB_LOG_LEVEL_ERROR, 
-				"could not assign address of device in hcd %d",opResult);
-		return;
-	}
-	dprintf(USB_LOG_LEVEL_INFO, "new device address %d, handle %zu",
+		usb_log_error("could not assign address of device in hcd %d",opResult);
+		return;
+	}
+	usb_log_info("new device address %d, handle %zu",
 	    new_device_address, child_handle);
 
@@ -515,5 +536,10 @@
 static void usb_hub_removed_device(
     usb_hub_info_t * hub,uint16_t port) {
-		
+
+	int opResult = usb_hub_clear_port_feature(&hub->endpoints.control,
+				port, USB_HUB_FEATURE_C_PORT_CONNECTION);
+	if(opResult != EOK){
+		usb_log_warning("could not clear port-change-connection flag");
+	}
 	/** \TODO remove device from device manager - not yet implemented in
 	 * devide manager
@@ -533,14 +559,13 @@
 		 */
 	}else{
-		dprintf(USB_LOG_LEVEL_WARNING, "this is strange, disconnected device had no address");
+		usb_log_warning("this is strange, disconnected device had no address");
 		//device was disconnected before it`s port was reset - return default address
-		//usb_drv_release_default_address(hc);
-		usb_hc_release_default_address(&hub->connection);
-	}
-}
-
-
-/**
- *Process over current condition on port.
+		usb_hub_release_default_address(hub);
+	}
+}
+
+
+/**
+ * Process over current condition on port.
  * 
  * Turn off the power on the port.
@@ -555,5 +580,5 @@
 	    port, USB_HUB_FEATURE_PORT_POWER);
 	if(opResult!=EOK){
-		dprintf(USB_LOG_LEVEL_ERROR, "cannot power off port %d;  %d",
+		usb_log_error("cannot power off port %d;  %d",
 				port, opResult);
 	}
@@ -568,5 +593,5 @@
 static void usb_hub_process_interrupt(usb_hub_info_t * hub, 
         uint16_t port) {
-	dprintf(USB_LOG_LEVEL_DEBUG, "interrupt at port %d", port);
+	usb_log_debug("interrupt at port %d", port);
 	//determine type of change
 	usb_endpoint_pipe_t *pipe = &hub->endpoints.control;
@@ -587,19 +612,16 @@
 			);
 	if (opResult != EOK) {
-		dprintf(USB_LOG_LEVEL_ERROR, "could not get port status");
+		usb_log_error("could not get port status");
 		return;
 	}
 	if (rcvd_size != sizeof (usb_port_status_t)) {
-		dprintf(USB_LOG_LEVEL_ERROR, "received status has incorrect size");
+		usb_log_error("received status has incorrect size");
 		return;
 	}
 	//something connected/disconnected
 	if (usb_port_connect_change(&status)) {
-		opResult = usb_hub_clear_port_feature(pipe,
-		    port, USB_HUB_FEATURE_C_PORT_CONNECTION);
-		// TODO: check opResult
 		if (usb_port_dev_connected(&status)) {
-			dprintf(USB_LOG_LEVEL_INFO, "some connection changed");
-			usb_hub_init_add_device(hub, port, usb_port_low_speed(&status));
+			usb_log_info("some connection changed");
+			usb_hub_init_add_device(hub, port, usb_port_speed(&status));
 		} else {
 			usb_hub_removed_device(hub, port);
@@ -612,15 +634,15 @@
 			usb_hub_over_current(hub,port);
 		}else{
-			dprintf(USB_LOG_LEVEL_INFO,
-				"over current condition was auto-resolved on port %d",port);
+			usb_log_info("over current condition was auto-resolved on port %d",
+					port);
 		}
 	}
 	//port reset
 	if (usb_port_reset_completed(&status)) {
-		dprintf(USB_LOG_LEVEL_INFO, "port reset complete");
+		usb_log_info("port reset complete");
 		if (usb_port_enabled(&status)) {
 			usb_hub_finalize_add_device(hub, port, usb_port_low_speed(&status));
 		} else {
-			dprintf(USB_LOG_LEVEL_WARNING, "port reset, but port still not enabled");
+			usb_log_warning("port reset, but port still not enabled");
 		}
 	}
@@ -631,8 +653,9 @@
 	usb_port_set_dev_connected(&status, false);
 	if (status>>16) {
-		dprintf(USB_LOG_LEVEL_INFO, "there was some unsupported change on port %d: %X",port,status);
-
-	}
-	/// \TODO handle other changes
+		usb_log_info("there was some unsupported change on port %d: %X",
+				port,status);
+
+	}
+	/// \TODO handle other changes - is there any?
 }
 
@@ -647,6 +670,6 @@
 	opResult = usb_endpoint_pipe_start_session(&hub_info->endpoints.status_change);
 	if(opResult != EOK){
-		dprintf(USB_LOG_LEVEL_ERROR,
-				"could not initialize communication for hub; %d", opResult);
+		usb_log_error("could not initialize communication for hub; %d",
+				opResult);
 		return opResult;
 	}
@@ -669,5 +692,5 @@
 	if (opResult != EOK) {
 		free(change_bitmap);
-		dprintf(USB_LOG_LEVEL_WARNING, "something went wrong while getting status of hub");
+		usb_log_warning("something went wrong while getting status of hub");
 		usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change);
 		return opResult;
@@ -676,6 +699,5 @@
 	opResult = usb_endpoint_pipe_start_session(&hub_info->endpoints.control);
 	if(opResult!=EOK){
-		dprintf(USB_LOG_LEVEL_ERROR, "could not start control pipe session %d",
-				opResult);
+		usb_log_error("could not start control pipe session %d", opResult);
 		usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change);
 		return opResult;
@@ -683,5 +705,5 @@
 	opResult = usb_hc_connection_open(&hub_info->connection);
 	if(opResult!=EOK){
-		dprintf(USB_LOG_LEVEL_ERROR, "could not start host controller session %d",
+		usb_log_error("could not start host controller session %d",
 				opResult);
 		usb_endpoint_pipe_end_session(&hub_info->endpoints.control);
Index: uspace/drv/usbhub/usbhub.h
===================================================================
--- uspace/drv/usbhub/usbhub.h	(revision 054ed846de9c6f3dabfc1f854569a8bf0abe0484)
+++ uspace/drv/usbhub/usbhub.h	(revision 382f32662aa02f5dcfd7631f34cc56ff47b61575)
@@ -71,4 +71,6 @@
 	/** hub endpoints */
 	usb_hub_endpoints_t endpoints;
+
+	bool is_default_address_used;
 } usb_hub_info_t;
 
