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

Changeset 5b9d2a35 in mainline


Ignore:
Timestamp:
2012-02-24T16:17:42Z (8 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
master
Children:
608db4e
Parents:
48f0f73a
Message:

libusbhid: Mind endian when accessing multi-byte descriptor values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhid/src/hidreport.c

    r48f0f73a r5b9d2a35  
    5050#include <usb/hid/hidreport.h>
    5151
    52 static int usb_hid_get_report_descriptor(usb_device_t *dev, 
     52static int usb_hid_get_report_descriptor(usb_device_t *dev,
    5353    uint8_t **report_desc, size_t *size)
    5454{
     
    6969         * First nested descriptor of the configuration descriptor.
    7070         */
    71         const uint8_t *d = 
    72             usb_dp_get_nested_descriptor(&parser, &parser_data, 
     71        const uint8_t *d =
     72            usb_dp_get_nested_descriptor(&parser, &parser_data,
    7373            dev->descriptors.configuration);
    7474       
     
    7878        int i = 0;
    7979        while (d != NULL && i < dev->interface_no) {
    80                 d = usb_dp_get_sibling_descriptor(&parser, &parser_data, 
     80                d = usb_dp_get_sibling_descriptor(&parser, &parser_data,
    8181                    dev->descriptors.configuration, d);
    8282                ++i;
     
    9999         */
    100100        while (d != NULL && *(d + 1) != USB_DESCTYPE_HID) {
    101                 d = usb_dp_get_sibling_descriptor(&parser, &parser_data, 
     101                d = usb_dp_get_sibling_descriptor(&parser, &parser_data,
    102102                    iface_desc, d);
    103103        }
     
    114114        }
    115115       
    116         usb_standard_hid_descriptor_t *hid_desc = 
     116        usb_standard_hid_descriptor_t *hid_desc =
    117117            (usb_standard_hid_descriptor_t *)d;
    118118       
    119         uint16_t length =  hid_desc->report_desc_info.length;
     119        uint16_t length = uint16_usb2host(hid_desc->report_desc_info.length);
    120120        size_t actual_size = 0;
    121121
Note: See TracChangeset for help on using the changeset viewer.