Skip to content

Commit

Permalink
fix vcom0 detection
Browse files Browse the repository at this point in the history
It wasn't working before we were just getting lucky
  • Loading branch information
bradjc committed Dec 10, 2024
1 parent 2a500cb commit bd54f06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"colorama >= 0.3.7",
"crcmod >= 1.7",
"pycryptodome >= 3.15.0",
"pynrfjprog == 10.19.0",
"pyserial >= 3.0.1",
"siphash >= 0.0.1",
"toml >= 0.10.2",
Expand Down
14 changes: 12 additions & 2 deletions tockloader/bootloader_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,22 @@ def _determine_port(self, any=False):
break

if vcom0_path != None:
# On mac, the nrfjprog tool uses the /dev/tty* paths,
# and we need the /dev/cu* paths. We just hack in a
# substitution here which will only have an effect on
# the mac paths.
vcom0_path_standarized = vcom0_path.replace(
"/dev/tty.usbmodem", "/dev/cu.usbmodem"
)

# Update list of ports to just the one we found for
# VCOM0.
ports = [p for p in ports if vcom0_path not in p.device]
ports = [p for p in ports if vcom0_path_standarized in p.device]
index = 0
logging.info(
'Discovered "{}" as nRF52840dk VCOM0.'.format(vcom0_path)
'Discovered "{}" as nRF52840dk VCOM0.'.format(
vcom0_path_standarized
)
)

# Must close this to end the underlying pynrfjprog process.
Expand Down

0 comments on commit bd54f06

Please sign in to comment.