Index: uspace/drv/usbhub/main.c
===================================================================
--- uspace/drv/usbhub/main.c	(revision cc34f32f5c44c2f748ff07b9c43cab7df2c81ca6)
+++ uspace/drv/usbhub/main.c	(revision dff940f82499ff7b8a14b1ad5d5e45371da4a562)
@@ -52,14 +52,4 @@
 };
 
-/*
-int usb_hub_control_loop(void * noparam){
-	while(true){
-		usb_hub_check_hub_changes();
-		async_usleep(1000 * 1000 );/// \TODO proper number once
-	}
-	return 0;
-}
-*/
-
 int main(int argc, char *argv[])
 {
@@ -73,13 +63,4 @@
 	fibril_mutex_unlock(&usb_hub_list_lock);
 	
-/*
-	fid_t fid = fibril_create(usb_hub_control_loop, NULL);
-	if (fid == 0) {
-		fprintf(stderr, NAME ": failed to start monitoring fibril," \
-		    " driver aborting.\n");
-		return ENOMEM;
-	}
-	fibril_add_ready(fid);
-*/
 	return ddf_driver_main(&hub_driver);
 }
Index: uspace/drv/usbhub/usbhub.c
===================================================================
--- uspace/drv/usbhub/usbhub.c	(revision cc34f32f5c44c2f748ff07b9c43cab7df2c81ca6)
+++ uspace/drv/usbhub/usbhub.c	(revision dff940f82499ff7b8a14b1ad5d5e45371da4a562)
@@ -150,5 +150,5 @@
 
 	//configuration descriptor
-	/// \TODO check other configurations
+	/// \TODO check other configurations?
 	usb_standard_configuration_descriptor_t config_descriptor;
 	opResult = usb_request_get_bare_configuration_descriptor(
@@ -194,8 +194,4 @@
 	}
 
-	/**
-	 * Initialize the interrupt in endpoint.
-	 * \TODO this code should be checked...
-	 */
 	usb_endpoint_mapping_t endpoint_mapping[1] = {
 		{
@@ -225,11 +221,4 @@
 	return EOK;
 	
-
-	// Initialize the interrupt(=status change) endpoint.
-	/*usb_endpoint_pipe_initialize(
-		&result->endpoints->status_change,
-		&result->device_connection, );USB_TRANSFER_INTERRUPT
-	USB_DIRECTION_IN*/
-
 }
 
@@ -282,5 +271,4 @@
 	}
 
-	
 	dprintf(USB_LOG_LEVEL_INFO, "setting port count to %d",descriptor->ports_count);
 	result->port_count = descriptor->ports_count;
@@ -581,16 +569,6 @@
 	//determine type of change
 	usb_endpoint_pipe_t *pipe = &hub->endpoints.control;
-	//int opResult = usb_endpoint_pipe_start_session(pipe);
 	
-	/*if(opResult != EOK){
-		dprintf(USB_LOG_LEVEL_ERROR, "cannot open pipe %d", opResult);
-	}*/
-	int opResult;
-
-	/*
-	usb_target_t target;
-	target.address=address;
-	target.endpoint=0;
-	*/
+	int opResult;
 
 	usb_port_status_t status;
@@ -655,8 +633,4 @@
 	}
 	/// \TODO handle other changes
-	/// \TODO debug log for various situations
-	//usb_endpoint_pipe_end_session(pipe);
-
-
 }
 
@@ -674,23 +648,5 @@
 	}
 
-	/*
-	 * Check status change pipe of this hub.
-	 */
-	/*
-	usb_target_t target;
-	target.address = hub_info->address;
-	target.endpoint = 1;/// \TODO get from endpoint descriptor
-	dprintf(USB_LOG_LEVEL_INFO, "checking changes for hub at addr %d",
-	    target.address);
-	*/
 	size_t port_count = hub_info->port_count;
-
-	/*
-	 * Connect to respective HC.
-	 *
-	int hc = usb_drv_hc_connect_auto(hub_info->device, 0);
-	if (hc < 0) {
-	continue;
-	}*/
 
 	/// FIXME: count properly
@@ -699,5 +655,4 @@
 	size_t actual_size;
 
-	//usb_handle_t handle;
 	/*
 	 * Send the request.
@@ -708,14 +663,26 @@
 			);
 
-	//usb_drv_async_wait_for(handle);
-
 	if (opResult != EOK) {
 		free(change_bitmap);
 		dprintf(USB_LOG_LEVEL_WARNING, "something went wrong while getting status of hub");
+		usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change);
 		return;
 	}
 	unsigned int port;
 	opResult = usb_endpoint_pipe_start_session(&hub_info->endpoints.control);
-	usb_hc_connection_open(&hub_info->connection);
+	if(opResult!=EOK){
+		dprintf(USB_LOG_LEVEL_ERROR, "could not start control pipe session %d",
+				opResult);
+		usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change);
+		return;
+	}
+	opResult = usb_hc_connection_open(&hub_info->connection);
+	if(opResult!=EOK){
+		dprintf(USB_LOG_LEVEL_ERROR, "could not start host controller session %d",
+				opResult);
+		usb_endpoint_pipe_end_session(&hub_info->endpoints.control);
+		usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change);
+		return;
+	}
 
 	///todo, opresult check, pre obe konekce
@@ -734,26 +701,4 @@
 }
 
-/**
- * Check changes on all known hubs.
- */
-/*
-void usb_hub_check_hub_changes(void) {
-	// Iterate through all hubs.
-	 
-	usb_general_list_t * lst_item;
-	fibril_mutex_lock(&usb_hub_list_lock);
-	for (lst_item = usb_hub_list.next;
-			lst_item != &usb_hub_list;
-			lst_item = lst_item->next) {
-		fibril_mutex_unlock(&usb_hub_list_lock);
-		usb_hub_info_t * hub_info = ((usb_hub_info_t*)lst_item->data);
-		usb_hub_check_hub_changes(hub_info);
-		fibril_mutex_lock(&usb_hub_list_lock);
-	}
-	fibril_mutex_unlock(&usb_hub_list_lock);
-}
-*/
-
-
 
 
Index: uspace/drv/usbhub/usbhub.h
===================================================================
--- uspace/drv/usbhub/usbhub.h	(revision cc34f32f5c44c2f748ff07b9c43cab7df2c81ca6)
+++ uspace/drv/usbhub/usbhub.h	(revision dff940f82499ff7b8a14b1ad5d5e45371da4a562)
@@ -87,9 +87,4 @@
 
 /**
- * check changes on all registered hubs
- */
-//void usb_hub_check_hub_changes(void);
-
-/**
  * check changes on specified hub
  * @param hub_info_param pointer to usb_hub_info_t structure
@@ -98,5 +93,4 @@
 
 
-//int usb_add_hub_device(device_t *);
 
 
