QUERY · ISSUE
usb-device-cdc raises TypeError when using default timeout of None and going to block
https://github.com/micropython/micropython-lib/blob/master/micropython/usb/usb-device-cdc/usb/device/cdc.py#L368
and same for read function.
# check for timeout
if time.ticks_diff(time.ticks_ms(), start) >= self._timeout:
return len(buf) - len(mv)
machine.idle()
should be something like this:
if isinstance(self._timeout, int) and time.ticks_diff(time.ticks_ms(), start) >= self._timeout:
CANDIDATE · ISSUE
stmhal: USB_VCP when used as a stream is always in non-blocking mode, this should be documented
At least documented, if not allow setting timeout.
STATIC mp_uint_t pyb_usb_vcp_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
int ret = USBD_CDC_Rx((byte*)buf, size, 0);
0 is timeout parameter.