Index: uspace/drv/usbhub/usbhub.c
===================================================================
--- uspace/drv/usbhub/usbhub.c	(revision cd5b8780aa6e0adbb8a57d2a2208c01bab70eba2)
+++ uspace/drv/usbhub/usbhub.c	(revision c1693dae21fef6c97102ccf3fc1343a3b7ca4b30)
@@ -153,4 +153,5 @@
 bool hub_port_changes_callback(usb_device_t *dev,
     uint8_t *change_bitmap, size_t change_bitmap_size, void *arg) {
+	usb_log_debug("hub_port_changes_callback\n");
 	usb_hub_info_t *hub = (usb_hub_info_t *) arg;
 
@@ -217,5 +218,6 @@
 	// get hub descriptor
 	usb_log_debug("creating serialized descriptor\n");
-	void * serialized_descriptor = malloc(USB_HUB_MAX_DESCRIPTOR_SIZE);
+	//void * serialized_descriptor = malloc(USB_HUB_MAX_DESCRIPTOR_SIZE);
+	uint8_t serialized_descriptor[USB_HUB_MAX_DESCRIPTOR_SIZE];
 	usb_hub_descriptor_t * descriptor;
 	int opResult;
@@ -239,9 +241,13 @@
 	if (descriptor == NULL) {
 		usb_log_warning("could not deserialize descriptor \n");
-		return opResult;
+		return ENOMEM;
 	}
 	usb_log_debug("setting port count to %d\n", descriptor->ports_count);
 	hub_info->port_count = descriptor->ports_count;
 	/// \TODO this is not semantically correct
+	bool is_power_switched =
+	    ((descriptor->hub_characteristics & 1) ==0);
+	bool has_individual_port_powering =
+	    ((descriptor->hub_characteristics & 1) !=0);
 	hub_info->ports = malloc(
 	    sizeof (usb_hub_port_t) * (hub_info->port_count + 1));
@@ -250,14 +256,30 @@
 		usb_hub_port_init(&hub_info->ports[port]);
 	}
-	for (port = 0; port < hub_info->port_count; port++) {
-		opResult = usb_hub_set_port_feature(hub_info->control_pipe,
-		    port+1, USB_HUB_FEATURE_PORT_POWER);
-		if (opResult != EOK) {
-			usb_log_error("cannot power on port %d;  %d\n",
-			    port+1, opResult);
-		}
+	if(is_power_switched){
+		usb_log_debug("is_power_switched\n");
+		if(has_individual_port_powering){
+			usb_log_debug("has_individual_port_powering\n");
+			for (port = 0; port < hub_info->port_count; port++) {
+				opResult = usb_hub_set_port_feature(hub_info->control_pipe,
+				    port+1, USB_HUB_FEATURE_PORT_POWER);
+				if (opResult != EOK) {
+					usb_log_error("cannot power on port %d;  %d\n",
+					    port+1, opResult);
+				}
+			}
+		}else{
+			usb_log_debug("!has_individual_port_powering\n");
+			opResult = usb_hub_set_feature(hub_info->control_pipe,
+			    USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
+			if (opResult != EOK) {
+				usb_log_error("cannot power hub;  %d\n",
+				  opResult);
+			}
+		}
+	}else{
+		usb_log_debug("!is_power_switched\n");
 	}
 	usb_log_debug2("freeing data\n");
-	free(serialized_descriptor);
+	//free(serialized_descriptor);
 	//free(descriptor->devices_removable);
 	free(descriptor);
Index: uspace/drv/usbhub/usbhub_private.h
===================================================================
--- uspace/drv/usbhub/usbhub_private.h	(revision cd5b8780aa6e0adbb8a57d2a2208c01bab70eba2)
+++ uspace/drv/usbhub/usbhub_private.h	(revision c1693dae21fef6c97102ccf3fc1343a3b7ca4b30)
@@ -113,5 +113,5 @@
 
 	usb_device_request_setup_packet_t clear_request = {
-		.request_type = USB_HUB_REQ_TYPE_CLEAR_PORT_FEATURE,
+		.request_type = USB_HUB_REQ_TYPE_SET_PORT_FEATURE,
 		.request = USB_DEVREQ_SET_FEATURE,
 		.length = 0,
Index: uspace/drv/usbhub/utils.c
===================================================================
--- uspace/drv/usbhub/utils.c	(revision cd5b8780aa6e0adbb8a57d2a2208c01bab70eba2)
+++ uspace/drv/usbhub/utils.c	(revision c1693dae21fef6c97102ccf3fc1343a3b7ca4b30)
@@ -70,5 +70,6 @@
 	uint8_t * result = malloc(size);
 	//size
-	usb_serialize_hub_descriptor(descriptor,result);
+	if(result)
+		usb_serialize_hub_descriptor(descriptor,result);
 	return result;
 }
