Changes in / [966acede:ec6bee4] in mainline
- Location:
- uspace/lib/usb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/classes/hidparser.h
r966acede rec6bee4 88 88 /** */ 89 89 int depth; 90 uint8_t report_id; 90 91 91 92 /** */ … … 155 156 /** */ 156 157 link_t feature; 158 159 int use_report_id; 160 157 161 } usb_hid_report_parser_t; 158 162 … … 166 170 * @param arg Custom argument. 167 171 */ 168 void (*keyboard)(const uint8_t *key_codes, size_t count, const uint8_t modifiers, void *arg);172 void (*keyboard)(const uint8_t *key_codes, size_t count, const uint8_t report_id, void *arg); 169 173 } usb_hid_report_in_callbacks_t; 170 174 … … 269 273 270 274 /** */ 275 int usb_hid_report_path_set_report_id(usb_hid_report_path_t *usage_path, uint8_t report_id); 276 277 /** */ 271 278 int usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path, int32_t usage_page, int32_t usage); 272 279 -
uspace/lib/usb/src/hidparser.c
r966acede rec6bee4 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.