mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
idf_monitor: Fix issues using Ctrl-F/Ctrl-A/gdb with older pyserial
Previously error was "AttributeError: 'Console' object has no attribute 'cancel'"
This commit is contained in:
parent
e477ce93e9
commit
5f3b9876b8
@ -148,7 +148,15 @@ class ConsoleReader(StoppableThread):
|
|||||||
self.console.cleanup()
|
self.console.cleanup()
|
||||||
|
|
||||||
def _cancel(self):
|
def _cancel(self):
|
||||||
self.console.cancel()
|
if hasattr(self.console, "cancel"):
|
||||||
|
self.console.cancel()
|
||||||
|
elif os.name == 'posix':
|
||||||
|
# this is the way cancel() is implemented in pyserial 3.1 or newer,
|
||||||
|
# older pyserial doesn't have this method, hence this hack.
|
||||||
|
#
|
||||||
|
# on Windows there is a different (also hacky) fix, applied above.
|
||||||
|
import fcntl, termios
|
||||||
|
fcntl.ioctl(self.console.fd, termios.TIOCSTI, b'\0')
|
||||||
|
|
||||||
class SerialReader(StoppableThread):
|
class SerialReader(StoppableThread):
|
||||||
""" Read serial data from the serial port and push to the
|
""" Read serial data from the serial port and push to the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user