Changeset b81410f in mainline
- Timestamp:
- 2011-11-26T14:34:20Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d085fbbe
- Parents:
- 2703331b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/devpoll.c
r2703331b rb81410f 70 70 71 71 if (polling_data->auto_polling.debug > 0) { 72 usb_endpoint_mapping_t *mapping72 const usb_endpoint_mapping_t *mapping 73 73 = &polling_data->dev->pipes[polling_data->pipe_index]; 74 74 usb_log_debug("Poll%p: started polling of `%s' - " \ … … 85 85 size_t failed_attempts = 0; 86 86 while (failed_attempts <= polling_data->auto_polling.max_failures) { 87 int rc;88 89 87 size_t actual_size; 90 rc = usb_pipe_read(pipe, polling_data->buffer,88 const int rc = usb_pipe_read(pipe, polling_data->buffer, 91 89 polling_data->request_size, &actual_size); 92 90 … … 113 111 */ 114 112 usb_request_clear_endpoint_halt( 115 &polling_data->dev->ctrl_pipe, 116 pipe->endpoint_no); 113 &polling_data->dev->ctrl_pipe, pipe->endpoint_no); 117 114 } 118 115 … … 196 193 usb_polling_terminted_callback_t terminated_callback, void *arg) 197 194 { 198 if ((dev == NULL) || (callback == NULL)) {199 return EBADMEM;200 }201 if (request_size == 0) {202 return EINVAL;203 }204 if ((dev->pipes[pipe_index].pipe.transfer_type != USB_TRANSFER_INTERRUPT)205 || (dev->pipes[pipe_index].pipe.direction != USB_DIRECTION_IN)) {206 return EINVAL;207 }208 209 195 const usb_device_auto_polling_t auto_polling = { 210 196 .debug = 1, … … 242 228 size_t request_size, void *arg) 243 229 { 244 if ( dev == NULL) {230 if ((dev == NULL) || (polling == NULL) || (polling->on_data == NULL)) { 245 231 return EBADMEM; 246 232 } 247 if (pipe_index >= dev->pipes_count) { 233 234 if (pipe_index >= dev->pipes_count || request_size == 0) { 248 235 return EINVAL; 249 236 } … … 251 238 || (dev->pipes[pipe_index].pipe.direction != USB_DIRECTION_IN)) { 252 239 return EINVAL; 253 }254 if ((polling == NULL) || (polling->on_data == NULL)) {255 return EBADMEM;256 240 } 257 241
Note:
See TracChangeset
for help on using the changeset viewer.