Skip to content

Commit dd68554

Browse files
committed
Added support for enable/disable Web CCID on the fly.
Signed-off-by: Pol Henarejos <[email protected]>
1 parent f20fdc9 commit dd68554

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ set(SOURCES ${SOURCES}
8484

8585
)
8686
set(USB_ITF_CCID 1)
87+
set(USB_ITF_WCID 1)
8788
include(pico-keys-sdk/pico_keys_sdk_import.cmake)
8889
if(ESP_PLATFORM)
8990
project(pico_hsm)

tools/pico-hsm-tool.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ def parse_args():
9595
subparser_phy = parser_phy.add_subparsers(title='commands', dest='subcommand', required=True)
9696
parser_phy_vp = subparser_phy.add_parser('vidpid', help='Sets VID/PID. Use VID:PID format (e.g. 1234:5678)')
9797
parser_phy_ledn = subparser_phy.add_parser('led', help='Sets LED GPIO number.')
98+
parser_phy_optwcid = subparser_phy.add_parser('wcid', help='Enable/Disable Web CCID interface.')
9899
parser_phy_vp.add_argument('value', help='Value of the PHY option.', metavar='VAL', nargs='?')
99100
parser_phy_ledn.add_argument('value', help='Value of the PHY option.', metavar='VAL', nargs='?')
101+
parser_phy_optwcid.add_argument('value', choices=['enable', 'disable'], help='Enable/Disable Web CCID interface.', nargs='?')
100102

101103
parser_secure = subparser.add_parser('secure', help='Manages security of Pico HSM.')
102104
subparser_secure = parser_secure.add_subparsers(title='commands', dest='subcommand', required=True)
@@ -461,14 +463,16 @@ def phy(picohsm, args):
461463
val = int(sp[0],16).to_bytes(2, 'big') + int(sp[1],16).to_bytes(2, 'big')
462464
elif (args.subcommand == 'led'):
463465
val = [int(val)]
466+
elif (args.subcommand == 'wcid'):
467+
val = val == 'enable'
464468
ret = picohsm.phy(args.subcommand, val)
465469
if (ret):
466470
print(f'Current value: {hexlify(ret)}')
467471
else:
468472
print('Command executed successfully. Please, restart your Pico Key.')
469473

470474
def main(args):
471-
sys.stderr.buffer.write(b'Pico HSM Tool v1.12\n')
475+
sys.stderr.buffer.write(b'Pico HSM Tool v1.14\n')
472476
sys.stderr.buffer.write(b'Author: Pol Henarejos\n')
473477
sys.stderr.buffer.write(b'Report bugs to https://github.com/polhenarejos/pico-hsm/issues\n')
474478
sys.stderr.buffer.write(b'\n\n')

0 commit comments

Comments
 (0)