diff --git a/scripts/west_commands/ncs-provision.py b/scripts/west_commands/ncs-provision.py index 84e228663b38..9bcc7d64508f 100644 --- a/scripts/west_commands/ncs-provision.py +++ b/scripts/west_commands/ncs-provision.py @@ -35,7 +35,8 @@ def do_add_parser(self, parser_adder): help="Input .pem file with ED25519 private key" ) upload_parser.add_argument("-s", "--soc", type=str, help="SoC", - choices=["nrf54l15"], required=True) + choices=["nrf54l15"], required=True) + upload_parser.add_argument("--dev-id", help="Device serial number") return parser @@ -50,8 +51,8 @@ def do_run(self, args, unknown_args): with open(keyfile, 'rb') as f: priv_key = load_pem_private_key(f.read(), password=None) pub_key = priv_key.public_key() - nrfprovision = subprocess.run( - ["nrfprovision", + command = [ + "nrfprovision", "provision", "-r", "REVOKED", @@ -65,9 +66,15 @@ def do_run(self, args, unknown_args): "ED25519", "-d", "0x20000000", - "--verify"], - stderr=subprocess.PIPE, - text=True) + "--verify" + ] + if args.dev_id: + command.extend(["--snr", args.dev_id]) + nrfprovision = subprocess.run( + command, + stderr=subprocess.PIPE, + text=True + ) stderr = nrfprovision.stderr print(stderr, file=sys.stderr) if re.search('fail', stderr) or nrfprovision.returncode: