Changeset bda06a3 in mainline for uspace/lib/usb/src/hidparser.c
- Timestamp:
- 2011-04-01T15:02:09Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a9974ef, ec6bee4
- Parents:
- 70a71e5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hidparser.c
r70a71e5 rbda06a3 106 106 list_initialize(&(parser->feature)); 107 107 108 parser->use_report_id = 0; 108 109 return EOK; 109 110 } … … 186 187 tmp_usage_path = NULL; 187 188 189 usb_hid_report_path_set_report_id(report_item->usage_path, report_item->id); 190 if(report_item->id != 0){ 191 parser->use_report_id = 1; 192 } 188 193 189 194 switch(tag) { … … 647 652 } 648 653 654 parser->use_report_id = 0; 655 649 656 usb_hid_free_report_list(&parser->input); 650 657 usb_hid_free_report_list(&parser->output); … … 676 683 size_t i=0; 677 684 size_t j=0; 685 uint8_t report_id = 0; 678 686 679 687 if(parser == NULL) { … … 686 694 if(!(keys = malloc(sizeof(uint8_t) * key_count))){ 687 695 return ENOMEM; 696 } 697 698 if(parser->use_report_id != 0) { 699 report_id = data[0]; 700 usb_hid_report_path_set_report_id(path, report_id); 688 701 } 689 702 … … 693 706 694 707 item = list_get_instance(list_item, usb_hid_report_item_t, link); 708 695 709 if(!USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) && 696 710 (usb_hid_report_compare_usage_path(item->usage_path, path, flags) == EOK)) { … … 715 729 } 716 730 717 callbacks->keyboard(keys, key_count, 0, arg);731 callbacks->keyboard(keys, key_count, report_id, arg); 718 732 719 733 free(keys); … … 739 753 int32_t mask; 740 754 const uint8_t *foo; 741 755 742 756 // now only common numbers llowed 743 757 if(item->size > 32) { … … 758 772 (usb_pow(10,(item->unit_exponent)))); 759 773 } 774 760 775 offset = item->offset + (j * item->size); 776 if(item->id != 0) { 777 offset += 8; 778 usb_log_debug("MOVED OFFSET BY 1Byte, REPORT_ID(%d)\n", item->id); 779 } 761 780 762 781 // FIXME … … 942 961 943 962 int only_page; 963 964 if(report_path->report_id != path->report_id) { 965 return 1; 966 } 944 967 945 968 if(path->depth == 0){ … … 1038 1061 else { 1039 1062 path->depth = 0; 1063 path->report_id = 0; 1040 1064 list_initialize(&path->link); 1041 1065 return path; … … 1155 1179 return 0; 1156 1180 } 1157 1181 1158 1182 item = parser->output.next; 1159 1183 while(&parser->output != item) { … … 1195 1219 int length; 1196 1220 int32_t tmp_value; 1221 size_t offset_prefix = 0; 1197 1222 1198 1223 if(parser == NULL) { 1199 1224 return EINVAL; 1225 } 1226 1227 if(parser->use_report_id != 0) { 1228 buffer[0] = path->report_id; 1229 offset_prefix = 8; 1200 1230 } 1201 1231 … … 1218 1248 // // variable item 1219 1249 value = usb_hid_translate_data_reverse(report_item, data[idx++]); 1220 offset = report_item->offset + (i * report_item->size) ;1250 offset = report_item->offset + (i * report_item->size) + offset_prefix; 1221 1251 length = report_item->size; 1222 1252 } … … 1224 1254 //bitmap 1225 1255 value += usb_hid_translate_data_reverse(report_item, data[idx++]); 1226 offset = report_item->offset ;1256 offset = report_item->offset + offset_prefix; 1227 1257 length = report_item->size * report_item->count; 1228 1258 } … … 1323 1353 1324 1354 1355 int usb_hid_report_path_set_report_id(usb_hid_report_path_t *path, uint8_t report_id) 1356 { 1357 if(path == NULL){ 1358 return EINVAL; 1359 } 1360 1361 path->report_id = report_id; 1362 return EOK; 1363 } 1364 1325 1365 /** 1326 1366 * @}
Note:
See TracChangeset
for help on using the changeset viewer.