Skip to content

Commit bd54f06

Browse files
committed
fix vcom0 detection
It wasn't working before we were just getting lucky
1 parent 2a500cb commit bd54f06

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"colorama >= 0.3.7",
3434
"crcmod >= 1.7",
3535
"pycryptodome >= 3.15.0",
36+
"pynrfjprog == 10.19.0",
3637
"pyserial >= 3.0.1",
3738
"siphash >= 0.0.1",
3839
"toml >= 0.10.2",

tockloader/bootloader_serial.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,22 @@ def _determine_port(self, any=False):
230230
break
231231

232232
if vcom0_path != None:
233+
# On mac, the nrfjprog tool uses the /dev/tty* paths,
234+
# and we need the /dev/cu* paths. We just hack in a
235+
# substitution here which will only have an effect on
236+
# the mac paths.
237+
vcom0_path_standarized = vcom0_path.replace(
238+
"/dev/tty.usbmodem", "/dev/cu.usbmodem"
239+
)
240+
233241
# Update list of ports to just the one we found for
234242
# VCOM0.
235-
ports = [p for p in ports if vcom0_path not in p.device]
243+
ports = [p for p in ports if vcom0_path_standarized in p.device]
236244
index = 0
237245
logging.info(
238-
'Discovered "{}" as nRF52840dk VCOM0.'.format(vcom0_path)
246+
'Discovered "{}" as nRF52840dk VCOM0.'.format(
247+
vcom0_path_standarized
248+
)
239249
)
240250

241251
# Must close this to end the underlying pynrfjprog process.

0 commit comments

Comments
 (0)