Changeset dc9f122 in mainline
- Timestamp:
- 2011-04-17T15:37:29Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ef354b6
- Parents:
- 681f24b3
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbkbd/kbddev.c
r681f24b3 rdc9f122 760 760 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0); 761 761 kbd_dev->key_count = usb_hid_report_input_length( 762 kbd_dev->parser, path, USB_HID_PATH_COMPARE_ USAGE_PAGE_ONLY);762 kbd_dev->parser, path, USB_HID_PATH_COMPARE_END); 763 763 usb_hid_report_path_free (path); 764 764 -
uspace/lib/usb/include/usb/classes/hidparser.h
r681f24b3 rdc9f122 73 73 #define USB_HID_PATH_COMPARE_END 1 74 74 #define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY 4 75 #define USB_HID_PATH_COMPARE_COLLECTION_ONLY 2 /* porovnava jenom cestu z Kolekci */ 75 76 76 77 -
uspace/lib/usb/src/hidparser.c
r681f24b3 rdc9f122 140 140 if(path_it == &report->collection_paths) { 141 141 path = usb_hid_report_path_clone(report_item->usage_path); 142 list_initialize(&path->link);143 144 142 list_append(&path->link, &report->collection_paths); 145 146 usb_hid_print_usage_path (report_item->usage_path);147 usb_hid_print_usage_path (path);148 usb_hid_print_usage_path(list_get_instance(report->collection_paths.prev, usb_hid_report_path_t, link));149 150 assert(usb_hid_report_compare_usage_path (report_item->usage_path,151 list_get_instance(report->collection_paths.prev,152 usb_hid_report_path_t, link),153 USB_HID_PATH_COMPARE_STRICT) == EOK);154 155 143 report->collection_paths_count++; 156 144 } … … 237 225 while(report_it != &report->reports) { 238 226 report_des = list_get_instance(report_it, usb_hid_report_description_t, link); 227 239 228 if((report_des->report_id == report_id) && (report_des->type == type)){ 240 break; 241 } 229 return report_des; 230 } 231 242 232 report_it = report_it->next; 243 233 } 244 if(report_it ==&report->reports){ 245 return NULL; 246 } 247 248 return report_des; 234 235 return NULL; 249 236 } 250 237 … … 341 328 * structure 342 329 */ 343 usb_log_debug("PRED: \n");344 if(report->collection_paths.next == &report->collection_paths) {345 usb_log_debug("PRAZDNY\n");346 }347 else {348 usb_hid_print_usage_path (list_get_instance(report->collection_paths.prev,usb_hid_report_path_t, link));349 }350 usb_log_debug("-----------\n");351 330 usb_hid_report_append_fields(report, report_item); 352 331 … … 971 950 field = list_get_instance(field_it, usb_hid_report_field_t, link); 972 951 if(USB_HID_ITEM_FLAG_CONSTANT(field->item_flags) == 0) { 973 if(usb_hid_report_compare_usage_path (path, field->collection_path, flags) == EOK) { 952 953 usb_hid_report_path_append_item (field->collection_path, field->usage_page, field->usage); 954 if(usb_hid_report_compare_usage_path (field->collection_path, path, flags) == EOK) { 974 955 ret++; 975 956 } 957 usb_hid_report_remove_last_item (field->collection_path); 976 958 } 977 959 … … 1006 988 item->flags = 0; 1007 989 1008 list_append (&item->link, &usage_path-> link);990 list_append (&item->link, &usage_path->head); 1009 991 usage_path->depth++; 1010 992 return EOK; … … 1020 1002 usb_hid_report_usage_path_t *item; 1021 1003 1022 if(!list_empty(&usage_path-> link)){1023 item = list_get_instance(usage_path-> link.prev, usb_hid_report_usage_path_t, link);1024 list_remove(usage_path-> link.prev);1004 if(!list_empty(&usage_path->head)){ 1005 item = list_get_instance(usage_path->head.prev, usb_hid_report_usage_path_t, link); 1006 list_remove(usage_path->head.prev); 1025 1007 usage_path->depth--; 1026 1008 free(item); … … 1038 1020 usb_hid_report_usage_path_t *item; 1039 1021 1040 if(!list_empty(&usage_path-> link)){1041 item = list_get_instance(usage_path-> link.prev, usb_hid_report_usage_path_t, link);1022 if(!list_empty(&usage_path->head)){ 1023 item = list_get_instance(usage_path->head.prev, usb_hid_report_usage_path_t, link); 1042 1024 memset(item, 0, sizeof(usb_hid_report_usage_path_t)); 1043 1025 } … … 1057 1039 usb_hid_report_usage_path_t *item; 1058 1040 1059 if(!list_empty(&usage_path-> link)){1060 item = list_get_instance(usage_path-> link.prev, usb_hid_report_usage_path_t, link);1041 if(!list_empty(&usage_path->head)){ 1042 item = list_get_instance(usage_path->head.prev, usb_hid_report_usage_path_t, link); 1061 1043 1062 1044 switch(tag) { … … 1078 1060 usb_log_debug("\tLENGTH: %d\n", path->depth); 1079 1061 1080 link_t *item = path-> link.next;1062 link_t *item = path->head.next; 1081 1063 usb_hid_report_usage_path_t *path_item; 1082 while(item != &path-> link) {1064 while(item != &path->head) { 1083 1065 1084 1066 path_item = list_get_instance(item, usb_hid_report_usage_path_t, link); … … 1094 1076 * Compares two usage paths structures 1095 1077 * 1078 * If USB_HID_PATH_COMPARE_COLLECTION_ONLY flag is given, the last item in report_path structure is forgotten 1079 * 1096 1080 * @param report_path usage path structure to compare 1097 1081 * @param path usage patrh structure to compare … … 1119 1103 } 1120 1104 1121 //usb_log_debug("---------- PATH COMPARISON ----------\n\n");1122 //usb_hid_print_usage_path(report_path);1123 //usb_hid_print_usage_path(path);1124 1125 1105 1126 1106 if((only_page = flags & USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY) != 0){ … … 1152 1132 } 1153 1133 1154 if((report_link == &report_path->head) && (path_link == &path->head)) { 1134 if(((report_link == &report_path->head) && (path_link == &path->head)) || 1135 (((flags & USB_HID_PATH_COMPARE_COLLECTION_ONLY) != 0) && (path_link = &path->head) && (report_link == report_path->head.prev))) { 1155 1136 return EOK; 1156 1137 } … … 1162 1143 /* compare with only the end of path*/ 1163 1144 case USB_HID_PATH_COMPARE_END: 1164 report_link = report_path->head.prev; 1145 1146 if((flags & USB_HID_PATH_COMPARE_COLLECTION_ONLY) != 0) { 1147 report_link = report_path->head.prev->prev; 1148 } 1149 else { 1150 report_link = report_path->head.prev; 1151 } 1165 1152 path_link = path->head.prev; 1166 1153 … … 1217 1204 path->report_id = 0; 1218 1205 list_initialize(&path->link); 1206 list_initialize(&path->head); 1219 1207 return path; 1220 1208 } … … 1229 1217 void usb_hid_report_path_free(usb_hid_report_path_t *path) 1230 1218 { 1231 while(!list_empty(&path-> link)){1219 while(!list_empty(&path->head)){ 1232 1220 usb_hid_report_remove_last_item(path); 1233 1221 } … … 1255 1243 } 1256 1244 1257 if(list_empty(&usage_path-> link)){1245 if(list_empty(&usage_path->head)){ 1258 1246 return new_usage_path; 1259 1247 } 1260 1248 1261 path_link = usage_path-> link.next;1262 while(path_link != &usage_path-> link) {1249 path_link = usage_path->head.next; 1250 while(path_link != &usage_path->head) { 1263 1251 path_item = list_get_instance(path_link, usb_hid_report_usage_path_t, link); 1264 1252 new_path_item = malloc(sizeof(usb_hid_report_usage_path_t)); … … 1266 1254 return NULL; 1267 1255 } 1268 1269 list_initialize (&new_path_item->link); 1256 1257 list_initialize (&new_path_item->link); 1270 1258 new_path_item->usage_page = path_item->usage_page; 1271 1259 new_path_item->usage = path_item->usage; 1272 1260 new_path_item->flags = path_item->flags; 1273 1261 1274 list_append(&new_path_item->link, &new_usage_path-> link);1262 list_append(&new_path_item->link, &new_usage_path->head); 1275 1263 new_usage_path->depth++; 1276 1264 … … 1303 1291 while(report_it != &report->reports) { 1304 1292 report_des = list_get_instance(report_it, usb_hid_report_description_t, link); 1305 if((report_des->report_id == report_id) && (report_des->type = USB_HID_REPORT_TYPE_OUTPUT)){1293 if((report_des->report_id == report_id) && (report_des->type == USB_HID_REPORT_TYPE_OUTPUT)){ 1306 1294 break; 1307 1295 } … … 1357 1345 return 0; 1358 1346 } 1359 1347 1360 1348 link_t *field_it = report_des->report_items.next; 1361 1349 usb_hid_report_field_t *field; … … 1363 1351 1364 1352 field = list_get_instance(field_it, usb_hid_report_field_t, link); 1365 // TODO: bacha na porovnani - posledni prvek v ceste uz jsou usage/page z inputu a ne kolekce!!!1353 usb_hid_report_path_append_item (field->collection_path, field->usage_page, field->usage); 1366 1354 if(usb_hid_report_compare_usage_path (field->collection_path, path, flags) == EOK) { 1367 1355 ret++; 1368 1356 } 1357 usb_hid_report_remove_last_item (field->collection_path); 1369 1358 1370 1359 field_it = field_it->next; … … 1594 1583 field = list_get_instance(field_it, usb_hid_report_field_t, link); 1595 1584 if(USB_HID_ITEM_FLAG_CONSTANT(field->item_flags) == 0) { 1596 if(usb_hid_report_compare_usage_path (path, field->collection_path, 1585 usb_hid_report_path_append_item (field->collection_path, field->usage_page, field->usage); 1586 if(usb_hid_report_compare_usage_path (field->collection_path, path, 1597 1587 flags) == EOK) { 1598 1588 … … 1604 1594 } 1605 1595 } 1596 usb_hid_report_remove_last_item (field->collection_path); 1606 1597 } 1607 1598
Note:
See TracChangeset
for help on using the changeset viewer.