Index: uspace/lib/usb/include/usb/classes/hidparser.h
===================================================================
--- uspace/lib/usb/include/usb/classes/hidparser.h	(revision 681f24b32274b5a4925e0ca4d3d1d5c1ffa25354)
+++ uspace/lib/usb/include/usb/classes/hidparser.h	(revision dc9f12251f15ff67ad9db59107ca087932736d09)
@@ -73,4 +73,5 @@
 #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 */
 
 
Index: uspace/lib/usb/src/hidparser.c
===================================================================
--- uspace/lib/usb/src/hidparser.c	(revision 681f24b32274b5a4925e0ca4d3d1d5c1ffa25354)
+++ uspace/lib/usb/src/hidparser.c	(revision dc9f12251f15ff67ad9db59107ca087932736d09)
@@ -140,17 +140,5 @@
 	if(path_it == &report->collection_paths) {
 		path = usb_hid_report_path_clone(report_item->usage_path);			
-		list_initialize(&path->link);
-
 		list_append(&path->link, &report->collection_paths);					
-		
-		usb_hid_print_usage_path (report_item->usage_path);
-		usb_hid_print_usage_path (path);
-		usb_hid_print_usage_path(list_get_instance(report->collection_paths.prev, usb_hid_report_path_t, link));
-
-		assert(usb_hid_report_compare_usage_path (report_item->usage_path, 
-        	list_get_instance(report->collection_paths.prev, 
-	                          usb_hid_report_path_t, link), 
-			USB_HID_PATH_COMPARE_STRICT) == EOK);
-
 		report->collection_paths_count++;
 	}
@@ -237,14 +225,13 @@
 	while(report_it != &report->reports) {
 		report_des = list_get_instance(report_it, usb_hid_report_description_t, link);
+
 		if((report_des->report_id == report_id) && (report_des->type == type)){
-			break;
-		}
+			return report_des;
+		}
+		
 		report_it = report_it->next;
 	}
-	if(report_it ==&report->reports){
-		return NULL;
-	}
-
-	return report_des;
+
+	return NULL;
 }
 
@@ -341,12 +328,4 @@
 					 * structure 					 
 					 */
-					usb_log_debug("PRED: \n");
-					if(report->collection_paths.next == &report->collection_paths) {
-						usb_log_debug("PRAZDNY\n");
-					}
-					else {
-						usb_hid_print_usage_path (list_get_instance(report->collection_paths.prev,usb_hid_report_path_t, link));
-					}
-					usb_log_debug("-----------\n");
 					usb_hid_report_append_fields(report, report_item);
 
