Changeset b7fd2a0 in mainline for uspace/lib/usbhid
- Timestamp:
- 2018-01-13T03:10:29Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a53ed3a
- Parents:
- 36f0738
- Location:
- uspace/lib/usbhid
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhid/include/usb/hid/hiddescriptor.h
r36f0738 rb7fd2a0 43 43 #include <usb/hid/hidtypes.h> 44 44 45 int usb_hid_parse_report_descriptor(usb_hid_report_t *report,45 errno_t usb_hid_parse_report_descriptor(usb_hid_report_t *report, 46 46 const uint8_t *data, size_t size); 47 47 48 48 void usb_hid_descriptor_print(usb_hid_report_t *report); 49 49 50 int usb_hid_report_init(usb_hid_report_t *report);50 errno_t usb_hid_report_init(usb_hid_report_t *report); 51 51 52 52 void usb_hid_report_deinit(usb_hid_report_t *report); 53 53 54 int usb_hid_report_append_fields(usb_hid_report_t *report,54 errno_t usb_hid_report_append_fields(usb_hid_report_t *report, 55 55 usb_hid_report_item_t *report_item); 56 56 -
uspace/lib/usbhid/include/usb/hid/hidparser.h
r36f0738 rb7fd2a0 47 47 * Input report parser functions 48 48 */ 49 int usb_hid_parse_report(const usb_hid_report_t *report, const uint8_t *data,49 errno_t usb_hid_parse_report(const usb_hid_report_t *report, const uint8_t *data, 50 50 size_t size, uint8_t *report_id); 51 51 … … 65 65 66 66 67 int usb_hid_report_output_translate(usb_hid_report_t *report,67 errno_t usb_hid_report_output_translate(usb_hid_report_t *report, 68 68 uint8_t report_id, uint8_t *buffer, size_t size); 69 69 -
uspace/lib/usbhid/include/usb/hid/hidpath.h
r36f0738 rb7fd2a0 118 118 void usb_hid_report_path_free(usb_hid_report_path_t *path); 119 119 120 int usb_hid_report_path_set_report_id(usb_hid_report_path_t *usage_path,120 errno_t usb_hid_report_path_set_report_id(usb_hid_report_path_t *usage_path, 121 121 uint8_t report_id); 122 122 123 int usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path,123 errno_t usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path, 124 124 int32_t usage_page, int32_t usage); 125 125 -
uspace/lib/usbhid/include/usb/hid/hidreport.h
r36f0738 rb7fd2a0 58 58 * usb_pipe_end_session() or usb_request_get_descriptor(). 59 59 */ 60 int usb_hid_process_report_descriptor(usb_device_t *dev,60 errno_t usb_hid_process_report_descriptor(usb_device_t *dev, 61 61 usb_hid_report_t *report, uint8_t **report_desc, size_t *report_size); 62 62 -
uspace/lib/usbhid/include/usb/hid/request.h
r36f0738 rb7fd2a0 44 44 45 45 46 int usbhid_req_set_report(usb_pipe_t *ctrl_pipe, int iface_no,46 errno_t usbhid_req_set_report(usb_pipe_t *ctrl_pipe, int iface_no, 47 47 usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size); 48 48 49 int usbhid_req_set_protocol(usb_pipe_t *ctrl_pipe, int iface_no,49 errno_t usbhid_req_set_protocol(usb_pipe_t *ctrl_pipe, int iface_no, 50 50 usb_hid_protocol_t protocol); 51 51 52 int usbhid_req_set_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration);52 errno_t usbhid_req_set_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration); 53 53 54 int usbhid_req_get_report(usb_pipe_t *ctrl_pipe, int iface_no,54 errno_t usbhid_req_get_report(usb_pipe_t *ctrl_pipe, int iface_no, 55 55 usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size, 56 56 size_t *actual_size); 57 57 58 int usbhid_req_get_protocol(usb_pipe_t *ctrl_pipe, int iface_no,58 errno_t usbhid_req_get_protocol(usb_pipe_t *ctrl_pipe, int iface_no, 59 59 usb_hid_protocol_t *protocol); 60 60 61 int usbhid_req_get_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t *duration);61 errno_t usbhid_req_get_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t *duration); 62 62 63 63 -
uspace/lib/usbhid/src/hiddescriptor.c
r36f0738 rb7fd2a0 134 134 * @retval EOK If report structure was successfully initialized 135 135 */ 136 int usb_hid_report_init(usb_hid_report_t *report)136 errno_t usb_hid_report_init(usb_hid_report_t *report) 137 137 { 138 138 if (report == NULL) { … … 162 162 * 163 163 */ 164 int usb_hid_report_append_fields(usb_hid_report_t *report,164 errno_t usb_hid_report_append_fields(usb_hid_report_t *report, 165 165 usb_hid_report_item_t *report_item) { 166 166 … … 356 356 * @retval EOK If report descriptor is successfully parsed 357 357 */ 358 int usb_hid_parse_report_descriptor(usb_hid_report_t *report,358 errno_t usb_hid_parse_report_descriptor(usb_hid_report_t *report, 359 359 const uint8_t *data, size_t size) 360 360 { -
uspace/lib/usbhid/src/hidparser.c
r36f0738 rb7fd2a0 127 127 * @return Error code. 128 128 */ 129 int usb_hid_parse_report(const usb_hid_report_t *report, const uint8_t *data,129 errno_t usb_hid_parse_report(const usb_hid_report_t *report, const uint8_t *data, 130 130 size_t size, uint8_t *report_id) 131 131 { … … 334 334 * @return Error code 335 335 */ 336 int usb_hid_report_output_translate(usb_hid_report_t *report,336 errno_t usb_hid_report_output_translate(usb_hid_report_t *report, 337 337 uint8_t report_id, uint8_t *buffer, size_t size) 338 338 { -
uspace/lib/usbhid/src/hidpath.c
r36f0738 rb7fd2a0 73 73 * @return Error code 74 74 */ 75 int usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path,75 errno_t usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path, 76 76 int32_t usage_page, int32_t usage) 77 77 { … … 423 423 * @return Error code 424 424 */ 425 int usb_hid_report_path_set_report_id(usb_hid_report_path_t *path,425 errno_t usb_hid_report_path_set_report_id(usb_hid_report_path_t *path, 426 426 uint8_t report_id) 427 427 { -
uspace/lib/usbhid/src/hidreport.c
r36f0738 rb7fd2a0 50 50 #include <usb/hid/hidreport.h> 51 51 52 static int usb_hid_get_report_descriptor(usb_device_t *dev,52 static errno_t usb_hid_get_report_descriptor(usb_device_t *dev, 53 53 uint8_t **report_desc, size_t *size) 54 54 { … … 135 135 * Get the descriptor from the device. 136 136 */ 137 int rc = usb_request_get_descriptor(usb_device_get_default_pipe(dev),137 errno_t rc = usb_request_get_descriptor(usb_device_get_default_pipe(dev), 138 138 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_INTERFACE, 139 139 USB_DESCTYPE_HID_REPORT, 0, usb_device_get_iface_number(dev), … … 163 163 164 164 165 int usb_hid_process_report_descriptor(usb_device_t *dev,165 errno_t usb_hid_process_report_descriptor(usb_device_t *dev, 166 166 usb_hid_report_t *report, uint8_t **report_desc, size_t *report_size) 167 167 { … … 175 175 // size_t report_size; 176 176 177 int rc = usb_hid_get_report_descriptor(dev, report_desc, report_size);177 errno_t rc = usb_hid_get_report_descriptor(dev, report_desc, report_size); 178 178 179 179 if (rc != EOK) { -
uspace/lib/usbhid/src/hidreq.c
r36f0738 rb7fd2a0 58 58 * @return Other value inherited from function usb_control_request_set(). 59 59 */ 60 int usbhid_req_set_report(usb_pipe_t *ctrl_pipe, int iface_no,60 errno_t usbhid_req_set_report(usb_pipe_t *ctrl_pipe, int iface_no, 61 61 usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size) 62 62 { … … 77 77 */ 78 78 79 int rc;79 errno_t rc; 80 80 81 81 uint16_t value = 0; … … 108 108 * @return Other value inherited from function usb_control_request_set(). 109 109 */ 110 int usbhid_req_set_protocol(usb_pipe_t *ctrl_pipe, int iface_no,110 errno_t usbhid_req_set_protocol(usb_pipe_t *ctrl_pipe, int iface_no, 111 111 usb_hid_protocol_t protocol) 112 112 { … … 127 127 */ 128 128 129 int rc;129 errno_t rc; 130 130 131 131 usb_log_debug("Sending Set Protocol request to the device (" … … 157 157 * @return Other value inherited from function usb_control_request_set(). 158 158 */ 159 int usbhid_req_set_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration)160 { 161 if (ctrl_pipe == NULL) { 162 usb_log_warning("usbhid_req_set_report(): no pipe given.\n"); 163 return EINVAL; 164 } 165 166 if (iface_no < 0) { 167 usb_log_warning("usbhid_req_set_report(): no interface given." 168 "\n"); 169 return EINVAL; 170 } 171 172 /* 173 * No need for checking other parameters, as they are checked in 174 * the called function (usb_control_request_set()). 175 */ 176 177 int rc;159 errno_t usbhid_req_set_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration) 160 { 161 if (ctrl_pipe == NULL) { 162 usb_log_warning("usbhid_req_set_report(): no pipe given.\n"); 163 return EINVAL; 164 } 165 166 if (iface_no < 0) { 167 usb_log_warning("usbhid_req_set_report(): no interface given." 168 "\n"); 169 return EINVAL; 170 } 171 172 /* 173 * No need for checking other parameters, as they are checked in 174 * the called function (usb_control_request_set()). 175 */ 176 177 errno_t rc; 178 178 179 179 usb_log_debug("Sending Set Idle request to the device (" … … 210 210 * @return Other value inherited from function usb_control_request_set(). 211 211 */ 212 int usbhid_req_get_report(usb_pipe_t *ctrl_pipe, int iface_no,212 errno_t usbhid_req_get_report(usb_pipe_t *ctrl_pipe, int iface_no, 213 213 usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size, 214 214 size_t *actual_size) … … 230 230 */ 231 231 232 int rc;232 errno_t rc; 233 233 234 234 uint16_t value = 0; … … 262 262 * @return Other value inherited from function usb_control_request_set(). 263 263 */ 264 int usbhid_req_get_protocol(usb_pipe_t *ctrl_pipe, int iface_no,264 errno_t usbhid_req_get_protocol(usb_pipe_t *ctrl_pipe, int iface_no, 265 265 usb_hid_protocol_t *protocol) 266 266 { … … 281 281 */ 282 282 283 int rc;283 errno_t rc; 284 284 285 285 usb_log_debug("Sending Get Protocol request to the device (" … … 324 324 * usb_control_request_set(). 325 325 */ 326 int usbhid_req_get_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t *duration)327 { 328 if (ctrl_pipe == NULL) { 329 usb_log_warning("usbhid_req_set_report(): no pipe given.\n"); 330 return EINVAL; 331 } 332 333 if (iface_no < 0) { 334 usb_log_warning("usbhid_req_set_report(): no interface given." 335 "\n"); 336 return EINVAL; 337 } 338 339 /* 340 * No need for checking other parameters, as they are checked in 341 * the called function (usb_control_request_set()). 342 */ 343 344 int rc;326 errno_t usbhid_req_get_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t *duration) 327 { 328 if (ctrl_pipe == NULL) { 329 usb_log_warning("usbhid_req_set_report(): no pipe given.\n"); 330 return EINVAL; 331 } 332 333 if (iface_no < 0) { 334 usb_log_warning("usbhid_req_set_report(): no interface given." 335 "\n"); 336 return EINVAL; 337 } 338 339 /* 340 * No need for checking other parameters, as they are checked in 341 * the called function (usb_control_request_set()). 342 */ 343 344 errno_t rc; 345 345 346 346 usb_log_debug("Sending Get Idle request to the device ("
Note:
See TracChangeset
for help on using the changeset viewer.