Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset bd2394b in mainline


Ignore:
Timestamp:
2011-05-07T10:53:41Z (11 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master
Children:
cc5908e
Parents:
ba17f5b
Message:

Removed functions for returning size of report for usage path

Location:
uspace
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhid/kbd/kbddev.c

    rba17f5b rbd2394b  
    693693       
    694694        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);
    697697               
    698698                assert(i < kbd_dev->key_count);
     
    858858        usb_hid_report_path_set_report_id(path, 0);
    859859       
    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);
    863862        usb_hid_report_path_free(path);
    864863       
     
    901900            kbd_dev->led_path, USB_HIDUT_PAGE_LED, 0);
    902901       
    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);
    906904       
    907905        usb_log_debug("Output report size (in items): %zu\n",
  • uspace/drv/usbhid/lgtch-ultrax/lgtch-ultrax.c

    rba17f5b rbd2394b  
    300300        usb_hid_report_path_set_report_id(path, 1);
    301301       
    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       
    305305        usb_hid_report_path_free(path);
    306306       
  • uspace/drv/usbhid/usbhid.c

    rba17f5b rbd2394b  
    201201       
    202202        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);
    205205        usb_log_debug("Size of the input report: %zuB\n", size);
    206206       
  • uspace/drv/usbkbd/kbddev.c

    rba17f5b rbd2394b  
    771771        usb_hid_report_path_set_report_id(path, 0);
    772772       
    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);
    775775        usb_hid_report_path_free (path);
    776776       
     
    803803        usb_hid_report_path_set_report_id(kbd_dev->led_path, 0x00);
    804804       
    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);
    808807       
    809808        usb_log_debug("Output report size (in items): %zu\n",
  • uspace/lib/usb/include/usb/classes/hidparser.h

    rba17f5b rbd2394b  
    5151                         size_t size, uint8_t *report_id);
    5252
    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 
    5753/*
    5854 * Output report parser functions
     
    6561void usb_hid_report_output_free(uint8_t *output);
    6662
    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 */
     64size_t usb_hid_report_size(usb_hid_report_t *report, uint8_t report_id,
     65                           usb_hid_report_type_t type);
    7066
    7167/** Makes the output report buffer by translated given data */
  • uspace/lib/usb/src/hiddescriptor.c

    rba17f5b rbd2394b  
    566566                        break;
    567567                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                       
    568572                        if (item_size == 3) {
    569573                                // usage extended usages
  • uspace/lib/usb/src/hidparser.c

    rba17f5b rbd2394b  
    6969
    7070
     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 */
     78size_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}
    7195
    7296
     
    206230}
    207231
    208 /**
    209  * Returns number of items in input report which are accessible by given usage path
    210  *
    211  * @param parser Opaque report descriptor structure
    212  * @param path Usage path specification
    213  * @param flags Usage path comparison flags
    214  * @return Number of items in input report
    215  */
    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 
    252232/*** OUTPUT API **/
    253233
     
    302282                free (output);
    303283        }
    304 }
    305 
    306 /** Returns size of output for given usage path
    307  *
    308  * @param parser Opaque report parser structure
    309  * @param path Usage path specified which items will be thought for the output
    310  * @param flags Flags of usage path structure comparison
    311  * @return Number of items matching the given usage path
    312  */
    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        
    346284}
    347285
Note: See TracChangeset for help on using the changeset viewer.