@@ -160,6 +160,7 @@ static size_t _xfer(tuh_xfer_t *xfer, mp_int_t timeout) {
160
160
xfer -> complete_cb = _transfer_done_cb ;
161
161
if (!tuh_edpt_xfer (xfer )) {
162
162
mp_raise_usb_core_USBError (NULL );
163
+ return 0 ;
163
164
}
164
165
uint32_t start_time = supervisor_ticks_ms32 ();
165
166
while ((timeout == 0 || supervisor_ticks_ms32 () - start_time < (uint32_t )timeout ) &&
@@ -206,6 +207,7 @@ static bool _open_endpoint(usb_core_device_obj_t *self, mp_int_t endpoint) {
206
207
207
208
if (self -> configuration_descriptor == NULL ) {
208
209
mp_raise_usb_core_USBError (MP_ERROR_TEXT ("No configuration set" ));
210
+ return false;
209
211
}
210
212
211
213
tusb_desc_configuration_t * desc_cfg = (tusb_desc_configuration_t * )self -> configuration_descriptor ;
@@ -240,6 +242,7 @@ static bool _open_endpoint(usb_core_device_obj_t *self, mp_int_t endpoint) {
240
242
mp_int_t common_hal_usb_core_device_write (usb_core_device_obj_t * self , mp_int_t endpoint , const uint8_t * buffer , mp_int_t len , mp_int_t timeout ) {
241
243
if (!_open_endpoint (self , endpoint )) {
242
244
mp_raise_usb_core_USBError (NULL );
245
+ return 0 ;
243
246
}
244
247
tuh_xfer_t xfer ;
245
248
xfer .daddr = self -> device_number ;
@@ -252,6 +255,7 @@ mp_int_t common_hal_usb_core_device_write(usb_core_device_obj_t *self, mp_int_t
252
255
mp_int_t common_hal_usb_core_device_read (usb_core_device_obj_t * self , mp_int_t endpoint , uint8_t * buffer , mp_int_t len , mp_int_t timeout ) {
253
256
if (!_open_endpoint (self , endpoint )) {
254
257
mp_raise_usb_core_USBError (NULL );
258
+ return 0 ;
255
259
}
256
260
tuh_xfer_t xfer ;
257
261
xfer .daddr = self -> device_number ;
@@ -286,6 +290,7 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self,
286
290
287
291
if (!tuh_control_xfer (& xfer )) {
288
292
mp_raise_usb_core_USBError (NULL );
293
+ return 0 ;
289
294
}
290
295
uint32_t start_time = supervisor_ticks_ms32 ();
291
296
while ((timeout == 0 || supervisor_ticks_ms32 () - start_time < (uint32_t )timeout ) &&
0 commit comments