Changeset 0bd4810c in mainline


Ignore:
Timestamp:
2011-03-11T16:24:52Z (13 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
33382a9
Parents:
9d9ffdd
Message:

Buffer length of parsed input report

Location:
uspace/lib/usb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/classes/hidparser.h

    r9d9ffdd r0bd4810c  
    6464
    6565/**
     66 * Description of path of usage pages and usages in report descriptor
     67 */
     68typedef struct {
     69        int32_t usage_page;
     70} usb_hid_report_path_t;
     71
     72/**
    6673 * Description of report items
    6774 */
     
    185192    const usb_hid_report_in_callbacks_t *callbacks, void *arg);
    186193
     194int usb_hid_report_input_length(const usb_hid_report_parser_t *parser,
     195        const usb_hid_report_path_t *path);
     196
    187197
    188198void usb_hid_free_report_parser(usb_hid_report_parser_t *parser);
  • uspace/lib/usb/src/hidparser.c

    r9d9ffdd r0bd4810c  
    719719       
    720720}
     721
     722int usb_hid_report_input_length(const usb_hid_report_parser_t *parser,
     723        const usb_hid_report_path_t *path)
     724{
     725        int ret = 0;
     726        link_t *item;
     727        usb_hid_report_item_t *report_item;
     728
     729        item = (&parser->input)->next;
     730        while(&parser->input != item) {
     731                report_item = list_get_instance(item, usb_hid_report_item_t, link);
     732                if(report_item->usage_page == path->usage_page) {
     733                        ret += report_item->count;
     734                }
     735
     736                item = item->next;
     737        }
     738
     739        return ret;
     740}
     741
     742
     743
    721744/**
    722745 * @}
Note: See TracChangeset for help on using the changeset viewer.