Skip to content
Closed
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
18 changes: 17 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ void print_help(char *app_name) {
printf("Available commands: \n"
"\t%s id\n"
"\t%s info\n"
"\t%s pin-info\n"
"\t%s version\n"
"\t%s check <HOTP CODE>\n"
"\t%s regenerate <ADMIN PIN>\n"
"\t%s set <BASE32 HOTP SECRET> <ADMIN PIN> [COUNTER]\n",
app_name, app_name, app_name, app_name, app_name, app_name);
app_name, app_name, app_name, app_name, app_name, app_name, app_name);
}


Expand Down Expand Up @@ -119,6 +120,21 @@ int parse_cmd_and_run(int argc, char *const *argv) {
res = RET_NO_ERROR;
}
} break;
case 'p': { // pin-info
struct ResponseStatus status;
res = device_get_status(&dev, &status);
check_ret((res != RET_NO_ERROR) && (res != RET_NO_PIN_ATTEMPTS), res);
if (res != RET_NO_PIN_ATTEMPTS) {
printf("Admin PIN counter: %d\nUser PIN Counter: %d\n",
status.retry_admin, status.retry_user);
} else {
printf("Admin PIN counter: Not set\nUser PIN Counter: Not set\n");
}
if (res == RET_NO_PIN_ATTEMPTS) {
// Ignore if PIN is not set here
res = RET_NO_ERROR;
}
} break;
case 'c':
if (argc != 3) break;
res = check_code_on_device(&dev, argv[2]);
Expand Down