Index: uspace/drv/bus/usb/usbhid/main.c
===================================================================
--- uspace/drv/bus/usb/usbhid/main.c	(revision 6f730278a78032db48893f7a7d0424a1424dfa58)
+++ uspace/drv/bus/usb/usbhid/main.c	(revision 90df90c9fdbb775035cf5923e12efe15fc1dedd8)
@@ -73,6 +73,5 @@
 	    usb_device_data_alloc(dev, sizeof(usb_hid_dev_t));
 	if (hid_dev == NULL) {
-		usb_log_error("Error while creating USB/HID device "
-		    "structure.\n");
+		usb_log_error("Failed to create USB/HID device structure.\n");
 		return ENOMEM;
 	}
@@ -87,19 +86,7 @@
 	usb_log_debug("USB/HID device structure initialized.\n");
 
-	/*
-	 * 1) subdriver vytvori vlastnu ddf_fun, vlastne ddf_dev_ops, ktore da
-	 *    do nej.
-	 * 2) do tych ops do .interfaces[DEV_IFACE_USBHID (asi)] priradi 
-	 *    vyplnenu strukturu usbhid_iface_t.
-	 * 3) klientska aplikacia - musi si rucne vytvorit telefon
-	 *    (devman_device_connect() - cesta k zariadeniu (/hw/pci0/...) az 
-	 *    k tej fcii.
-	 *    pouzit usb/classes/hid/iface.h - prvy int je telefon
-	 */
-
 	/* Start automated polling function.
 	 * This will create a separate fibril that will query the device
-	 * for the data continuously.
-	 */
+	 * for the data continuously. */
        rc = usb_device_auto_poll(dev,
 	   /* Index of the polling pipe. */
@@ -135,7 +122,6 @@
 static int usb_hid_device_rem(usb_device_t *dev)
 {
-	// TODO: Stop device polling fibril
-	// TODO: Stop autorepeat fibril
-	// TODO: Call deinit
+	// TODO: Stop device polling
+	// TODO: Call deinit (stops autorepeat too)
 	return ENOTSUP;
 }
Index: uspace/drv/bus/usb/usbhid/usbhid.c
===================================================================
--- uspace/drv/bus/usb/usbhid/usbhid.c	(revision 6f730278a78032db48893f7a7d0424a1424dfa58)
+++ uspace/drv/bus/usb/usbhid/usbhid.c	(revision 90df90c9fdbb775035cf5923e12efe15fc1dedd8)
@@ -128,5 +128,5 @@
 	return (hid_dev->usb_dev->descriptors.device.vendor_id
 	    == mapping->vendor_id
-	    && hid_dev->usb_dev->descriptors.device.product_id 
+	    && hid_dev->usb_dev->descriptors.device.product_id
 	    == mapping->product_id);
 }
@@ -301,23 +301,24 @@
 	assert(dev);
 
-	if (dev->pipes[USB_HID_KBD_POLL_EP_NO].present) {
-		usb_log_debug("Found keyboard endpoint.\n");
-		// save the pipe index
-		hid_dev->poll_pipe_index = USB_HID_KBD_POLL_EP_NO;
-	} else if (dev->pipes[USB_HID_MOUSE_POLL_EP_NO].present) {
-		usb_log_debug("Found mouse endpoint.\n");
-		// save the pipe index
-		hid_dev->poll_pipe_index = USB_HID_MOUSE_POLL_EP_NO;
-	} else if (dev->pipes[USB_HID_GENERIC_POLL_EP_NO].present) {
-		usb_log_debug("Found generic HID endpoint.\n");
-		// save the pipe index
-		hid_dev->poll_pipe_index = USB_HID_GENERIC_POLL_EP_NO;
-	} else {
-		usb_log_error("None of supported endpoints found - probably"
-		    " not a supported device.\n");
-		return ENOTSUP;
-	}
-
-	return EOK;
+	static const struct {
+		unsigned ep_number;
+		const char* description;
+	} endpoints[] = {
+		{USB_HID_KBD_POLL_EP_NO, "Keyboard endpoint"},
+		{USB_HID_MOUSE_POLL_EP_NO, "Mouse endpoint"},
+		{USB_HID_GENERIC_POLL_EP_NO, "Generic HID endpoint"},
+	};
+
+	for (unsigned i = 0; i < sizeof(endpoints)/sizeof(endpoints[0]); ++i) {
+		if (endpoints[i].ep_number >= dev->pipes_count) {
+			return EINVAL;
+		}
+		if (dev->pipes[endpoints[i].ep_number].present) {
+			usb_log_debug("Found: %s.\n", endpoints[i].description);
+			hid_dev->poll_pipe_index = endpoints[i].ep_number;
+			return EOK;
+		}
+	}
+	return ENOTSUP;
 }
 
@@ -395,4 +396,15 @@
 	rc = usb_hid_process_report_descriptor(hid_dev->usb_dev,
 	    &hid_dev->report, &hid_dev->report_desc, &hid_dev->report_desc_size);
+
+	/*
+	 * 1) subdriver vytvori vlastnu ddf_fun, vlastne ddf_dev_ops, ktore da
+	 *    do nej.
+	 * 2) do tych ops do .interfaces[DEV_IFACE_USBHID (asi)] priradi 
+	 *    vyplnenu strukturu usbhid_iface_t.
+	 * 3) klientska aplikacia - musi si rucne vytvorit telefon
+	 *    (devman_device_connect() - cesta k zariadeniu (/hw/pci0/...) az 
+	 *    k tej fcii.
+	 *    pouzit usb/classes/hid/iface.h - prvy int je telefon
+	 */
 
 	bool fallback = false;
