Skip to content

Instantly share code, notes, and snippets.

@klali
Created March 29, 2016 07:58
Show Gist options
  • Save klali/6c7fa99282a541912c31 to your computer and use it in GitHub Desktop.
Save klali/6c7fa99282a541912c31 to your computer and use it in GitHub Desktop.
#include <u2f-host.h>
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
u2fh_devs *devs = NULL;
u2fh_cmdflags flags = 0;
u2fh_rc rc;
rc = u2fh_global_init (U2FH_DEBUG);
if (rc != U2FH_OK)
{
fprintf (stderr, "error: u2fh_global_init (%d): %s\n", rc,
u2fh_strerror (rc));
exit (EXIT_FAILURE);
}
unsigned max;
while(1) {
rc = u2fh_devs_init (&devs);
if (rc != U2FH_OK)
{
fprintf (stderr, "error: u2fh_devs_init (%d): %s\n", rc,
u2fh_strerror (rc));
goto done;
}
rc = u2fh_devs_discover (devs, &max);
if (rc != U2FH_OK)
{
fprintf (stderr, "error: u2fh_devs_discover (%d): %s\n", rc,
u2fh_strerror (rc));
goto done;
}
u2fh_devs_done (devs);
}
done:
u2fh_global_done ();
exit (0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment