Merge remote-tracking branch 'origin/main'

This commit is contained in:
Hosted Weblate 2021-10-07 19:08:39 +02:00
commit a219686b8a
No known key found for this signature in database
GPG Key ID: A3FAAA06E6569B4C
2 changed files with 9 additions and 1 deletions

View File

@ -165,6 +165,10 @@ msgstr ""
msgid "%q should be an int"
msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q with a report ID of 0 must be of length 1"
msgstr ""
#: py/bc.c py/objnamedtuple.c
msgid "%q() takes %d positional arguments but %d were given"
msgstr ""

View File

@ -136,7 +136,7 @@ STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args
// It's not the actual argument that's out of range, but its elements.
// But the error message is close enough.
MP_OBJ_SMALL_INT_VALUE(mp_obj_subscr(report_ids, i_obj, MP_OBJ_SENTINEL)),
1, 255, MP_QSTR_report_ids);
0, 255, MP_QSTR_report_ids);
in_report_lengths_array[i] = (uint8_t)mp_arg_validate_int_range(
MP_OBJ_SMALL_INT_VALUE(mp_obj_subscr(in_report_lengths, i_obj, MP_OBJ_SENTINEL)),
@ -147,6 +147,10 @@ STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args
0, 255, MP_QSTR_out_report_lengths);
}
if (report_ids_array[0] == 0 && report_ids_count > 1) {
mp_raise_ValueError_varg(translate("%q with a report ID of 0 must be of length 1"), MP_QSTR_report_ids);
}
common_hal_usb_hid_device_construct(
self, descriptor, usage_page, usage, report_ids_count, report_ids_array, in_report_lengths_array, out_report_lengths_array);
return (mp_obj_t)self;