The translation is temporarily closed for contributions due to maintenance, please come back later.

Source string Read only

(itstool) path: sect2/para
Context English State
If the Bluetooth device will be attached to the system during system startup, the system can be configured to load the module at boot time by adding the driver to <filename>/boot/loader.conf</filename>:
ng_ubt_load="YES"
Once the driver is loaded, plug in the <acronym>USB</acronym> dongle. If the driver load was successful, output similar to the following should appear on the console and in <filename>/var/log/messages</filename>:
ubt0: vendor 0x0a12 product 0x0001, rev 1.10/5.25, addr 2
ubt0: Interface 0 endpoints: interrupt=0x81, bulk-in=0x82, bulk-out=0x2
ubt0: Interface 1 (alt.config 5) endpoints: isoc-in=0x83, isoc-out=0x3,
wMaxPacketSize=49, nframes=6, buffer size=294
To start and stop the Bluetooth stack, use its startup script. It is a good idea to stop the stack before unplugging the device. Starting the bluetooth stack might require <citerefentry><refentrytitle>hcsecd</refentrytitle><manvolnum>8</manvolnum></citerefentry> to be started. When starting the stack, the output should be similar to the following:
<prompt>#</prompt> <userinput>service bluetooth start ubt0</userinput>
BD_ADDR: 00:02:72:00:d4:1a
Features: 0xff 0xff 0xf 00 00 00 00 00
&lt;3-Slot&gt; &lt;5-Slot&gt; &lt;Encryption&gt; &lt;Slot offset&gt;
&lt;Timing accuracy&gt; &lt;Switch&gt; &lt;Hold mode&gt; &lt;Sniff mode&gt;
&lt;Park mode&gt; &lt;RSSI&gt; &lt;Channel quality&gt; &lt;SCO link&gt;
&lt;HV2 packets&gt; &lt;HV3 packets&gt; &lt;u-law log&gt; &lt;A-law log&gt; &lt;CVSD&gt;
&lt;Paging scheme&gt; &lt;Power control&gt; &lt;Transparent SCO data&gt;
Max. ACL packet size: 192 bytes
Number of ACL packets: 8
Max. SCO packet size: 64 bytes
Number of SCO packets: 8
Finding Other Bluetooth Devices
<primary>HCI</primary>
The Host Controller Interface (<acronym>HCI</acronym>) provides a uniform method for accessing Bluetooth baseband capabilities. In FreeBSD, a netgraph <acronym>HCI</acronym> node is created for each Bluetooth device. For more details, refer to <citerefentry><refentrytitle>ng_hci</refentrytitle><manvolnum>4</manvolnum></citerefentry>.
One of the most common tasks is discovery of Bluetooth devices within <acronym>RF</acronym> proximity. This operation is called <emphasis>inquiry</emphasis>. Inquiry and other <acronym>HCI</acronym> related operations are done using <citerefentry><refentrytitle>hccontrol</refentrytitle><manvolnum>8</manvolnum></citerefentry>. The example below shows how to find out which Bluetooth devices are in range. The list of devices should be displayed in a few seconds. Note that a remote device will only answer the inquiry if it is set to <emphasis>discoverable</emphasis> mode.
<prompt>%</prompt> <userinput>hccontrol -n ubt0hci inquiry</userinput>
Inquiry result, num_responses=1
Inquiry result #0
BD_ADDR: 00:80:37:29:19:a4
Page Scan Rep. Mode: 0x1
Page Scan Period Mode: 00
Page Scan Mode: 00
Class: 52:02:04
Clock offset: 0x78ef
Inquiry complete. Status: No error [00]
The <literal>BD_ADDR</literal> is the unique address of a Bluetooth device, similar to the <acronym>MAC</acronym> address of a network card. This address is needed for further communication with a device and it is possible to assign a human readable name to a <literal>BD_ADDR</literal>. Information regarding the known Bluetooth hosts is contained in <filename>/etc/bluetooth/hosts</filename>. The following example shows how to obtain the human readable name that was assigned to the remote device:
<prompt>%</prompt> <userinput>hccontrol -n ubt0hci remote_name_request 00:80:37:29:19:a4</userinput>
BD_ADDR: 00:80:37:29:19:a4
Name: Pav's T39
If an inquiry is performed on a remote Bluetooth device, it will find the computer as <quote>your.host.name (ubt0)</quote>. The name assigned to the local device can be changed at any time.
Remote devices can be assigned aliases in <filename>/etc/bluetooth/hosts</filename>. More information about <filename>/etc/bluetooth/hosts</filename> file might be found in <citerefentry><refentrytitle>bluetooth.hosts</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
The Bluetooth system provides a point-to-point connection between two Bluetooth units, or a point-to-multipoint connection which is shared among several Bluetooth devices. The following example shows how to create a connection to a remote device:
<prompt>%</prompt> <userinput>hccontrol -n ubt0hci create_connection <replaceable>BT_ADDR</replaceable></userinput>
<literal>create_connection</literal> accepts <literal>BT_ADDR</literal> as well as host aliases in <filename>/etc/bluetooth/hosts</filename>.
The following example shows how to obtain the list of active baseband connections for the local device:
<prompt>%</prompt> <userinput>hccontrol -n ubt0hci read_connection_list</userinput>
Remote BD_ADDR Handle Type Mode Role Encrypt Pending Queue State
00:80:37:29:19:a4 41 ACL 0 MAST NONE 0 0 OPEN
A <emphasis>connection handle</emphasis> is useful when termination of the baseband connection is required, though it is normally not required to do this by hand. The stack will automatically terminate inactive baseband connections.
<prompt>#</prompt> <userinput>hccontrol -n ubt0hci disconnect 41</userinput>
Connection handle: 41
Reason: Connection terminated by local host [0x16]
Type <command>hccontrol help</command> for a complete listing of available <acronym>HCI</acronym> commands. Most of the <acronym>HCI</acronym> commands do not require superuser privileges.
Device Pairing
By default, Bluetooth communication is not authenticated, and any device can talk to any other device. A Bluetooth device, such as a cellular phone, may choose to require authentication to provide a particular service. Bluetooth authentication is normally done with a <emphasis><acronym>PIN</acronym> code</emphasis>, an ASCII string up to 16 characters in length. The user is required to enter the same <acronym>PIN</acronym> code on both devices. Once the user has entered the <acronym>PIN</acronym> code, both devices will generate a <emphasis>link key</emphasis>. After that, the link key can be stored either in the devices or in a persistent storage. Next time, both devices will use the previously generated link key. This procedure is called <emphasis>pairing</emphasis>. Note that if the link key is lost by either device, the pairing must be repeated.
The <citerefentry><refentrytitle>hcsecd</refentrytitle><manvolnum>8</manvolnum></citerefentry> daemon is responsible for handling Bluetooth authentication requests. The default configuration file is <filename>/etc/bluetooth/hcsecd.conf</filename>. An example section for a cellular phone with the <acronym>PIN</acronym> code set to <literal>1234</literal> is shown below:
device {
bdaddr 00:80:37:29:19:a4;
name "Pav's T39";
key nokey;
pin "1234";
}
The only limitation on <acronym>PIN</acronym> codes is length. Some devices, such as Bluetooth headsets, may have a fixed <acronym>PIN</acronym> code built in. The <option>-d</option> switch forces <citerefentry><refentrytitle>hcsecd</refentrytitle><manvolnum>8</manvolnum></citerefentry> to stay in the foreground, so it is easy to see what is happening. Set the remote device to receive pairing and initiate the Bluetooth connection to the remote device. The remote device should indicate that pairing was accepted and request the <acronym>PIN</acronym> code. Enter the same <acronym>PIN</acronym> code listed in <filename>hcsecd.conf</filename>. Now the computer and the remote device are paired. Alternatively, pairing can be initiated on the remote device.
The following line can be added to <filename>/etc/rc.conf</filename> to configure <citerefentry><refentrytitle>hcsecd</refentrytitle><manvolnum>8</manvolnum></citerefentry> to start automatically on system start:
hcsecd_enable="YES"
The following is a sample of the <citerefentry><refentrytitle>hcsecd</refentrytitle><manvolnum>8</manvolnum></citerefentry> daemon output:

Loading…

No matching activity found.

Browse all component changes

Source information

Source string comment
(itstool) path: sect2/para
Flags
read-only
Source string location
book.translate.xml:65535
String age
a year ago
Source string age
a year ago
Translation file
books/handbook.pot, string 10877