@@ -971,7 +950,10 @@
 		field = list_get_instance(field_it, usb_hid_report_field_t, link);
 		if(USB_HID_ITEM_FLAG_CONSTANT(field->item_flags) == 0) {
-			if(usb_hid_report_compare_usage_path (path, field->collection_path, flags) == EOK) {
+			
+			usb_hid_report_path_append_item (field->collection_path, field->usage_page, field->usage);
+			if(usb_hid_report_compare_usage_path (field->collection_path, path, flags) == EOK) {
 				ret++;
 			}
+			usb_hid_report_remove_last_item (field->collection_path);
 		}
 		
@@ -1006,5 +988,5 @@
 	item->flags = 0;
 	
-	list_append (&item->link, &usage_path->link);
+	list_append (&item->link, &usage_path->head);
 	usage_path->depth++;
 	return EOK;
@@ -1020,7 +1002,7 @@
 	usb_hid_report_usage_path_t *item;
 	
-	if(!list_empty(&usage_path->link)){
-		item = list_get_instance(usage_path->link.prev, usb_hid_report_usage_path_t, link);		
-		list_remove(usage_path->link.prev);
+	if(!list_empty(&usage_path->head)){
+		item = list_get_instance(usage_path->head.prev, usb_hid_report_usage_path_t, link);		
+		list_remove(usage_path->head.prev);
 		usage_path->depth--;
 		free(item);
@@ -1038,6 +1020,6 @@
 	usb_hid_report_usage_path_t *item;
 	
-	if(!list_empty(&usage_path->link)){	
-		item = list_get_instance(usage_path->link.prev, usb_hid_report_usage_path_t, link);
+	if(!list_empty(&usage_path->head)){	
+		item = list_get_instance(usage_path->head.prev, usb_hid_report_usage_path_t, link);
 		memset(item, 0, sizeof(usb_hid_report_usage_path_t));
 	}
@@ -1057,6 +1039,6 @@
 	usb_hid_report_usage_path_t *item;
 	
-	if(!list_empty(&usage_path->link)){	
-		item = list_get_instance(usage_path->link.prev, usb_hid_report_usage_path_t, link);
+	if(!list_empty(&usage_path->head)){	
+		item = list_get_instance(usage_path->head.prev, usb_hid_report_usage_path_t, link);
 
 		switch(tag) {
@@ -1078,7 +1060,7 @@
 	usb_log_debug("\tLENGTH: %d\n", path->depth);
 
-	link_t *item = path->link.next;
+	link_t *item = path->head.next;
 	usb_hid_report_usage_path_t *path_item;
-	while(item != &path->link) {
+	while(item != &path->head) {
 
 		path_item = list_get_instance(item, usb_hid_report_usage_path_t, link);
@@ -1094,4 +1076,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 path usage patrh structure to compare
@@ -1119,8 +1103,4 @@
 	}
 
-	//usb_log_debug("---------- PATH COMPARISON ----------\n\n");
-	//usb_hid_print_usage_path(report_path);
-	//usb_hid_print_usage_path(path);
-	
 
 	if((only_page = flags & USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY) != 0){
@@ -1152,5 +1132,6 @@
 				}
 
-				if((report_link == &report_path->head) && (path_link == &path->head)) {
+				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))) {
 					return EOK;
 				}
@@ -1162,5 +1143,11 @@
 		/* compare with only the end of path*/
 		case USB_HID_PATH_COMPARE_END:
-				report_link = report_path->head.prev;
+
+				if((flags & USB_HID_PATH_COMPARE_COLLECTION_ONLY) != 0) {
+					report_link = report_path->head.prev->prev;
+				}
+				else {
+					report_link = report_path->head.prev;
+				}
 				path_link = path->head.prev;
 
@@ -1217,4 +1204,5 @@
 		path->report_id = 0;
 		list_initialize(&path->link);
+		list_initialize(&path->head);
 		return path;
 	}
@@ -1229,5 +1217,5 @@
 void usb_hid_report_path_free(usb_hid_report_path_t *path)
 {
-	while(!list_empty(&path->link)){
+	while(!list_empty(&path->head)){
 		usb_hid_report_remove_last_item(path);
 	}
@@ -1255,10 +1243,10 @@
 	}
 	
-	if(list_empty(&usage_path->link)){
+	if(list_empty(&usage_path->head)){
 		return new_usage_path;
 	}
 
-	path_link = usage_path->link.next;
-	while(path_link != &usage_path->link) {
+	path_link = usage_path->head.next;
+	while(path_link != &usage_path->head) {
 		path_item = list_get_instance(path_link, usb_hid_report_usage_path_t, link);
 		new_path_item = malloc(sizeof(usb_hid_report_usage_path_t));
@@ -1266,11 +1254,11 @@
 			return NULL;
 		}
-
-		list_initialize (&new_path_item->link);
+		
+		list_initialize (&new_path_item->link);		
 		new_path_item->usage_page = path_item->usage_page;
 		new_path_item->usage = path_item->usage;		
 		new_path_item->flags = path_item->flags;		
 		
-		list_append(&new_path_item->link, &new_usage_path->link);
+		list_append(&new_path_item->link, &new_usage_path->head);
 		new_usage_path->depth++;
 
@@ -1303,5 +1291,5 @@
 	while(report_it != &report->reports) {
 		report_des = list_get_instance(report_it, usb_hid_report_description_t, link);
-		if((report_des->report_id == report_id) && (report_des->type = USB_HID_REPORT_TYPE_OUTPUT)){
+		if((report_des->report_id == report_id) && (report_des->type == USB_HID_REPORT_TYPE_OUTPUT)){
 			break;
 		}
@@ -1357,5 +1345,5 @@
 		return 0;
 	}
-
+	
 	link_t *field_it = report_des->report_items.next;
 	usb_hid_report_field_t *field;
@@ -1363,8 +1351,9 @@
 
 		field = list_get_instance(field_it, usb_hid_report_field_t, link);
-		// TODO: bacha na porovnani - posledni prvek v ceste uz jsou usage/page z inputu a ne kolekce!!!
+		usb_hid_report_path_append_item (field->collection_path, field->usage_page, field->usage);
 		if(usb_hid_report_compare_usage_path (field->collection_path, path, flags) == EOK) {
 			ret++;
 		}
+		usb_hid_report_remove_last_item (field->collection_path);
 		
 		field_it = field_it->next;
@@ -1594,5 +1583,6 @@
 		field = list_get_instance(field_it, usb_hid_report_field_t, link);		
 		if(USB_HID_ITEM_FLAG_CONSTANT(field->item_flags) == 0) {
-			if(usb_hid_report_compare_usage_path (path, field->collection_path, 
+			usb_hid_report_path_append_item (field->collection_path, field->usage_page, field->usage);
+			if(usb_hid_report_compare_usage_path (field->collection_path, path, 
 		                                      flags) == EOK) {
 
@@ -1604,4 +1594,5 @@
 				}
 			}
+			usb_hid_report_remove_last_item (field->collection_path);
 		}
 		
