Skip to content

Commit 7b965de

Browse files
committed
feat: add baud rate option
Signed-off-by: Maximilian Deubel <[email protected]>
1 parent abb4545 commit 7b965de

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/nrfcloud_utils/claim_and_provision_device.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def parse_args(in_args):
4343
parser.add_argument("--port", type=str,
4444
help="Specify which serial port to open, otherwise pick from list",
4545
default=None)
46+
parser.add_argument("--baud", type=int,
47+
help="Baud rate for serial port",
48+
default=115200)
4649
parser.add_argument("-A", "--all",
4750
help="List ports of all types, not just Nordic devices",
4851
action='store_true', default=False)
@@ -393,7 +396,7 @@ def main(in_args):
393396

394397
# try to open the serial port
395398
try:
396-
ser = serial.Serial(port, 115200, xonxoff= args.xonxoff, rtscts=(not args.rtscts_off),
399+
ser = serial.Serial(port, args.baud, xonxoff= args.xonxoff, rtscts=(not args.rtscts_off),
397400
dsrdtr=args.dsrdtr, timeout=serial_timeout)
398401
ser.reset_input_buffer()
399402
ser.reset_output_buffer()

src/nrfcloud_utils/device_credentials_installer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ def parse_args(in_args):
5858
parser.add_argument("--port", type=str,
5959
help="Specify which serial port to open, otherwise pick from list",
6060
default=None)
61+
parser.add_argument("--baud", type=int,
62+
help="Baud rate for serial port",
63+
default=115200)
6164
parser.add_argument("--id-str", type=str,
6265
help="Device ID to use instead of UUID. Will be a prefix if used with --id-imei",
6366
default="")
@@ -492,7 +495,7 @@ def main(in_args):
492495

493496
# try to open the serial port
494497
try:
495-
ser = serial.Serial(port, 115200, xonxoff= args.xonxoff, rtscts=(not args.rtscts_off),
498+
ser = serial.Serial(port, args.baud, xonxoff= args.xonxoff, rtscts=(not args.rtscts_off),
496499
dsrdtr=args.dsrdtr, timeout=serial_timeout)
497500
ser.reset_input_buffer()
498501
ser.reset_output_buffer()

src/nrfcloud_utils/gather_attestation_tokens.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def parse_args(in_args):
5151
parser.add_argument("--port", type=str,
5252
help="Specify which serial port to open, otherwise pick from list",
5353
default=None)
54+
parser.add_argument("--baud", type=int,
55+
help="Baud rate for serial port",
56+
default=115200)
5457
parser.add_argument("-A", "--all",
5558
help="List ports of all types, not just Nordic devices",
5659
action='store_true', default=False)
@@ -417,7 +420,7 @@ def main(in_args):
417420

418421
# try to open the serial port
419422
try:
420-
ser = serial.Serial(port, 115200, xonxoff= args.xonxoff, rtscts=(not args.rtscts_off),
423+
ser = serial.Serial(port, args.baud, xonxoff= args.xonxoff, rtscts=(not args.rtscts_off),
421424
dsrdtr=args.dsrdtr, timeout=serial_timeout)
422425
ser.reset_output_buffer()
423426
write_line('')

0 commit comments

Comments
 (0)