Changes in / [45a2688:1ce4189] in mainline
- Location:
- uspace/lib/usb
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/classes/hidpath.h
r45a2688 r1ce4189 44 44 */ 45 45 /** Wanted usage path must be exactly the same as the searched one */ 46 #define USB_HID_PATH_COMPARE_STRICT 046 #define USB_HID_PATH_COMPARE_STRICT 0 47 47 /** Wanted usage path must be the suffix in the searched one */ 48 #define USB_HID_PATH_COMPARE_END 148 #define USB_HID_PATH_COMPARE_END 1 49 49 /** */ 50 #define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY 2 50 #define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY 4 51 #define USB_HID_PATH_COMPARE_COLLECTION_ONLY 2 /* porovnava jenom cestu z Kolekci */ 51 52 /** Searched usage page must be prefix of the other one */ 52 #define USB_HID_PATH_COMPARE_BEGIN 453 #define USB_HID_PATH_COMPARE_BEGIN 8 53 54 /** Searched couple of usage page and usage can be anywhere in usage path */ 54 #define USB_HID_PATH_COMPARE_ANYWHERE 8 55 #define USB_HID_PATH_COMPARE_WHERE 16 56 /** 57 * TODO 58 * * porovnani zacatek - neni to to samy jako COLLECTION ONLY?? -- TEST 59 * * porovnani kdekoliv (jenom s delkou 1 at si to moc nekomplikujem) 60 */ 55 61 56 62 -
uspace/lib/usb/src/hiddescriptor.c
r45a2688 r1ce4189 437 437 int usb_hid_report_parse_main_tag(uint8_t tag, const uint8_t *data, size_t item_size, 438 438 usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path) 439 { 440 usb_hid_report_usage_path_t *path_item; 441 439 { 442 440 switch(tag) 443 441 { … … 450 448 451 449 case USB_HID_REPORT_TAG_COLLECTION: 452 // store collection atributes 453 path_item = list_get_instance(usage_path->head.prev, usb_hid_report_usage_path_t, link); 454 path_item->flags = *data; 450 //TODO: usage_path->flags = *data; 455 451 452 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]); 453 usb_hid_print_usage_path(usage_path); 454 456 455 // set last item 457 456 usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_GLOBAL, report_item->usage_page); 458 457 usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_LOCAL, report_item->usages[report_item->usages_count-1]); 459 460 458 // append the new one which will be set by common 461 459 // usage/usage page 462 460 usb_hid_report_path_append_item(usage_path, report_item->usage_page, report_item->usages[report_item->usages_count-1]); 461 usb_hid_print_usage_path(usage_path); 462 463 463 usb_hid_report_reset_local_items (report_item); 464 464 return USB_HID_NO_ACTION; … … 551 551 usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path) 552 552 { 553 switch(tag) { 553 switch(tag) 554 { 554 555 case USB_HID_REPORT_TAG_USAGE: 555 switch(report_item->in_delimiter) { 556 case INSIDE_DELIMITER_SET: 557 // nothing to do 558 break; 559 case START_DELIMITER_SET: 560 report_item->in_delimiter = INSIDE_DELIMITER_SET; 561 case OUTSIDE_DELIMITER_SET: 562 report_item->usages[report_item->usages_count] = usb_hid_report_tag_data_uint32(data,item_size); 563 report_item->usages_count++; 564 break; 565 } 556 report_item->usages[report_item->usages_count] = usb_hid_report_tag_data_uint32(data,item_size); 557 report_item->usages_count++; 566 558 break; 567 559 case USB_HID_REPORT_TAG_USAGE_MINIMUM: … … 604 596 break; 605 597 case USB_HID_REPORT_TAG_DELIMITER: 606 report_item->in_delimiter = usb_hid_report_tag_data_uint32(data,item_size); 607 break; 608 598 if (report_item->in_delimiter == OUTSIDE_DELIMITER_SET) { 599 report_item->in_delimiter = START_DELIMITER_SET; 600 } 601 else { 602 report_item->in_delimiter = OUTSIDE_DELIMITER_SET; 603 } 604 605 break; 606 609 607 default: 610 608 return USB_HID_NO_ACTION; 611 609 } 612 610 613 611 return EOK; 614 612 } -
uspace/lib/usb/src/hidpath.c
r45a2688 r1ce4189 149 149 usb_log_debug("\tFLAGS: %d\n", path_item->flags); 150 150 151 151 item = item->next; 152 152 } 153 153 } … … 156 156 * Compares two usage paths structures 157 157 * 158 * 159 * @param report_path usage path structure to compare with @path 158 * If USB_HID_PATH_COMPARE_COLLECTION_ONLY flag is given, the last item in report_path structure is forgotten 159 * 160 * @param report_path usage path structure to compare 160 161 * @param path usage patrh structure to compare 161 162 * @param flags Flags determining the mode of comparison … … 178 179 } 179 180 180 // Empty path match all others181 181 if(path->depth == 0){ 182 182 return EOK; … … 189 189 190 190 switch(flags){ 191 /* path is somewhere in report_path */ 192 case USB_HID_PATH_COMPARE_ANYWHERE: 193 if(path->depth != 1){ 194 return 1; 195 } 196 197 // projit skrz cestu a kdyz nekde sedi tak vratim EOK 198 // dojduli az za konec tak nnesedi 199 report_link = report_path->head.next; 200 path_link = path->head.next; 201 path_item = list_get_instance(path_link, usb_hid_report_usage_path_t, link); 202 203 while(report_link != &report_path->head) { 204 report_item = list_get_instance(report_link, usb_hid_report_usage_path_t, link); 205 if(report_item->usage_page == path_item->usage_page){ 206 if(only_page == 0){ 207 if(report_item->usage == path_item->usage) { 208 return EOK; 209 } 210 } 211 else { 212 return EOK; 213 } 214 } 215 216 report_link = report_link->next; 217 } 218 219 return 1; 220 break; 221 /* the paths must be identical */ 191 /* path must be completly identical */ 222 192 case USB_HID_PATH_COMPARE_STRICT: 223 193 if(report_path->depth != path->depth){ 224 194 return 1; 225 195 } 226 227 /* path is prefix of the report_path */ 228 case USB_HID_PATH_COMPARE_BEGIN: 229 196 230 197 report_link = report_path->head.next; 231 198 path_link = path->head.next; … … 254 221 } 255 222 256 if((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) && (path_link == &path->head)) || 257 ((report_link == &report_path->head) && (path_link == &path->head))) { 223 if(((report_link == &report_path->head) && (path_link == &path->head)) || 224 (((flags & USB_HID_PATH_COMPARE_COLLECTION_ONLY) != 0) && 225 (path_link = &path->head) && 226 (report_link == report_path->head.prev))) { 258 227 return EOK; 259 228 } … … 263 232 break; 264 233 265 /* path is suffix of report_path*/234 /* compare with only the end of path*/ 266 235 case USB_HID_PATH_COMPARE_END: 267 236 268 report_link = report_path->head.prev; 237 if((flags & USB_HID_PATH_COMPARE_COLLECTION_ONLY) != 0) { 238 report_link = report_path->head.prev->prev; 239 } 240 else { 241 report_link = report_path->head.prev; 242 } 269 243 path_link = path->head.prev; 270 244
Note:
See TracChangeset
for help on using the changeset viewer.