Skip to content

Commit 307ba0c

Browse files
committed
add flow control options
Signed-off-by: Maximilian Deubel <[email protected]>
1 parent eeecccb commit 307ba0c

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/nrfcredstore/cli.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,19 @@ def parse_args(in_args):
2323
parser = argparse.ArgumentParser(description='Manage certificates stored in a cellular modem.')
2424
parser.add_argument('dev', help='Device used to communicate with the modem. For interactive selection of serial port, use "auto". For RTT, use "rtt". If given a SEGGER serial number, it is assumed to be an RTT device.')
2525
parser.add_argument('--baudrate', type=int, default=115200, help='Serial baudrate')
26-
parser.add_argument('--timeout', type=int, default=3,
27-
help='Serial communication timeout in seconds')
28-
parser.add_argument('--debug', action='store_true',
29-
help='Enable debug logging')
26+
parser.add_argument('--timeout', type=int, default=3, help='Serial communication timeout in seconds')
27+
parser.add_argument('--debug', action='store_true', help='Enable debug logging')
3028
parser.add_argument('--cmd-type', choices=['at', 'shell', 'auto'], default='auto',
31-
help='Command type to use. "at" for AT commands, "shell" for shell commands, "auto" to detect automatically.')
29+
help='Command type to use. "at" for AT commands, "shell" for shell commands, "auto" to detect automatically.')
30+
parser.add_argument("--xonxoff",
31+
help="Enable software flow control for serial connection",
32+
action='store_true', default=False)
33+
parser.add_argument("--rtscts-off",
34+
help="Disable hardware (RTS/CTS) flow control for serial connection",
35+
action='store_true', default=False)
36+
parser.add_argument("--dsrdtr",
37+
help="Enable hardware (DSR/DTR) flow control for serial connection",
38+
action='store_true', default=False)
3239

3340
subparsers = parser.add_subparsers(
3441
title='subcommands', dest='subcommand', help='Certificate related commands'
@@ -149,15 +156,15 @@ def run(argv=sys.argv):
149156

150157
# Use inquirer to find the device
151158
if args.dev == 'auto':
152-
comms = Comms(list_all=True, baudrate=args.baudrate, timeout=args.timeout)
159+
comms = Comms(list_all=True, baudrate=args.baudrate, timeout=args.timeout, xonxoff=args.xonxoff, rtscts=not args.rtscts_off, dsrdtr=args.dsrdtr)
153160
elif args.dev == 'rtt':
154161
comms = Comms(rtt=True, baudrate=args.baudrate, timeout=args.timeout)
155162
# If dev is just numbers, assume it's an rtt device
156163
elif args.dev.isdigit():
157164
comms = Comms(rtt=True, serial=int(args.dev), timeout=args.timeout)
158165
# Otherwise, assume it's a serial device
159166
else:
160-
comms = Comms(port=args.dev, baudrate=args.baudrate, timeout=args.timeout)
167+
comms = Comms(port=args.dev, baudrate=args.baudrate, timeout=args.timeout, xonxoff=args.xonxoff, rtscts=not args.rtscts_off, dsrdtr=args.dsrdtr)
161168

162169
cred_if = ATCommandInterface(comms)
163170

0 commit comments

Comments
 (0)