1*0afa8e06SEd Maste /* 2*0afa8e06SEd Maste * Copyright (c) 2018 Yubico AB. All rights reserved. 3*0afa8e06SEd Maste * Use of this source code is governed by a BSD-style 4*0afa8e06SEd Maste * license that can be found in the LICENSE file. 5*0afa8e06SEd Maste */ 6*0afa8e06SEd Maste 7*0afa8e06SEd Maste #include <fido.h> 8*0afa8e06SEd Maste #include <stdio.h> 9*0afa8e06SEd Maste #include <stdlib.h> 10*0afa8e06SEd Maste 11*0afa8e06SEd Maste #include "../openbsd-compat/openbsd-compat.h" 12*0afa8e06SEd Maste 13*0afa8e06SEd Maste int 14*0afa8e06SEd Maste main(void) 15*0afa8e06SEd Maste { 16*0afa8e06SEd Maste fido_dev_info_t *devlist; 17*0afa8e06SEd Maste size_t ndevs; 18*0afa8e06SEd Maste int r; 19*0afa8e06SEd Maste 20*0afa8e06SEd Maste fido_init(0); 21*0afa8e06SEd Maste 22*0afa8e06SEd Maste if ((devlist = fido_dev_info_new(64)) == NULL) 23*0afa8e06SEd Maste errx(1, "fido_dev_info_new"); 24*0afa8e06SEd Maste 25*0afa8e06SEd Maste if ((r = fido_dev_info_manifest(devlist, 64, &ndevs)) != FIDO_OK) 26*0afa8e06SEd Maste errx(1, "fido_dev_info_manifest: %s (0x%x)", fido_strerr(r), r); 27*0afa8e06SEd Maste 28*0afa8e06SEd Maste for (size_t i = 0; i < ndevs; i++) { 29*0afa8e06SEd Maste const fido_dev_info_t *di = fido_dev_info_ptr(devlist, i); 30*0afa8e06SEd Maste printf("%s: vendor=0x%04x, product=0x%04x (%s %s)\n", 31*0afa8e06SEd Maste fido_dev_info_path(di), 32*0afa8e06SEd Maste (uint16_t)fido_dev_info_vendor(di), 33*0afa8e06SEd Maste (uint16_t)fido_dev_info_product(di), 34*0afa8e06SEd Maste fido_dev_info_manufacturer_string(di), 35*0afa8e06SEd Maste fido_dev_info_product_string(di)); 36*0afa8e06SEd Maste } 37*0afa8e06SEd Maste 38*0afa8e06SEd Maste fido_dev_info_free(&devlist, ndevs); 39*0afa8e06SEd Maste 40*0afa8e06SEd Maste exit(0); 41*0afa8e06SEd Maste } 42