File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ def add_subparser(subparser):
7373# -----------------------------------------------------------------------------
7474if __name__ == "__main__" :
7575 import argparse
76+ import os .path
7677
7778 parser = argparse .ArgumentParser (
7879 description = 'Program ELF file or reset device via Black Magic Probe' )
Original file line number Diff line number Diff line change @@ -50,7 +50,18 @@ def guess_serial_port(port_hint=None):
5050 else :
5151 ports = glob .glob ('/dev/tty.usb*' )
5252 else :
53- ports = glob .glob ('/dev/tty[A-Za-z]*' )
53+ if port_hint == 'bmp' :
54+ import os .path
55+ # Symlink created by BMP udev rules
56+ # https://github.com/blackmagic-debug/blackmagic/blob/main/driver/99-blackmagic-plugdev.rules
57+ if os .path .exists ('/dev/ttyBmpGdb' ):
58+ ports = ['/dev/ttyBmpGdb' ]
59+ elif os .path .exists ('/dev/ttyACM0' ):
60+ ports = ['/dev/ttyACM0' ]
61+ else :
62+ ports = [None ]
63+ else :
64+ ports = glob .glob ('/dev/tty[A-Za-z]*' )
5465 return next (iter (ports ), None )
5566
5667
You can’t perform that action at this time.
0 commit comments