fido_dev_info_manifest
,
fido_dev_info_new
,
fido_dev_info_free
,
fido_dev_info_ptr
,
fido_dev_info_path
,
fido_dev_info_product
,
fido_dev_info_vendor
,
fido_dev_info_manufacturer_string
,
fido_dev_info_product_string
—
FIDO 2 device discovery functions
#include
<fido.h>
int
fido_dev_info_manifest
(
fido_dev_info_t
*devlist,
size_t
ilen,
size_t
*olen);
fido_dev_info_t *
fido_dev_info_new
(
size_t
n);
void
fido_dev_info_free
(
fido_dev_info_t
**devlist_p,
size_t n);
const fido_dev_info_t *
fido_dev_info_ptr
(
const
fido_dev_info_t *devlist,
size_t i);
const char *
fido_dev_info_path
(
const
fido_dev_info_t *di);
int16_t
fido_dev_info_product
(
const
fido_dev_info_t *di);
int16_t
fido_dev_info_vendor
(
const
fido_dev_info_t *di);
const char *
fido_dev_info_manufacturer_string
(
const
fido_dev_info_t *di);
const char *
fido_dev_info_product_string
(
const
fido_dev_info_t *di);
The
fido_dev_info_manifest
() function fills
devlist with up to
ilen FIDO devices found by the underlying
operating system. Currently only USB HID devices are supported. The number of
discovered devices is returned in
olen, where
olen is an addressable pointer.
The
fido_dev_info_new
() function returns a
pointer to a newly allocated, empty device list with
n available slots. If memory is not
available, NULL is returned.
The
fido_dev_info_free
() function releases
the memory backing
*devlist_p, where
*devlist_p must have been previously
allocated by
fido_dev_info_new
(). The
number
n of allocated slots must also be
provided. On return,
*devlist_p is set to
NULL. Either
devlist_p or
*devlist_p may be NULL, in which case
fido_dev_info_free
() is a NOP.
The
fido_dev_info_ptr
() function returns a
pointer to slot number
i of
devlist. It is the caller's responsibility to
ensure that
i is bounded. Please note that
the first slot has index 0.
The
fido_dev_info_path
() returns the
filesystem path or subsystem-specific identification string of
di.
The
fido_dev_info_product
() function returns
the product ID of
di.
The
fido_dev_info_vendor
() function returns
the vendor ID of
di.
The
fido_dev_info_manufacturer_string
()
function returns the manufacturer string of
di. If
di
does not have an associated manufacturer string,
fido_dev_info_manufacturer_string
() returns
an empty string.
The
fido_dev_info_product_string
() function
returns the product string of
di. If
di does not have an associated product
string,
fido_dev_info_product_string
()
returns an empty string.
An example of how to use the functions described in this document can be found
in the
examples/manifest.c file shipped
with
libfido2.
The
fido_dev_info_manifest
() function always
returns
FIDO_OK
. If a discovery error
occurs, the
olen pointer is set to 0.
The pointers returned by
fido_dev_info_ptr
(),
fido_dev_info_path
(),
fido_dev_info_manufacturer_string
(), and
fido_dev_info_product_string
() are
guaranteed to exist until
fido_dev_info_free
() is called on the
corresponding device list.