Path: blob/main/contrib/libfido2/examples/manifest.c
39564 views
/*1* Copyright (c) 2018 Yubico AB. All rights reserved.2* Use of this source code is governed by a BSD-style3* license that can be found in the LICENSE file.4* SPDX-License-Identifier: BSD-2-Clause5*/67#include <fido.h>8#include <stdio.h>9#include <stdlib.h>1011#include "../openbsd-compat/openbsd-compat.h"1213int14main(void)15{16fido_dev_info_t *devlist;17size_t ndevs;18int r;1920fido_init(0);2122if ((devlist = fido_dev_info_new(64)) == NULL)23errx(1, "fido_dev_info_new");2425if ((r = fido_dev_info_manifest(devlist, 64, &ndevs)) != FIDO_OK)26errx(1, "fido_dev_info_manifest: %s (0x%x)", fido_strerr(r), r);2728for (size_t i = 0; i < ndevs; i++) {29const fido_dev_info_t *di = fido_dev_info_ptr(devlist, i);30printf("%s: vendor=0x%04x, product=0x%04x (%s %s)\n",31fido_dev_info_path(di),32(uint16_t)fido_dev_info_vendor(di),33(uint16_t)fido_dev_info_product(di),34fido_dev_info_manufacturer_string(di),35fido_dev_info_product_string(di));36}3738fido_dev_info_free(&devlist, ndevs);3940exit(0);41}424344