Support configure via the Vendor interface (#524)

* Support configure via the Vendor interface

* Adjust tests now that GetInfo is supported on vendor_hid

* Add test for vendor_hid not supporting FIDO command
This commit is contained in:
Liam Murphy
2022-08-08 21:54:46 +10:00
committed by GitHub
parent 4a2217f025
commit 262e505ef7
3 changed files with 40 additions and 8 deletions

View File

@@ -23,6 +23,7 @@ import argparse
import getpass
import datetime
import sys
from unittest.mock import patch
import uuid
import colorama
@@ -125,7 +126,15 @@ def main(args):
length=32, byteorder="big", signed=False)
}
patcher = None
if args.use_vendor_hid:
patcher = patch.object(hid.base, "FIDO_USAGE_PAGE", 0xFF00)
patcher.start()
info("Using the Vendor HID interface")
devices = get_opensk_devices(args.batch)
if patcher:
patcher.stop()
responses = []
if not devices:
fatal("No devices found.")
@@ -202,4 +211,11 @@ if __name__ == "__main__":
"This command can fail if the certificate or the private key "
"haven't been both programmed yet."),
)
parser.add_argument(
"--use-vendor-hid",
default=False,
action="store_true",
dest="use_vendor_hid",
help=("Whether to configure the device using the Vendor HID interface"),
)
main(parser.parse_args())