1.\" Copyright (c) 2020 Yubico AB. All rights reserved.
2.\"
3.\" Redistribution and use in source and binary forms, with or without
4.\" modification, are permitted provided that the following conditions are
5.\" met:
6.\"
7.\"    1. Redistributions of source code must retain the above copyright
8.\"       notice, this list of conditions and the following disclaimer.
9.\"    2. Redistributions in binary form must reproduce the above copyright
10.\"       notice, this list of conditions and the following disclaimer in
11.\"       the documentation and/or other materials provided with the
12.\"       distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18.\" HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25.\"
26.\" SPDX-License-Identifier: BSD-2-Clause
27.\"
28.Dd $Mdocdate: August 5 2020 $
29.Dt FIDO_DEV_GET_TOUCH_BEGIN 3
30.Os
31.Sh NAME
32.Nm fido_dev_get_touch_begin ,
33.Nm fido_dev_get_touch_status
34.Nd asynchronously wait for touch on a FIDO2 authenticator
35.Sh SYNOPSIS
36.In fido.h
37.Ft int
38.Fn fido_dev_get_touch_begin "fido_dev_t *dev"
39.Ft int
40.Fn fido_dev_get_touch_status "fido_dev_t *dev" "int *touched" "int ms"
41.Sh DESCRIPTION
42The functions described in this page allow an application to
43asynchronously wait for touch on a FIDO2 authenticator.
44This is useful when multiple authenticators are present and
45the application needs to know which one to use.
46.Pp
47The
48.Fn fido_dev_get_touch_begin
49function initiates a touch request on
50.Fa dev .
51.Pp
52The
53.Fn fido_dev_get_touch_status
54function continues an ongoing touch request on
55.Fa dev ,
56blocking up to
57.Fa ms
58milliseconds.
59On success,
60.Fa touched
61will be updated to reflect the touch request status.
62If
63.Fa touched
64is 1, the device was touched, and the touch request is
65terminated.
66If
67.Fa touched
68is 0, the application may call
69.Fn fido_dev_get_touch_status
70to continue the touch request, or
71.Fn fido_dev_cancel
72to terminate it.
73.Sh RETURN VALUES
74The error codes returned by
75.Fn fido_dev_get_touch_begin
76and
77.Fn fido_dev_get_touch_status
78are defined in
79.In fido/err.h .
80On success,
81.Dv FIDO_OK
82is returned.
83.Sh EXAMPLES
84Please refer to
85.Em examples/select.c
86in
87.Em libfido2's
88source tree.
89.Sh SEE ALSO
90.Xr fido_dev_cancel 3
91.Sh CAVEATS
92The
93.Fn fido_dev_get_touch_status
94function will cause a command to be transmitted to U2F
95authenticators.
96These transmissions should not exceed a frequency of 5Hz.
97