kopia lustrzana https://github.com/espressif/esp-idf
rodzic
e2897f4d4a
commit
72040f2c44
|
@ -46,6 +46,7 @@ import shlex
|
|||
import time
|
||||
import sys
|
||||
import serial
|
||||
import serial.tools.list_ports
|
||||
import serial.tools.miniterm as miniterm
|
||||
import threading
|
||||
import ctypes
|
||||
|
@ -764,12 +765,24 @@ class Monitor(object):
|
|||
|
||||
|
||||
def main():
|
||||
|
||||
def _get_default_serial_port():
|
||||
"""
|
||||
Same logic for detecting serial port as esptool.py and idf.py: reverse sort by name and choose the first port.
|
||||
"""
|
||||
|
||||
try:
|
||||
ports = list(reversed(sorted(p.device for p in serial.tools.list_ports.comports())))
|
||||
return ports[0]
|
||||
except Exception:
|
||||
return '/dev/ttyUSB0'
|
||||
|
||||
parser = argparse.ArgumentParser("idf_monitor - a serial output monitor for esp-idf")
|
||||
|
||||
parser.add_argument(
|
||||
'--port', '-p',
|
||||
help='Serial port device',
|
||||
default=os.environ.get('ESPTOOL_PORT', '/dev/ttyUSB0')
|
||||
default=os.environ.get('ESPTOOL_PORT', _get_default_serial_port())
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
|
|
Ładowanie…
Reference in New Issue