10afa8e06SEd Maste /*
20afa8e06SEd Maste * Copyright (c) 2018 Yubico AB. All rights reserved.
30afa8e06SEd Maste * Use of this source code is governed by a BSD-style
40afa8e06SEd Maste * license that can be found in the LICENSE file.
5*2ccfa855SEd Maste * SPDX-License-Identifier: BSD-2-Clause
60afa8e06SEd Maste */
70afa8e06SEd Maste
80afa8e06SEd Maste #include <fido.h>
90afa8e06SEd Maste #include <stdio.h>
100afa8e06SEd Maste #include <stdlib.h>
110afa8e06SEd Maste
120afa8e06SEd Maste #include "../openbsd-compat/openbsd-compat.h"
130afa8e06SEd Maste
140afa8e06SEd Maste int
main(void)150afa8e06SEd Maste main(void)
160afa8e06SEd Maste {
170afa8e06SEd Maste fido_dev_info_t *devlist;
180afa8e06SEd Maste size_t ndevs;
190afa8e06SEd Maste int r;
200afa8e06SEd Maste
210afa8e06SEd Maste fido_init(0);
220afa8e06SEd Maste
230afa8e06SEd Maste if ((devlist = fido_dev_info_new(64)) == NULL)
240afa8e06SEd Maste errx(1, "fido_dev_info_new");
250afa8e06SEd Maste
260afa8e06SEd Maste if ((r = fido_dev_info_manifest(devlist, 64, &ndevs)) != FIDO_OK)
270afa8e06SEd Maste errx(1, "fido_dev_info_manifest: %s (0x%x)", fido_strerr(r), r);
280afa8e06SEd Maste
290afa8e06SEd Maste for (size_t i = 0; i < ndevs; i++) {
300afa8e06SEd Maste const fido_dev_info_t *di = fido_dev_info_ptr(devlist, i);
310afa8e06SEd Maste printf("%s: vendor=0x%04x, product=0x%04x (%s %s)\n",
320afa8e06SEd Maste fido_dev_info_path(di),
330afa8e06SEd Maste (uint16_t)fido_dev_info_vendor(di),
340afa8e06SEd Maste (uint16_t)fido_dev_info_product(di),
350afa8e06SEd Maste fido_dev_info_manufacturer_string(di),
360afa8e06SEd Maste fido_dev_info_product_string(di));
370afa8e06SEd Maste }
380afa8e06SEd Maste
390afa8e06SEd Maste fido_dev_info_free(&devlist, ndevs);
400afa8e06SEd Maste
410afa8e06SEd Maste exit(0);
420afa8e06SEd Maste }
43