Skip to content

Commit 8803586

Browse files
committed
usb-device-cdc: Fix default timeout in CDCInterface.init().
CDCInterface.__init__() sets self._timeout = 1000, then calls self.init(**kwargs). The init() method had timeout=None as default, which unconditionally overwrites self._timeout with None. This causes TypeError in read(), write(), readinto(), and ioctl() which all compare int >= self._timeout. Set the default timeout=1000 in init() to match the intended default, consistent with how other parameters (baudrate, bits, etc.) have their defaults specified directly in the init() signature. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
1 parent 6ae440a commit 8803586

File tree

1 file changed

+1
-1
lines changed
  • micropython/usb/usb-device-cdc/usb/device

1 file changed

+1
-1
lines changed

micropython/usb/usb-device-cdc/usb/device/cdc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def __init__(self, **kwargs):
122122
self.init(**kwargs)
123123

124124
def init(
125-
self, baudrate=9600, bits=8, parity="N", stop=1, timeout=None, txbuf=256, rxbuf=256, flow=0
125+
self, baudrate=9600, bits=8, parity="N", stop=1, timeout=1000, txbuf=256, rxbuf=256, flow=0
126126
):
127127
# Configure the CDC serial port. Note that many of these settings like
128128
# baudrate, bits, parity, stop don't change the USB-CDC device behavior

0 commit comments

Comments
 (0)