Changes in / [ec6bee4:966acede] in mainline
- Location:
- uspace/lib/usb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/classes/hidparser.h
rec6bee4 r966acede 88 88 /** */ 89 89 int depth; 90 uint8_t report_id;91 90 92 91 /** */ … … 156 155 /** */ 157 156 link_t feature; 158 159 int use_report_id;160 161 157 } usb_hid_report_parser_t; 162 158 … … 170 166 * @param arg Custom argument. 171 167 */ 172 void (*keyboard)(const uint8_t *key_codes, size_t count, const uint8_t report_id, void *arg);168 void (*keyboard)(const uint8_t *key_codes, size_t count, const uint8_t modifiers, void *arg); 173 169 } usb_hid_report_in_callbacks_t; 174 170 … … 273 269 274 270 /** */ 275 int usb_hid_report_path_set_report_id(usb_hid_report_path_t *usage_path, uint8_t report_id);276 277 /** */278 271 int usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path, int32_t usage_page, int32_t usage); 279 272 -
uspace/lib/usb/src/hidparser.c
rec6bee4 r966acede 106 106 list_initialize(&(parser->feature)); 107 107 108 parser->use_report_id = 0;109 108 return EOK; 110 109 } … … 187 186 tmp_usage_path = NULL; 188 187 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 }193 188 194 189 switch(tag) { … … 652 647 } 653 648 654 parser->use_report_id = 0;655 656 649 usb_hid_free_report_list(&parser->input); 657 650 usb_hid_free_report_list(&parser->output); … … 683 676 size_t i=0; 684 677 size_t j=0; 685 uint8_t report_id = 0;686 678 687 679 if(parser == NULL) { … … 694 686 if(!(keys = malloc(sizeof(uint8_t) * key_count))){ 695 687 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);701 688 } 702 689 … … 706 693 707 694 item = list_get_instance(list_item, usb_hid_report_item_t, link); 708 709 695 if(!USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) && 710 696 (usb_hid_report_compare_usage_path(item->usage_path, path, flags) == EOK)) { … … 729 715 } 730 716 731 callbacks->keyboard(keys, key_count, report_id, arg);717 callbacks->keyboard(keys, key_count, 0, arg); 732 718 733 719 free(keys); … … 753 739 int32_t mask; 754 740 const uint8_t *foo; 755 741 756 742 // now only common numbers llowed 757 743 if(item->size > 32) { … … 772 758 (usb_pow(10,(item->unit_exponent)))); 773 759 } 774 775 760 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 }780 761 781 762 // FIXME … … 961 942 962 943 int only_page; 963 964 if(report_path->report_id != path->report_id) {965 return 1;966 }967 944 968 945 if(path->depth == 0){ … … 1061 1038 else { 1062 1039 path->depth = 0; 1063 path->report_id = 0;1064 1040 list_initialize(&path->link); 1065 1041 return path; … … 1179 1155 return 0; 1180 1156 } 1181 1157 1182 1158 item = parser->output.next; 1183 1159 while(&parser->output != item) { … … 1219 1195 int length; 1220 1196 int32_t tmp_value; 1221 size_t offset_prefix = 0;1222 1197 1223 1198 if(parser == NULL) { 1224 1199 return EINVAL; 1225 }1226 1227 if(parser->use_report_id != 0) {1228 buffer[0] = path->report_id;1229 offset_prefix = 8;1230 1200 } 1231 1201 … … 1248 1218 // // variable item 1249 1219 value = usb_hid_translate_data_reverse(report_item, data[idx++]); 1250 offset = report_item->offset + (i * report_item->size) + offset_prefix;1220 offset = report_item->offset + (i * report_item->size); 1251 1221 length = report_item->size; 1252 1222 } … … 1254 1224 //bitmap 1255 1225 value += usb_hid_translate_data_reverse(report_item, data[idx++]); 1256 offset = report_item->offset + offset_prefix;1226 offset = report_item->offset; 1257 1227 length = report_item->size * report_item->count; 1258 1228 } … … 1353 1323 1354 1324 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 1365 1325 /** 1366 1326 * @}
Note:
See TracChangeset
for help on using the changeset viewer.