Changeset bd2394b in mainline
- Timestamp:
- 2011-05-07T10:53:41Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cc5908e
- Parents:
- ba17f5b
- Location:
- uspace
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/kbd/kbddev.c
rba17f5b rbd2394b 693 693 694 694 while (field != NULL) { 695 usb_log_debug2("FIELD (%p) - VALUE(%d) USAGE(%u)\n",696 field, field->value, field->usage);695 //usb_log_debug2("FIELD (%p) - VALUE(%d) USAGE(%u)\n", 696 // field, field->value, field->usage); 697 697 698 698 assert(i < kbd_dev->key_count); … … 858 858 usb_hid_report_path_set_report_id(path, 0); 859 859 860 kbd_dev->key_count = usb_hid_report_input_length( 861 hid_dev->report, path, 862 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY); 860 kbd_dev->key_count = usb_hid_report_size( 861 hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT); 863 862 usb_hid_report_path_free(path); 864 863 … … 901 900 kbd_dev->led_path, USB_HIDUT_PAGE_LED, 0); 902 901 903 kbd_dev->led_output_size = usb_hid_report_output_size(hid_dev->report, 904 kbd_dev->led_path, 905 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY); 902 kbd_dev->led_output_size = usb_hid_report_size(hid_dev->report, 0, 903 USB_HID_REPORT_TYPE_OUTPUT); 906 904 907 905 usb_log_debug("Output report size (in items): %zu\n", -
uspace/drv/usbhid/lgtch-ultrax/lgtch-ultrax.c
rba17f5b rbd2394b 300 300 usb_hid_report_path_set_report_id(path, 1); 301 301 302 lgtch_dev->key_count = usb_hid_report_ input_length(303 hid_dev->report, path,304 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY);302 lgtch_dev->key_count = usb_hid_report_size(hid_dev->report, 1, 303 USB_HID_REPORT_TYPE_INPUT); 304 305 305 usb_hid_report_path_free(path); 306 306 -
uspace/drv/usbhid/usbhid.c
rba17f5b rbd2394b 201 201 202 202 usb_log_debug("Compare flags: %d\n", mapping->compare); 203 size_t size = usb_hid_report_ input_length(hid_dev->report, usage_path,204 mapping->compare);203 size_t size = usb_hid_report_size(hid_dev->report, mapping->report_id, 204 USB_HID_REPORT_TYPE_INPUT); 205 205 usb_log_debug("Size of the input report: %zuB\n", size); 206 206 -
uspace/drv/usbkbd/kbddev.c
rba17f5b rbd2394b 771 771 usb_hid_report_path_set_report_id(path, 0); 772 772 773 kbd_dev->key_count = usb_hid_report_ input_length(774 kbd_dev->parser, path, USB_HID_PATH_COMPARE_END);773 kbd_dev->key_count = usb_hid_report_size( 774 kbd_dev->parser, 0, USB_HID_REPORT_TYPE_INPUT); 775 775 usb_hid_report_path_free (path); 776 776 … … 803 803 usb_hid_report_path_set_report_id(kbd_dev->led_path, 0x00); 804 804 805 kbd_dev->led_output_size = usb_hid_report_output_size(kbd_dev->parser, 806 kbd_dev->led_path, 807 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY); 805 kbd_dev->led_output_size = usb_hid_report_size(kbd_dev->parser, 0, 806 USB_HID_REPORT_TYPE_OUTPUT); 808 807 809 808 usb_log_debug("Output report size (in items): %zu\n", -
uspace/lib/usb/include/usb/classes/hidparser.h
rba17f5b rbd2394b 51 51 size_t size, uint8_t *report_id); 52 52 53 /** */54 size_t usb_hid_report_input_length(const usb_hid_report_t *report,55 usb_hid_report_path_t *path, int flags);56 57 53 /* 58 54 * Output report parser functions … … 65 61 void usb_hid_report_output_free(uint8_t *output); 66 62 67 /** Returns size of output for given usage path*/68 size_t usb_hid_report_ output_size(usb_hid_report_t *report,69 usb_hid_report_path_t *path, int flags);63 /** Returns size of report in items */ 64 size_t usb_hid_report_size(usb_hid_report_t *report, uint8_t report_id, 65 usb_hid_report_type_t type); 70 66 71 67 /** Makes the output report buffer by translated given data */ -
uspace/lib/usb/src/hiddescriptor.c
rba17f5b rbd2394b 566 566 break; 567 567 case USB_HID_REPORT_TAG_USAGE_MINIMUM: 568 569 usb_log_debug("USAGE_MINIMUM (SIZE: %d), data[0](%x), data[1](%x), data[2](%x) data[3](%x)\n", 570 item_size, *data, *(data+1), *(data+2), *(data+3)); 571 568 572 if (item_size == 3) { 569 573 // usage extended usages -
uspace/lib/usb/src/hidparser.c
rba17f5b rbd2394b 69 69 70 70 71 /** Returns size of report of specified report id and type in items 72 * 73 * @param parser Opaque report parser structure 74 * @param report_id 75 * @param type 76 * @return Number of items in specified report 77 */ 78 size_t usb_hid_report_size(usb_hid_report_t *report, uint8_t report_id, 79 usb_hid_report_type_t type) 80 { 81 usb_hid_report_description_t *report_des; 82 83 if(report == NULL) { 84 return 0; 85 } 86 87 report_des = usb_hid_report_find_description (report, report_id, type); 88 if(report_des == NULL){ 89 return 0; 90 } 91 else { 92 return report_des->item_length; 93 } 94 } 71 95 72 96 … … 206 230 } 207 231 208 /**209 * Returns number of items in input report which are accessible by given usage path210 *211 * @param parser Opaque report descriptor structure212 * @param path Usage path specification213 * @param flags Usage path comparison flags214 * @return Number of items in input report215 */216 size_t usb_hid_report_input_length(const usb_hid_report_t *report,217 usb_hid_report_path_t *path, int flags)218 {219 220 size_t ret = 0;221 222 if(report == NULL) {223 return 0;224 }225 226 usb_hid_report_description_t *report_des;227 report_des = usb_hid_report_find_description (report, path->report_id, USB_HID_REPORT_TYPE_INPUT);228 if(report_des == NULL) {229 return 0;230 }231 232 link_t *field_it = report_des->report_items.next;233 usb_hid_report_field_t *field;234 while(field_it != &report_des->report_items) {235 236 field = list_get_instance(field_it, usb_hid_report_field_t, link);237 if(USB_HID_ITEM_FLAG_CONSTANT(field->item_flags) == 0) {238 239 usb_hid_report_path_append_item (field->collection_path, field->usage_page, field->usage);240 if(usb_hid_report_compare_usage_path (field->collection_path, path, flags) == EOK) {241 ret++;242 }243 usb_hid_report_remove_last_item (field->collection_path);244 }245 246 field_it = field_it->next;247 }248 249 return ret;250 }251 252 232 /*** OUTPUT API **/ 253 233 … … 302 282 free (output); 303 283 } 304 }305 306 /** Returns size of output for given usage path307 *308 * @param parser Opaque report parser structure309 * @param path Usage path specified which items will be thought for the output310 * @param flags Flags of usage path structure comparison311 * @return Number of items matching the given usage path312 */313 size_t usb_hid_report_output_size(usb_hid_report_t *report,314 usb_hid_report_path_t *path, int flags)315 {316 size_t ret = 0;317 usb_hid_report_description_t *report_des;318 319 if(report == NULL) {320 return 0;321 }322 323 report_des = usb_hid_report_find_description (report, path->report_id, USB_HID_REPORT_TYPE_OUTPUT);324 if(report_des == NULL){325 return 0;326 }327 328 link_t *field_it = report_des->report_items.next;329 usb_hid_report_field_t *field;330 while(field_it != &report_des->report_items) {331 332 field = list_get_instance(field_it, usb_hid_report_field_t, link);333 if(USB_HID_ITEM_FLAG_CONSTANT(field->item_flags) == 0){334 usb_hid_report_path_append_item (field->collection_path, field->usage_page, field->usage);335 if(usb_hid_report_compare_usage_path (field->collection_path, path, flags) == EOK) {336 ret++;337 }338 usb_hid_report_remove_last_item (field->collection_path);339 }340 341 field_it = field_it->next;342 }343 344 return ret;345 346 284 } 347 285
Note:
See TracChangeset
for help on using the changeset viewer.