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