Skip to content

Commit 08bc84b

Browse files
committed
revert usb.core.Device error message changes
This puts the error messages back like they were, leaving the null pointer dereference fixes in place.
1 parent 280bbbe commit 08bc84b

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

locale/circuitpython.pot

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -915,10 +915,6 @@ msgstr ""
915915
msgid "ESP-IDF memory allocation failed"
916916
msgstr ""
917917

918-
#: shared-module/usb/core/Device.c
919-
msgid "Endpt"
920-
msgstr ""
921-
922918
#: extmod/modre.c
923919
msgid "Error in regex"
924920
msgstr ""
@@ -1449,6 +1445,10 @@ msgstr ""
14491445
msgid "No bootloader present"
14501446
msgstr ""
14511447

1448+
#: shared-module/usb/core/Device.c
1449+
msgid "No configuration set"
1450+
msgstr ""
1451+
14521452
#: shared-bindings/_bleio/PacketBuffer.c
14531453
msgid "No connection: length cannot be determined"
14541454
msgstr ""
@@ -1518,10 +1518,6 @@ msgstr ""
15181518
msgid "No usb host port initialized"
15191519
msgstr ""
15201520

1521-
#: shared-module/usb/core/Device.c
1522-
msgid "NoCfg"
1523-
msgstr ""
1524-
15251521
#: ports/nordic/common-hal/_bleio/__init__.c
15261522
msgid "Nordic system firmware out of memory"
15271523
msgstr ""
@@ -1730,6 +1726,10 @@ msgstr ""
17301726
msgid "Pins must share PWM slice"
17311727
msgstr ""
17321728

1729+
#: shared-module/usb/core/Device.c
1730+
msgid "Pipe error"
1731+
msgstr ""
1732+
17331733
#: py/builtinhelp.c
17341734
msgid "Plus any modules on the filesystem\n"
17351735
msgstr ""
@@ -1941,10 +1941,6 @@ msgstr ""
19411941
msgid "Stack overflow. Increase stack size."
19421942
msgstr ""
19431943

1944-
#: shared-module/usb/core/Device.c
1945-
msgid "Stall"
1946-
msgstr ""
1947-
19481944
#: shared-bindings/alarm/time/TimeAlarm.c
19491945
msgid "Supply one of monotonic_time or epoch_time"
19501946
msgstr ""
@@ -2305,10 +2301,6 @@ msgstr ""
23052301
msgid "Writes not supported on Characteristic"
23062302
msgstr ""
23072303

2308-
#: shared-module/usb/core/Device.c
2309-
msgid "Xfer"
2310-
msgstr ""
2311-
23122304
#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h
23132305
#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h
23142306
#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h

shared-module/usb/core/Device.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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(MP_ERROR_TEXT("Xfer"));
162+
mp_raise_usb_core_USBError(NULL);
163163
return 0;
164164
}
165165
uint32_t start_time = supervisor_ticks_ms32();
@@ -177,7 +177,7 @@ static size_t _xfer(tuh_xfer_t *xfer, mp_int_t timeout) {
177177
xfer_result_t result = _xfer_result;
178178
_xfer_result = 0xff;
179179
if (result == XFER_RESULT_STALLED) {
180-
mp_raise_usb_core_USBError(MP_ERROR_TEXT("Stall"));
180+
mp_raise_usb_core_USBError(MP_ERROR_TEXT("Pipe error"));
181181
}
182182
if (result == 0xff) {
183183
tuh_edpt_abort_xfer(xfer->daddr, xfer->ep_addr);
@@ -206,7 +206,7 @@ static bool _open_endpoint(usb_core_device_obj_t *self, mp_int_t endpoint) {
206206
}
207207

208208
if (self->configuration_descriptor == NULL) {
209-
mp_raise_usb_core_USBError(MP_ERROR_TEXT("NoCfg"));
209+
mp_raise_usb_core_USBError(MP_ERROR_TEXT("No configuration set"));
210210
return false;
211211
}
212212

@@ -241,7 +241,7 @@ static bool _open_endpoint(usb_core_device_obj_t *self, mp_int_t endpoint) {
241241

242242
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) {
243243
if (!_open_endpoint(self, endpoint)) {
244-
mp_raise_usb_core_USBError(MP_ERROR_TEXT("Endpt"));
244+
mp_raise_usb_core_USBError(NULL);
245245
return 0;
246246
}
247247
tuh_xfer_t xfer;
@@ -254,7 +254,7 @@ mp_int_t common_hal_usb_core_device_write(usb_core_device_obj_t *self, mp_int_t
254254

255255
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) {
256256
if (!_open_endpoint(self, endpoint)) {
257-
mp_raise_usb_core_USBError(MP_ERROR_TEXT("Endpt"));
257+
mp_raise_usb_core_USBError(NULL);
258258
return 0;
259259
}
260260
tuh_xfer_t xfer;
@@ -289,7 +289,7 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self,
289289
_xfer_result = 0xff;
290290

291291
if (!tuh_control_xfer(&xfer)) {
292-
mp_raise_usb_core_USBError(MP_ERROR_TEXT("Xfer"));
292+
mp_raise_usb_core_USBError(NULL);
293293
return 0;
294294
}
295295
uint32_t start_time = supervisor_ticks_ms32();
@@ -307,7 +307,7 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self,
307307
xfer_result_t result = _xfer_result;
308308
_xfer_result = 0xff;
309309
if (result == XFER_RESULT_STALLED) {
310-
mp_raise_usb_core_USBError(MP_ERROR_TEXT("Stall"));
310+
mp_raise_usb_core_USBError(MP_ERROR_TEXT("Pipe error"));
311311
}
312312
if (result == 0xff) {
313313
tuh_edpt_abort_xfer(xfer.daddr, xfer.ep_addr);

0 commit comments

Comments
 (0)