Changes in uspace/lib/usbdev/src/devpoll.c [a0487a2:9dbfd288] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/devpoll.c
ra0487a2 r9dbfd288 46 46 /** Data needed for polling. */ 47 47 typedef struct { 48 /** Parameters for automated polling. */49 48 usb_device_auto_polling_t auto_polling; 50 49 51 /** USB device to poll. */52 50 usb_device_t *dev; 53 /** Device pipe to use for polling. */54 51 size_t pipe_index; 55 /** Size of the recieved data. */56 52 size_t request_size; 57 /** Data buffer. */58 53 uint8_t *buffer; 54 void *custom_arg; 59 55 } polling_data_t; 60 56 … … 123 119 ++failed_attempts; 124 120 const bool cont = (params->on_error == NULL) ? true : 125 params->on_error(data->dev, rc, params->arg);121 params->on_error(data->dev, rc, data->custom_arg); 126 122 if (!cont) { 127 123 failed_attempts = params->max_failures; … … 133 129 assert(params->on_data); 134 130 const bool carry_on = params->on_data( 135 data->dev, data->buffer, actual_size, params->arg);131 data->dev, data->buffer, actual_size, data->custom_arg); 136 132 137 133 if (!carry_on) { … … 153 149 154 150 if (params->on_polling_end != NULL) { 155 params->on_polling_end(data->dev, failed, params->arg);151 params->on_polling_end(data->dev, failed, data->custom_arg); 156 152 } 157 153 … … 203 199 .on_polling_end = terminated_callback, 204 200 .on_error = NULL, 205 .arg = arg,206 201 }; 207 202 208 203 return usb_device_auto_polling(dev, pipe_index, &auto_polling, 209 request_size );204 request_size, arg); 210 205 } 211 206 … … 229 224 int usb_device_auto_polling(usb_device_t *dev, size_t pipe_index, 230 225 const usb_device_auto_polling_t *polling, 231 size_t request_size )226 size_t request_size, void *arg) 232 227 { 233 228 if ((dev == NULL) || (polling == NULL) || (polling->on_data == NULL)) { … … 257 252 polling_data->dev = dev; 258 253 polling_data->pipe_index = pipe_index; 254 polling_data->custom_arg = arg; 259 255 260 256 /* Copy provided settings. */
Note:
See TracChangeset
for help on using the changeset viewer.