Changes in uspace/lib/usbhid/src/hidreport.c [ae3a941:a35b458] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhid/src/hidreport.c
rae3a941 ra35b458 55 55 assert(report_desc != NULL); 56 56 assert(size != NULL); 57 57 58 58 usb_dp_parser_t parser = { 59 59 .nesting = usb_dp_standard_descriptor_nesting 60 60 }; 61 61 62 62 usb_dp_parser_data_t parser_data = { 63 63 .data = usb_device_descriptors(dev)->full_config, … … 65 65 .arg = NULL 66 66 }; 67 67 68 68 /* 69 69 * First nested descriptor of the configuration descriptor. … … 72 72 usb_dp_get_nested_descriptor(&parser, &parser_data, 73 73 usb_device_descriptors(dev)->full_config); 74 74 75 75 /* 76 76 * Find the interface descriptor corresponding to our interface number. … … 82 82 ++i; 83 83 } 84 84 85 85 if (d == NULL) { 86 86 usb_log_error("The %d. interface descriptor not found!", … … 88 88 return ENOENT; 89 89 } 90 90 91 91 /* 92 92 * First nested descriptor of the interface descriptor. … … 94 94 const uint8_t *iface_desc = d; 95 95 d = usb_dp_get_nested_descriptor(&parser, &parser_data, iface_desc); 96 96 97 97 /* 98 98 * Search through siblings until the HID descriptor is found. … … 102 102 iface_desc, d); 103 103 } 104 104 105 105 if (d == NULL) { 106 106 usb_log_fatal("No HID descriptor found!"); 107 107 return ENOENT; 108 108 } 109 109 110 110 if (*d != sizeof(usb_standard_hid_descriptor_t)) { 111 111 usb_log_error("HID descriptor has wrong size (%u, expected %zu" … … 113 113 return EINVAL; 114 114 } 115 115 116 116 usb_standard_hid_descriptor_t *hid_desc = 117 117 (usb_standard_hid_descriptor_t *)d; 118 118 119 119 uint16_t length = uint16_usb2host(hid_desc->report_desc_info.length); 120 120 size_t actual_size = 0; … … 129 129 return ENOMEM; 130 130 } 131 131 132 132 usb_log_debug("Getting Report descriptor, expected size: %u", length); 133 133 134 134 /* 135 135 * Get the descriptor from the device. … … 153 153 return EINVAL; 154 154 } 155 155 156 156 *size = length; 157 157 158 158 usb_log_debug("Done."); 159 159 160 160 return EOK; 161 161 } … … 171 171 return EINVAL; 172 172 } 173 173 174 174 // uint8_t *report_desc = NULL; 175 175 // size_t report_size; 176 176 177 177 errno_t rc = usb_hid_get_report_descriptor(dev, report_desc, report_size); 178 178 179 179 if (rc != EOK) { 180 180 usb_log_error("Problem with getting Report descriptor: %s.", … … 186 186 return rc; 187 187 } 188 188 189 189 assert(*report_desc != NULL); 190 190 191 191 rc = usb_hid_parse_report_descriptor(report, *report_desc, *report_size); 192 192 if (rc != EOK) { … … 197 197 return rc; 198 198 } 199 199 200 200 usb_hid_descriptor_print(report); 201 201 202 202 return EOK; 203 203 }
Note:
See TracChangeset
for help on using the changeset viewer.