Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: west_commands: extend west ncs-provision command with --dev-id #18355

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions scripts/west_commands/ncs-provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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",
Expand All @@ -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:
Expand Down
Loading