Changeset 1eee99f2 in mainline


Ignore:
Timestamp:
2011-05-25T18:48:47Z (13 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1d10ca1
Parents:
14e7959
Message:

usb hid report size in bytes available in report structure

Location:
uspace/lib/usbhid
Files:
2 edited

Legend:

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

    r14e7959 r1eee99f2  
    6565                           usb_hid_report_type_t type);
    6666
     67size_t usb_hid_report_byte_size(usb_hid_report_t *report, uint8_t report_id,
     68                           usb_hid_report_type_t type);
     69
     70
    6771/** Makes the output report buffer by translated given data */
    6872int usb_hid_report_output_translate(usb_hid_report_t *report, uint8_t report_id,
    6973                                    uint8_t *buffer, size_t size);
     74
    7075
    7176/** */
  • uspace/lib/usbhid/src/hidparser.c

    r14e7959 r1eee99f2  
    9595        else {
    9696                return report_des->item_length;
     97        }
     98}
     99
     100/** Returns size of report of specified report id and type in bytes
     101 *
     102 * @param parser Opaque report parser structure
     103 * @param report_id
     104 * @param type
     105 * @return Number of items in specified report
     106 */
     107size_t usb_hid_report_byte_size(usb_hid_report_t *report, uint8_t report_id,
     108                           usb_hid_report_type_t type)
     109{
     110        usb_hid_report_description_t *report_des;
     111
     112        if(report == NULL) {
     113                return 0;
     114        }
     115
     116        report_des = usb_hid_report_find_description (report, report_id, type);
     117        if(report_des == NULL){
     118                return 0;
     119        }
     120        else {
     121                return (report_des->bit_length + 7) / 8;
    97122        }
    98123}
Note: See TracChangeset for help on using the changeset viewer.