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