Changes in uspace/lib/usbhost/src/usb_transfer_batch.c [549ff23:2582d8f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/usb_transfer_batch.c
r549ff23 r2582d8f 33 33 */ 34 34 #include <errno.h> 35 #include < str_error.h>35 #include <macros.h> 36 36 37 37 #include <usb/usb.h> … … 121 121 * @param[in] data Data to copy to the output buffer. 122 122 * @param[in] size Size of @p data. 123 * @param[in] error Error value to use. 123 124 */ 124 void usb_transfer_batch_finish (125 const usb_transfer_batch_t *instance, const void *data, size_t size)125 void usb_transfer_batch_finish_error(const usb_transfer_batch_t *instance, 126 const void *data, size_t size, int error) 126 127 { 127 128 assert(instance); … … 133 134 /* Check for commands that reset toggle bit */ 134 135 if (instance->ep->transfer_type == USB_TRANSFER_CONTROL 135 && instance->error == EOK) {136 && error == EOK) { 136 137 const usb_target_t target = 137 138 {{ instance->ep->address, instance->ep->endpoint }}; … … 139 140 instance->setup_buffer); 140 141 } 141 instance->callback_out(instance->fun, 142 instance->error, instance->arg); 142 instance->callback_out(instance->fun, error, instance->arg); 143 143 } 144 144 145 145 if (instance->callback_in) { 146 146 /* We care about the data and there are some to copy */ 147 const size_t safe_size = min(size, instance->buffer_size); 147 148 if (data) { 148 const size_t min_size = size < instance->buffer_size 149 ? size : instance->buffer_size; 150 memcpy(instance->buffer, data, min_size); 149 memcpy(instance->buffer, data, safe_size); 151 150 } 152 instance->callback_in(instance->fun, instance->error,153 instance->transfered_size, instance->arg);151 instance->callback_in(instance->fun, error, 152 safe_size, instance->arg); 154 153 } 155 154 }
Note:
See TracChangeset
for help on using the changeset viewer.