Index: uspace/lib/usb/include/usb/classes/hidpath.h
===================================================================
--- uspace/lib/usb/include/usb/classes/hidpath.h	(revision 1ce4189d8c20ad8d4f1155c953fc3e12908ce6f1)
+++ uspace/lib/usb/include/usb/classes/hidpath.h	(revision 1b7dc5e951acdcd6d2f5f654473c2409252f9e4f)
@@ -44,19 +44,13 @@
  */
 /** Wanted usage path must be exactly the same as the searched one */
-#define USB_HID_PATH_COMPARE_STRICT				0
+#define USB_HID_PATH_COMPARE_STRICT		0
 /** Wanted usage path must be the suffix in the searched one */
-#define USB_HID_PATH_COMPARE_END			1
+#define USB_HID_PATH_COMPARE_END		1
 /** */
-#define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY	4
-#define USB_HID_PATH_COMPARE_COLLECTION_ONLY	2 /* porovnava jenom cestu z Kolekci */
+#define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY	2
 /** Searched usage page must be prefix of the other one */
-#define USB_HID_PATH_COMPARE_BEGIN		8
+#define USB_HID_PATH_COMPARE_BEGIN		4
 /** Searched couple of usage page and usage can be anywhere in usage path */
-#define USB_HID_PATH_COMPARE_WHERE		16
-/**
- * TODO
- *  * porovnani zacatek - neni to to samy jako COLLECTION ONLY?? -- TEST
- *  * porovnani kdekoliv (jenom s delkou 1 at si to moc nekomplikujem)
- */
+#define USB_HID_PATH_COMPARE_ANYWHERE		8
 
 
Index: uspace/lib/usb/src/hiddescriptor.c
===================================================================
--- uspace/lib/usb/src/hiddescriptor.c	(revision 1ce4189d8c20ad8d4f1155c953fc3e12908ce6f1)
+++ uspace/lib/usb/src/hiddescriptor.c	(revision 1b7dc5e951acdcd6d2f5f654473c2409252f9e4f)
@@ -437,5 +437,7 @@
 int usb_hid_report_parse_main_tag(uint8_t tag, const uint8_t *data, size_t item_size,
                              usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path)
-{		
+{
+	usb_hid_report_usage_path_t *path_item;
+	
 	switch(tag)
 	{
@@ -448,17 +450,15 @@
 			
 		case USB_HID_REPORT_TAG_COLLECTION:
-			//TODO: usage_path->flags = *data;
+			// store collection atributes
+			path_item = list_get_instance(usage_path->head.prev, usb_hid_report_usage_path_t, link);
+			path_item->flags = *data;	
 			
-			usb_log_debug("APPENDED ITEM TO USAGE PATH (PAGE %d, USAGE %d\n", report_item->usage_page, report_item->usages[report_item->usages_count-1]);
-			usb_hid_print_usage_path(usage_path);
-
 			// set last item
 			usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_GLOBAL, report_item->usage_page);
 			usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_LOCAL, report_item->usages[report_item->usages_count-1]);
+			
 			// append the new one which will be set by common
 			// usage/usage page
 			usb_hid_report_path_append_item(usage_path, report_item->usage_page, report_item->usages[report_item->usages_count-1]);	
-			usb_hid_print_usage_path(usage_path);
-
 			usb_hid_report_reset_local_items (report_item);
 			return USB_HID_NO_ACTION;
@@ -551,9 +551,17 @@
                              usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path)
 {
-	switch(tag)
-	{
+	switch(tag) {
 		case USB_HID_REPORT_TAG_USAGE:
-			report_item->usages[report_item->usages_count] = usb_hid_report_tag_data_uint32(data,item_size);
-			report_item->usages_count++;
+			switch(report_item->in_delimiter) {
+				case INSIDE_DELIMITER_SET:
+					// nothing to do
+					break;
+				case START_DELIMITER_SET:
+					report_item->in_delimiter = INSIDE_DELIMITER_SET;
+				case OUTSIDE_DELIMITER_SET:
+					report_item->usages[report_item->usages_count] = usb_hid_report_tag_data_uint32(data,item_size);
+					report_item->usages_count++;
+					break;
+			}
 			break;
 		case USB_HID_REPORT_TAG_USAGE_MINIMUM:
@@ -596,17 +604,11 @@
 			break;			
 		case USB_HID_REPORT_TAG_DELIMITER:
-			if (report_item->in_delimiter == OUTSIDE_DELIMITER_SET) {
-				report_item->in_delimiter = START_DELIMITER_SET;
-			}
-			else {
-				report_item->in_delimiter = OUTSIDE_DELIMITER_SET;
-			}
-			
-			break;
-		
+			report_item->in_delimiter = usb_hid_report_tag_data_uint32(data,item_size);
+			break;
+
 		default:
 			return USB_HID_NO_ACTION;
 	}
-	
+
 	return EOK;
 }
Index: uspace/lib/usb/src/hidpath.c
===================================================================
--- uspace/lib/usb/src/hidpath.c	(revision 1ce4189d8c20ad8d4f1155c953fc3e12908ce6f1)
+++ uspace/lib/usb/src/hidpath.c	(revision 1b7dc5e951acdcd6d2f5f654473c2409252f9e4f)
@@ -149,5 +149,5 @@
 		usb_log_debug("\tFLAGS: %d\n", path_item->flags);		
 		
-		item = item->next;
+       		item = item->next;
 	}
 }
