← index #993Issue #1530
Related · high · value 1.604
QUERY · ISSUE

usb-device-cdc raises TypeError when using default timeout of None and going to block

openby aylen384opened 2025-03-30updated 2025-03-30

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

closedby pfalconopened 2015-10-24updated 2015-10-25

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.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied