1.\" Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
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.\" $Id: rfcomm_sppd.1,v 1.3 2003/09/07 18:15:55 max Exp $
26.\" $FreeBSD$
27.\"
28.Dd April 21, 2008
29.Dt RFCOMM_SPPD 1
30.Os
31.Sh NAME
32.Nm rfcomm_sppd
33.Nd RFCOMM Serial Port Profile daemon
34.Sh SYNOPSIS
35.Nm
36.Op Fl bhtS
37.Fl a Ar address
38.Fl c Ar channel
39.Sh DESCRIPTION
40The
41.Nm
42utility is a Serial Port Profile daemon.
43It can operate in two modes: client and server.
44.Pp
45In client mode,
46.Nm
47opens RFCOMM connection to the specified
48.Ar address
49server and
50.Ar channel .
51Once connection is established, the
52.Nm
53utility provides access to the server's remote serial port via stdin/stdout
54or via
55.Xr pts 4
56interface if
57.Fl t
58option was specified.
59.Pp
60If the
61.Fl S
62option is specified,
63.Nm
64will operate in server mode and act as RFCOMM server,
65listening on
66.Dv ANY
67address and advertising a virtual serial port
68via the
69.Xr sdpd 8
70daemon.
71If
72.Fl t
73options was specified,
74the server side of the virtual serial port is attached to a pseudo-terminal.
75Otherwise the virtual serial port is attached to the stdin/stdout.
76.Nm
77should be run as root in order to communicate with
78.Xr sdpd 8
79in this case.
80.Pp
81The
82.Nm
83utility opens both master and slave pseudo terminals.
84This is done to ensure that RFCOMM connection stays open until
85.Nm
86is terminated.
87The data received from the master pseudo terminal are sent over
88the RFCOMM connection.
89The data received from the RFCOMM connection are written
90into master pseudo terminal.
91The application in its turn opens the slave pseudo
92terminal and operates on it just like it would operate over the standard serial
93port.
94.Pp
95The options are as follows:
96.Bl -tag -width indent
97.It Fl a Ar address
98In client mode,
99this required option specifies the address of the remote RFCOMM server.
100If this option is specified in server mode,
101.Nm
102will only accept connections from the
103.Tn Bluetooth
104device with address
105.Ar address .
106The address can be specified as BD_ADDR or name.
107If name was specified then
108.Nm
109utility will attempt to resolve the name via
110.Xr bt_gethostbyname 3 .
111.It Fl b
112Detach from the controlling terminal, i.e., run in background.
113.It Fl c Ar channel
114In both client and server mode,
115this option specifies the RFCOMM channel to connect to or listen on.
116In server mode,
117the channel should be a number between 1 and 30.
118If not specified,
119.Nm
120will try to bind to
121.Dq wildcard
122RFCOMM channel number.
123The actual RFCOMM channel will be obtained via
124.Xr getsockname 2
125call and will be used to register Serial Port service with
126.Xr sdpd 8 .
127In client mode,
128the channel could either be a number between 1 and 30 or a service name.
129Supported service names are:
130.Cm DUN
131(for DialUp Networking service),
132.Cm FAX
133(for Fax service),
134.Cm LAN
135(for LAN Access Using PPP service) and
136.Cm SP
137(for Serial Port service).
138If channel was not specified then
139.Nm
140utility will try to obtain RFCOMM channel for Serial Port service via Service
141Discovery Protocol from the server.
142.It Fl h
143Display usage message and exit.
144.It Fl S
145Server mode; see
146.Sx DESCRIPTION .
147.It Fl t
148Use slave pseudo tty.
149If not set stdin/stdout will be used.
150This option is required if
151.Fl b
152option was specified.
153.El
154.Sh FILES
155.Bl -tag -width ".Pa /dev/pts/[num]" -compact
156.It Pa /dev/pts/[num]
157slave pseudo terminals
158.El
159.Sh EXIT STATUS
160.Ex -std
161.Sh EXAMPLES
162.Dl "rfcomm_sppd -a 00:01:02:03:04:05 -c 1 -t"
163.Pp
164Will start the
165.Nm
166utility and open RFCOMM connection to the server at
167.Li 00:01:02:03:04:05
168and channel
169.Li 1 .
170Once the connection has been established, a
171.Xr pts 4
172can be used to talk to the remote serial port on the server.
173.Nm
174prints the name of the
175.Xr pts 4
176to use on stdout.
177.Sh SEE ALSO
178.Xr bluetooth 3 ,
179.Xr ng_btsocket 4 ,
180.Xr pts 4 ,
181.Xr rfcomm_pppd 8 ,
182.Xr sdpd 8
183.Sh AUTHORS
184.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
185.Sh BUGS
186Please report if found.
187