@@ -156,7 +156,6 @@
  * Compares two usage paths structures
  *
- * If USB_HID_PATH_COMPARE_COLLECTION_ONLY flag is given, the last item in report_path structure is forgotten
- *
- * @param report_path usage path structure to compare
+ *
+ * @param report_path usage path structure to compare with @path 
  * @param path usage patrh structure to compare
  * @param flags Flags determining the mode of comparison
@@ -179,4 +178,5 @@
 	}
 
+	// Empty path match all others
 	if(path->depth == 0){
 		return EOK;
@@ -189,10 +189,43 @@
 	
 	switch(flags){
-		/* path must be completly identical */
+		/* path is somewhere in report_path */
+		case USB_HID_PATH_COMPARE_ANYWHERE:
+			if(path->depth != 1){
+				return 1;
+			}
+
+			// projit skrz cestu a kdyz nekde sedi tak vratim EOK
+			// dojduli az za konec tak nnesedi
+			report_link = report_path->head.next;
+			path_link = path->head.next;
+			path_item = list_get_instance(path_link, usb_hid_report_usage_path_t, link);
+
+			while(report_link != &report_path->head) {
+				report_item = list_get_instance(report_link, usb_hid_report_usage_path_t, link);
+				if(report_item->usage_page == path_item->usage_page){
+					if(only_page == 0){
+						if(report_item->usage == path_item->usage) {
+							return EOK;
+						}
+					}
+					else {
+						return EOK;
+					}
+				}
+
+				report_link = report_link->next;
+			}
+
+			return 1;
+			break;
+		/* the paths must be identical */
 		case USB_HID_PATH_COMPARE_STRICT:
 				if(report_path->depth != path->depth){
 					return 1;
 				}
-
+		
+		/* path is prefix of the report_path */
+		case USB_HID_PATH_COMPARE_BEGIN:
+	
 				report_link = report_path->head.next;
 				path_link = path->head.next;
@@ -221,8 +254,6 @@
 				}
 
-				if(((report_link == &report_path->head) && (path_link == &path->head)) || 
-				   (((flags & USB_HID_PATH_COMPARE_COLLECTION_ONLY) != 0) && 
-				    (path_link = &path->head) && 
-				    (report_link == report_path->head.prev))) {
+				if((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) && (path_link == &path->head)) || 
+				   ((report_link == &report_path->head) && (path_link == &path->head))) {
 					return EOK;
 				}
@@ -232,13 +263,8 @@
 			break;
 
-		/* compare with only the end of path*/
+		/* path is suffix of report_path */
 		case USB_HID_PATH_COMPARE_END:
 
-				if((flags & USB_HID_PATH_COMPARE_COLLECTION_ONLY) != 0) {
-					report_link = report_path->head.prev->prev;
-				}
-				else {
-					report_link = report_path->head.prev;
-				}
+				report_link = report_path->head.prev;
 				path_link = path->head.prev;
 
