Saturday, January 17, 2009

Using Bluetooth in Ubuntu

Ubuntu provides Bluetooth support for both serial connections and BlueZ protocol supported devices. Bluetooth is a wireless connection method for locally connected devices such as keyboards, mice, printers, and even PDAs and Bluetooth-capable cell phones. You can think of it as a small local network dedicated to your peripheral devices, eliminating the need for wires. Bluetooth devices can be directly connected through your computer’s serial ports or through specialized Bluetooth cards connected to USB ports or inserted in a PCI slot.

BlueZ is the official Linux Bluetooth protocol and has been integrated into the Linux kernel since version 2.4.6. The BlueZ protocol was developed originally by Qualcomm and is now an open source project located at It is included with Ubuntu in the bluez-utils and bluez-libs packages, among others. Check the BlueZ site for a complete list of supported hardware, including adapters, PCMCIA cards, and serial connectors.

To configure Bluetooth on Ubuntu, choose System Preferences Bluetooth Preferences to open the Bluetooth Preferences window with two tabs, Services and General. The Services pane has entries for Input Service, Audio Service, Network Service, and Serial Service. Use the check boxes to start or stop a service. Input Service and Audio Service are selected and running by default. Add Network Service if you are using a personal area network (PAN). On the General tab, you can select such features as Authorization Requests, Automatic Hardware Detection, and Device Notification.

To enable the Bluetooth service, be sure that the Bluetooth service is checked in servicesadmin by choosing System Administration Services.

Bluetooth Configuration
BlueZ includes several modules and drivers, including the core Bluetooth protocols for Host Controller Interface (HCI) devices (HCI USB, UART, PCMCIA) and virtual HCI drivers, along with modules to support protocols for Logical Link Control and Adaptation Protocol (L2CAP), serial port emulation (RFCOMM), Ethernet emulation (BNEP), Synchronous Connection-Oriented (SCO) links for real-time voice, and the Service Discovery Protocol (SDP), which automatically detects services available for an application. In addition, extended services are supported such as PAN and LAN access over Point-to-Point Protocol (PPP).

Configuration information is located in the /etc/bluetooth directory, along with the /etc/pcmcia directory for notebooks. The HCI information is saved in /etc/bluetooth/hcid.conf, and RFCOMM configuration information is in /etc/bluetooth/rfcomm.conf. The Bluetooth service script, /etc/rc.d/init.d/bluetooth, is used to start and stop Bluetooth services. This script will start up the Bluetooth daemon for HCI devices, hcid, and run any detection and configuration tools, including sdpd for the Service Discovery Protocol, and rfcomm. It will also activate any serial Bluetooth devices, using hciattach to detect them.

From the command line, you can use the hciconfig command to configure Bluetooth devices and hcitool to configure Bluetooth connections. Use hciattach to attach serial devices to a serial port such as /dev/ttyS1, and use rfcomm to configure and attach RFCOMM devices. Use l2ping to detect a Bluetooth device.

PAN allows you to use Bluetooth to implement a PAN supporting IP protocols, much like a wireless LAN for a small number of computers and devices. Bluetooth supports a much smaller bandwidth (1 to 2 megabits) than that used for a standard LAN, but it is sufficient for connecting and transferring data from handheld devices. Several devices and computers can be configured as PAN users, connecting through a central Group Network (GN) computer.

Alternatively, PAN users could connect to a gateway system operating as a network access point connecting the Bluetooth personal network to a large LAN network. The PAN nodes run their own service daemon, pand. Dial-up networking uses the dund daemon.

Source of Information : McGraw Hill Ubuntu The Complete Reference

No comments: