Index: uspace/drv/bus/usb/uhci/uhci_rh.c
===================================================================
--- uspace/drv/bus/usb/uhci/uhci_rh.c	(revision 4c86c7c3bf4db6909c5792ab7a29b6a5e3b81fa3)
+++ uspace/drv/bus/usb/uhci/uhci_rh.c	(revision af4e464e8b98aac6f868fa8d096474b678907612)
@@ -37,11 +37,14 @@
 	UHCI_RH_PORT_COUNT = 2,
 	/* 1 byte for hub status bit and 2 port status bits */
-	UHCI_PORT_BYTES = 1,
+	UHCI_PORT_BYTES = (1 + UHCI_RH_PORT_COUNT + 7) / 8,
 };
 
 /** Hub descriptor. */
 static const struct {
+	/** Common hub descriptor header */
 	usb_hub_descriptor_header_t header;
+	/** Port removable status bits */
 	uint8_t removable[UHCI_PORT_BYTES];
+	/** Port powered status bits */
 	uint8_t powered[UHCI_PORT_BYTES];
 } __attribute__((packed)) hub_descriptor = {
@@ -59,7 +62,12 @@
 };
 
-
 static usbvirt_device_ops_t ops;
 
+/** Initialize uhci rh structure.
+ * @param instance Memory place to initialize.
+ * @param ports Pointer to TWO UHCI RH port registers.
+ * @param name device name, passed to virthub init
+ * @return Error code, EOK on success.
+ */
 int uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name)
 {
@@ -73,4 +81,13 @@
 }
 
+/** Schedule USB batch for the root hub.
+ *
+ * @param instance UHCI rh instance
+ * @param batch USB communication batch
+ * @return EOK.
+ *
+ * The result of scheduling is always EOK. The result of communication does
+ * not have to be.
+ */
 int uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch)
 {
@@ -90,4 +107,6 @@
 	return EOK;
 }
+
+/** UHCI port register bits */
 enum {
 	STATUS_CONNECTED         = (1 << 0),
@@ -107,5 +126,7 @@
 	STATUS_WC_BITS = STATUS_CHANGE_BITS,
 };
+
 /* HUB ROUTINES IMPLEMENTATION */
+
 static void uhci_port_reset_enable(ioport16_t *port)
 {
@@ -146,4 +167,15 @@
 		usb_log_debug("%s: rh: " msg, d->name, ##__VA_ARGS__) \
 
+/** USB HUB port state request handler.
+ * @param device Virtual hub device
+ * @param setup_packet USB setup stage data.
+ * @param[out] data destination data buffer, size must be at least
+ *             setup_packet->length bytes
+ * @param[out] act_size Sized of the valid response part of the buffer.
+ * @return Error code.
+ *
+ * Do not confuse with port status. Port state reports data line states,
+ * it is usefull for debuging purposes only.
+ */
 static int req_get_port_state(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
@@ -170,4 +202,15 @@
 	(BIT_VAL(val, bit) << feat)
 
+/** Port status request handler.
+ * @param device Virtual hub device
+ * @param setup_packet USB setup stage data.
+ * @param[out] data destination data buffer, size must be at least
+ *             setup_packet->length bytes
+ * @param[out] act_size Sized of the valid response part of the buffer.
+ * @return Error code.
+ *
+ * Converts status reported via ioport to USB format.
+ * @note: reset change status needs to be handled in sw.
+ */
 static int req_get_port_status(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
@@ -201,4 +244,12 @@
 }
 
+/** Port clear feature request handler.
+ * @param device Virtual hub device
+ * @param setup_packet USB setup stage data.
+ * @param[out] data destination data buffer, size must be at least
+ *             setup_packet->length bytes
+ * @param[out] act_size Sized of the valid response part of the buffer.
+ * @return Error code.
+ */
 static int req_clear_port_feature(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
@@ -213,11 +264,11 @@
 	switch (feature) {
 	case USB_HUB_FEATURE_PORT_ENABLE:
-		RH_DEBUG(device, port, "Clear port enable (status %" PRIx16 ")\n",
-		    status);
+		RH_DEBUG(device, port, "Clear port enable (status %"
+		    PRIx16 ")\n", status);
 		pio_write_16(hub->ports[port], val & ~STATUS_ENABLED);
 		break;
 	case USB_HUB_FEATURE_PORT_SUSPEND:
-		RH_DEBUG(device, port, "Clear port suspend (status %" PRIx16 ")\n",
-		    status);
+		RH_DEBUG(device, port, "Clear port suspend (status %"
+		    PRIx16 ")\n", status);
 		pio_write_16(hub->ports[port], val & ~STATUS_SUSPEND);
 		// TODO we should do resume magic
@@ -231,31 +282,32 @@
 		break;
 	case USB_HUB_FEATURE_C_PORT_CONNECTION:
-		RH_DEBUG(device, port, "Clear port conn change (status %" PRIx16
-		    ")\n", status);
+		RH_DEBUG(device, port, "Clear port conn change (status %"
+		    PRIx16 ")\n", status);
 		pio_write_16(hub->ports[port], val | STATUS_CONNECTED_CHANGED);
 		break;
 	case USB_HUB_FEATURE_C_PORT_RESET:
-		RH_DEBUG(device, port, "Clear port reset change (status %" PRIx16
-		    ")\n", status);
+		RH_DEBUG(device, port, "Clear port reset change (status %"
+		    PRIx16 ")\n", status);
 		hub->reset_changed[port] = false;
 		break;
 	case USB_HUB_FEATURE_C_PORT_ENABLE:
-		RH_DEBUG(device, port, "Clear port enable change (status %" PRIx16
-		    ")\n", status);
+		RH_DEBUG(device, port, "Clear port enable change (status %"
+		    PRIx16 ")\n", status);
 		pio_write_16(hub->ports[port], status | STATUS_ENABLED_CHANGED);
 		break;
 	case USB_HUB_FEATURE_C_PORT_SUSPEND:
-		RH_DEBUG(device, port, "Clear port suspend change (status %" PRIx16
-		    ")\n", status);
+		RH_DEBUG(device, port, "Clear port suspend change (status %"
+		    PRIx16 ")\n", status);
 		//TODO
 		return ENOTSUP;
 	case USB_HUB_FEATURE_C_PORT_OVER_CURRENT:
-		RH_DEBUG(device, port, "Clear port OC change (status %" PRIx16
-		    ")\n", status);
+		RH_DEBUG(device, port, "Clear port OC change (status %"
+		    PRIx16 ")\n", status);
 		/* UHCI Does not report over current */
+		//TODO: newer chips do, but some have broken wiring 
 		break;
 	default:
-		RH_DEBUG(device, port, "Clear unknown feature %d (status %" PRIx16
-		    ")\n", feature, status);
+		RH_DEBUG(device, port, "Clear unknown feature %d (status %"
+		    PRIx16 ")\n", feature, status);
 		usb_log_warning("Clearing feature %d is unsupported\n",
 		    feature);
@@ -265,4 +317,12 @@
 }
 
+/** Port set feature request handler.
+ * @param device Virtual hub device
+ * @param setup_packet USB setup stage data.
+ * @param[out] data destination data buffer, size must be at least
+ *             setup_packet->length bytes
+ * @param[out] act_size Sized of the valid response part of the buffer.
+ * @return Error code.
+ */
 static int req_set_port_feature(usbvirt_device_t *device,
     const usb_device_request_setup_packet_t *setup_packet,
@@ -295,4 +355,5 @@
 		/* We are always powered */
 		usb_log_warning("Tried to power port %u\n", port);
+		break;
 	case USB_HUB_FEATURE_C_PORT_CONNECTION:
 	case USB_HUB_FEATURE_C_PORT_ENABLE:
@@ -314,4 +375,5 @@
 }
 
+/** UHCI root hub request handlers */
 static usbvirt_control_request_handler_t control_transfer_handlers[] = {
 	{
@@ -344,5 +406,5 @@
 		.name = "ClearHubFeature",
 		/* Hub features are overcurrent and supply good,
-		 * this request may only set changes that we never report*/
+		 * this request may only clear changes that we never report*/
 		.callback = req_nop,
 	},
@@ -390,12 +452,25 @@
 };
 
+/** Status change handler.
+ * @param device Virtual hub device
+ * @param endpoint Enpoint number
+ * @param tr_type Transfer type
+ * @param buffer Response destination
+ * @param buffer_size BYtes available in buffer
+ * @param actual_size Size us the used part of the dest buffer.
+ *
+ * Produces status mask. Bit 0 indicates hub status change the other bits
+ * represnet port status change. Endian does not matter as UHCI root hubs
+ * only need 1 byte.
+ */
 static int req_status_change_handler(usbvirt_device_t *device,
     usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
     void *buffer, size_t buffer_size, size_t *actual_size)
 {
+	uhci_rh_t *hub = virthub_get_data(device);
+	assert(hub);
+	
 	if (buffer_size < 1)
 		return ESTALL;
-	uhci_rh_t *hub = virthub_get_data(device);
-	assert(hub);
 
 	const uint16_t status_a = pio_read_16(hub->ports[0]);
Index: uspace/drv/bus/usb/uhci/uhci_rh.h
===================================================================
--- uspace/drv/bus/usb/uhci/uhci_rh.h	(revision 4c86c7c3bf4db6909c5792ab7a29b6a5e3b81fa3)
+++ uspace/drv/bus/usb/uhci/uhci_rh.h	(revision af4e464e8b98aac6f868fa8d096474b678907612)
@@ -33,6 +33,6 @@
  * @brief UHCI host controller driver structure
  */
-#ifndef DRV_UHCI_RHVIRT_H
-#define DRV_UHCI_RHVIRT_H
+#ifndef DRV_UHCI_UHCI_RH_H
+#define DRV_UHCI_UHCI_RH_H
 
 #include <usbvirt/virthub_base.h>
@@ -42,8 +42,11 @@
 #define HUB_STATUS_CHANGE_PIPE   1
 
-
+/** Virtual to UHCI hub connector */
 typedef struct {
+	/** Virtual hub software implementation */
 	virthub_base_t base;
+	/** UHCI root hub port io registers */
 	ioport16_t *ports[2];
+	/** Reset change indicator, it is not reported by regs */
 	bool reset_changed[2];
 } uhci_rh_t;
@@ -51,4 +54,11 @@
 int uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name);
 int uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch);
+
+/** Get UHCI rh address.
+ *
+ * @param instance UHCI rh instance.
+ * @return USB address assigned to the hub.
+ * Wrapper for virtual hub address
+ */
 static inline usb_address_t uhci_rh_get_address(uhci_rh_t *instance)
 {
