@@ -159,7 +159,7 @@ static size_t _xfer(tuh_xfer_t *xfer, mp_int_t timeout) {
159159 _xfer_result = 0xff ;
160160 xfer -> complete_cb = _transfer_done_cb ;
161161 if (!tuh_edpt_xfer (xfer )) {
162- mp_raise_usb_core_USBError (NULL );
162+ mp_raise_usb_core_USBError (MP_ERROR_TEXT ( "Xfer" ) );
163163 }
164164 uint32_t start_time = supervisor_ticks_ms32 ();
165165 while ((timeout == 0 || supervisor_ticks_ms32 () - start_time < (uint32_t )timeout ) &&
@@ -176,7 +176,7 @@ static size_t _xfer(tuh_xfer_t *xfer, mp_int_t timeout) {
176176 xfer_result_t result = _xfer_result ;
177177 _xfer_result = 0xff ;
178178 if (result == XFER_RESULT_STALLED ) {
179- mp_raise_usb_core_USBError (MP_ERROR_TEXT ("Pipe error " ));
179+ mp_raise_usb_core_USBError (MP_ERROR_TEXT ("Stall " ));
180180 }
181181 if (result == 0xff ) {
182182 tuh_edpt_abort_xfer (xfer -> daddr , xfer -> ep_addr );
@@ -205,7 +205,7 @@ static bool _open_endpoint(usb_core_device_obj_t *self, mp_int_t endpoint) {
205205 }
206206
207207 if (self -> configuration_descriptor == NULL ) {
208- mp_raise_usb_core_USBError (MP_ERROR_TEXT ("No configuration set " ));
208+ mp_raise_usb_core_USBError (MP_ERROR_TEXT ("NoCfg " ));
209209 }
210210
211211 tusb_desc_configuration_t * desc_cfg = (tusb_desc_configuration_t * )self -> configuration_descriptor ;
@@ -239,7 +239,8 @@ static bool _open_endpoint(usb_core_device_obj_t *self, mp_int_t endpoint) {
239239
240240mp_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 ) {
241241 if (!_open_endpoint (self , endpoint )) {
242- mp_raise_usb_core_USBError (NULL );
242+ mp_raise_usb_core_USBError (MP_ERROR_TEXT ("Endpt" ));
243+ return 0 ;
243244 }
244245 tuh_xfer_t xfer ;
245246 xfer .daddr = self -> device_number ;
@@ -251,7 +252,8 @@ mp_int_t common_hal_usb_core_device_write(usb_core_device_obj_t *self, mp_int_t
251252
252253mp_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 ) {
253254 if (!_open_endpoint (self , endpoint )) {
254- mp_raise_usb_core_USBError (NULL );
255+ mp_raise_usb_core_USBError (MP_ERROR_TEXT ("Endpt" ));
256+ return 0 ;
255257 }
256258 tuh_xfer_t xfer ;
257259 xfer .daddr = self -> device_number ;
@@ -285,7 +287,7 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self,
285287 _xfer_result = 0xff ;
286288
287289 if (!tuh_control_xfer (& xfer )) {
288- mp_raise_usb_core_USBError (NULL );
290+ mp_raise_usb_core_USBError (MP_ERROR_TEXT ( "Xfer" ) );
289291 }
290292 uint32_t start_time = supervisor_ticks_ms32 ();
291293 while ((timeout == 0 || supervisor_ticks_ms32 () - start_time < (uint32_t )timeout ) &&
@@ -302,7 +304,7 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self,
302304 xfer_result_t result = _xfer_result ;
303305 _xfer_result = 0xff ;
304306 if (result == XFER_RESULT_STALLED ) {
305- mp_raise_usb_core_USBError (MP_ERROR_TEXT ("Pipe error " ));
307+ mp_raise_usb_core_USBError (MP_ERROR_TEXT ("Stall " ));
306308 }
307309 if (result == 0xff ) {
308310 tuh_edpt_abort_xfer (xfer .daddr , xfer .ep_addr );
0 commit comments