1.\" Copyright (c) 2019 Dirk Engling
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
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 the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd January 7, 2019
26.Dt BLUETOOTH-CONFIG 8
27.Os
28.Sh NAME
29.Nm bluetooth-config
30.Nd a script to manage config files for the bluetooth sub system
31.Sh SYNOPSIS
32.Nm
33.Ar scan
34.Op Fl d Ar device
35.Op Fl n Ar node
36.Sh DESCRIPTION
37The
38.Nm
39utility is an interactive script to provide a frontend to the complex bluetooth sub system daemons.
40.Pp
41The following options are available:
42.Bl -tag -width indent+
43.It Fl d
44Scan for a specific bluetooth device address.
45.It Fl n
46Limit scan to a specific host controller.
47Hint: List all netgraph nodes with
48.Ql /usr/sbin/ngctl list .
49.El
50.Pp
51.Nm
52will help finding and setting up bluetooth controllers, scan for nearby bluetooth devices in
53pairing mode, lookup their names, allow mapping to friendly names in
54.Pa /etc/bluetooth/hosts ,
55ask for the paring PIN, instrument
56.Xr hcsecd 8
57to securely pair with new devices and, if the device offers HID endpoints such as mice or
58keyboards, configure and restart
59.Xr bthidd 8 .
60.Pp
61.Nm
62can bring up any interface and daemon necessary for operation and, if a node is provided on
63command line, will do so automatically for that interface.
64.Sh FILES
65.Bl -tag -width ".Pa /etc/bluetooth/hosts" -compact
66.It Pa /etc/bluetooth/hosts
67.It Pa sysrc -n bthidd_config
68.It Pa sysrc -n hcsecd_config
69.El
70.Sh EXAMPLES
71.Nm
72scan -n ubt0 -a 00:26:bb:7a:58:95
73.Bd -ragged -offset indent
74This will scan the bluetooth controller ubt0hci for a bluetooth device with the address
7500:26:bb:7a:58:95, set up ubt0 if necessary and enter an interactive dialog to pair the
76new device.
77Since in this example a mouse is paired,
78.Nm
79will interact with
80.Xr bthidd 8 ,
81enabling it if necessary and then write an HID descriptor to its config.
82.Ed
83.Pp
84.Nm
85scan
86.Bd -ragged -offset indent
87This will scan all bluetooth controllers on the systems for bluetooth devices, prompting
88to bring up controllers or daemons along the way.
89.Ed
90.Sh SEE ALSO
91.Xr bthost 1 ,
92.Xr bthidcontrol 8 ,
93.Xr bthidd 8 ,
94.Xr hccontrol 8 ,
95.Xr hcsecd 8 ,
96.Xr sdpcontrol 8 ,
97.Xr sysrc 8
98.Sh HISTORY
99A
100.Nm
101utility first appeared in
102.Fx 12.1 .
103.Sh AUTHORS
104.An Dirk Engling Aq Mt erdgeist@erdgeist.org
105.Sh CAVEATS
106.Nm
107can not parse entries in
108.Xr hcsecd 8
109config file and thus will ask the user to manually modify existing pairing PIN entries.
110.Sh THANKS TO
111Lars Engels and Warren Block for suggestions, help, and testing.
112