mirror of
https://github.com/espressif/esptool.git
synced 2025-10-17 07:32:30 +08:00
fix(CH9102F): Suggest to install new serial drivers if writing to RAM fails
This commit is contained in:

committed by
Radim Karniš

parent
d98464706b
commit
f4b59141e8
@@ -713,7 +713,16 @@ def main(argv=None, esp=None):
|
|||||||
)
|
)
|
||||||
args.no_stub = True
|
args.no_stub = True
|
||||||
else:
|
else:
|
||||||
esp = esp.run_stub()
|
try:
|
||||||
|
esp = esp.run_stub()
|
||||||
|
except Exception:
|
||||||
|
# The CH9102 bridge (PID: 0x55D4) can have issues on MacOS
|
||||||
|
if sys.platform == "darwin" and esp._get_pid() == 0x55D4:
|
||||||
|
print(
|
||||||
|
"\nNote: If issues persist, "
|
||||||
|
"try installing the WCH USB-to-Serial MacOS driver."
|
||||||
|
)
|
||||||
|
raise
|
||||||
|
|
||||||
if args.override_vddsdio:
|
if args.override_vddsdio:
|
||||||
esp.override_vddsdio(args.override_vddsdio)
|
esp.override_vddsdio(args.override_vddsdio)
|
||||||
|
@@ -295,6 +295,7 @@ class ESPLoader(object):
|
|||||||
"flash_id": None,
|
"flash_id": None,
|
||||||
"chip_id": None,
|
"chip_id": None,
|
||||||
"uart_no": None,
|
"uart_no": None,
|
||||||
|
"usb_pid": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
if isinstance(port, str):
|
if isinstance(port, str):
|
||||||
@@ -475,6 +476,9 @@ class ESPLoader(object):
|
|||||||
self.sync_stub_detected &= val == 0
|
self.sync_stub_detected &= val == 0
|
||||||
|
|
||||||
def _get_pid(self):
|
def _get_pid(self):
|
||||||
|
if self.cache["usb_pid"] is not None:
|
||||||
|
return self.cache["usb_pid"]
|
||||||
|
|
||||||
if list_ports is None:
|
if list_ports is None:
|
||||||
print(
|
print(
|
||||||
"\nListing all serial ports is currently not available. "
|
"\nListing all serial ports is currently not available. "
|
||||||
@@ -502,10 +506,11 @@ class ESPLoader(object):
|
|||||||
ports = list_ports.comports()
|
ports = list_ports.comports()
|
||||||
for p in ports:
|
for p in ports:
|
||||||
if p.device in active_ports:
|
if p.device in active_ports:
|
||||||
|
self.cache["usb_pid"] = p.pid
|
||||||
return p.pid
|
return p.pid
|
||||||
print(
|
print(
|
||||||
"\nFailed to get PID of a device on {}, "
|
f"\nFailed to get PID of a device on {active_port}, "
|
||||||
"using standard reset sequence.".format(active_port)
|
"using standard reset sequence."
|
||||||
)
|
)
|
||||||
|
|
||||||
def _connect_attempt(self, reset_strategy, mode="default_reset"):
|
def _connect_attempt(self, reset_strategy, mode="default_reset"):
|
||||||
|
Reference in New Issue
Block a user