[Home] [Credit Search] [Category Browser] [Staff Roll Call] | The LINUX.COM Article Archive |
Originally Published: Tuesday, 16 October 2001 | Author: Devang Shah and Anurag Phadke |
Published to: enhance_articles_hardware/Hardware News | Page: 1/1 - [Std View] |
The Commands Remain the Same: BlueTooth Technology and Linux
Linux.com is pleased to publish this well researched look at the emerging field of wireless networking, focusing on Bluetooth technology and Linux. Learn all about Bluetooth and even modifying the kernel (when needed) to support it.
|
Take a quick glance at the back of your PC, you will see only piles of wires in a messy maze. Bluetooth allows you to get rid of this mess, and then it also takes care of the fun job of solving the "Find the right port and right cable" puzzle.
Bluetooth was first developed in the late 90's. Currently, bigwig's such as Ericsson, Nokia, IBM, Toshiba, Intel, 3Com, Motorola, Lucent Technologies and Microsoft all led by the core Promoter Group of Bluetooth: SIG (Special Interest Group) which boasts of more than 1400 officially registered members. There is a good deal of interest in keeping the Bluetooth protocols open and non propriety and Bluetooth can also mix with Linux, as we shall see in this article.
CORE: The system design is made from independent layers for easy understanding and description. The core Bluetooth specification are described in detail in, appropriately, the Core Bluetooth Specifications.
PROFILES: The design specifications also describe certain properties for certain common classes of applications that will allow Bluetooth to achieve uniformity across diverse manufacturers. These are described in profiles section of the Bluetooth Specification.
Both the core and profiles are available for download at the official Bluetooth website http://www.bluetooth.com.
Bluetooth waves use a technique named GFSK (Gaussian Frequency Shift Keying) for modulation, having a modulation index between 0.28 and 0.35. Positive frequency deviation corresponds to binary 1, whereas negative frequency deviation corresponds to binary 0. Instead of a continuous data stream of packets for transferring information, Bluetooth prefers the frequency hopping technique (described later in this article). When more than one information signal is to be passed at a time, a channel spacing of 1Mhz, along with a guard band, is added at each band end to avoid interference between adjacent data channels.
Bluetooth Core Protocols -> Baseband, LMP,HCI, L2CAP, SDP.
Cable Replacement Protocol -> RFCOMM.
Telephony Control Protocol -> TCS-Binary, AT Commands.
Adopted Protocols -> PPP,UDP, TCP/IP, OBEX, vCard, vCal, IrMC, WAE.
The basic protocol stack consists is shown in this figure:
Radio Layer, Baseband and Link Manager Protocol (LMP) for the basic three bottom layers integrated In the firmware/hardware of the bluetooth stack. Host Controller interface (HCI), present between LMP and L2CAP communicates with the Bluetooth hardware by the upper protocol named Logical Link Control and Adaptation Protocol (L2CAP). HCI also forms the basis of operations providing command interface to Baseband controller, Link Manager, access to Hardware status and Control registers. Above L2CAP other layers such as RFCOMM, PPP, TCP/IP, UDP, WAP, OBEX etc. reside.
A physical Radio Frequency Link between Bluetooth units (forming a piconet) is established using Baseband and the Link control layer.
Two types of links as described below are handled by Baseband.
SCO (Synchronous Connection Oriented) -> is a symmetric point-to-point link between a master and a slave in a single piconet behaving as a circuit switched connection containing audio or audio and data. Since it primarily contains audio data, the received packets are never checked for loss of data during transmission and thereby never re-transmitted.
ACL (Asynchronous Connectionless) -> It is a point-to-multipoint link between master and slaves residing in a piconet containing data information. As loss of data is not tolerated in most operations, packets are re-transmitted to assure that they reach the final destination.
All packets can be encrypted. Error correction techniques such as FEC or CRC can be used to ensure reliability of data transmission.
Audio -> Audio can be sent between two Bluetooth devices by simply opening an audio link.
Data Transfer Between Two or More Bluetooth Enabled Devices
When two or more Bluetooth units communicate with one another it forms a point to point connection. In addition, if there are more than 2 units, then a piconet is formed which shares the hopping channel amongst themselves. Within every piconet there exists a master unit which controls access to the channel and the remaining are slave units. A maximum of 7 active slave units and 255 standby slave devices can reside in a piconet. Multiple piconets overlapping one another form a scatternet. The corresponding units from different piconets can interact with one another on TDM (Time Division Multiplexing Basis). However a unit can be a master to only one piconet and slave in remaining piconets.The Master/Slave is just a designation given to an unit whose scope is limited only within a particular piconet. This implies a master in one piconet can be a slave in another and vice versa.
Every device can scan its vicinity area for the presence of another similar device. When a slave performs an inquiry scan sequence scanning out unknown devices or a master reaches out in search for private devices and networks, appropriate signals are sent and depending on the software controlling the hardware, relevant responses sent back. The response provides the requisite amount of information required to connect the devices.
Each channel is divided into 625 micro-seconds of time slot, meaning the time difference between two successive frequency hops is of 625 micro-seconds, that is, the time length between two consecutive data packets is 625 micro-seconds Each time slot bearing a specific cyclic number varying from 0 to ([2exp27] - 1).
The TDD (Time Division Duplex) scheme is used when a unit has different designations in different piconets -> the master using even and slave using odd numbered time slots for data transfer.
The device which get's initialized first becomes the master while the remaining seven become its slaves. Using SCO/ACL links the devices communicate with one another, the master sharing the channel with LinMangers present on each device, assisting it in it's job. Services such as authentication and encryption, control of power mode and duty cycles of the Bluetooth radio device, plus connection status of the unit in a piconet are offered by LMP.
L2CAP uses channels identified by CID's (Connection Identifiers) which are 16 bit numbers representing a logical end point of a connection for each application on a device. In addition, Protocol Multiplexing and Segmentation and Reassembly operations to provide Maximum Transfer Unit (MTU) throughput is present in L2CAP.
The presence of a driver on the PC to format the data accordingly becomes mandatory along, with a host controller interface (HCI) on the device to receive and accept data.
SDP (Service Discovery Protocols ) -> Using SDP device information, services online, connection between two or more units can be established.
RFCOMM -> Physical connection between two communicating devices is established using RS-232 control. The RFCOMM emulates this RS-232 process by sending equivalent signals over upper layer services such as OBEX. Up to 60 simultaneous connections between two Bluetooth devices can be established.
Imagine data hopping around you in bits and pieces. That's precisely the way frequency hopping works. It takes the data signal and modulates it with a carrier signal that hops from frequency to frequency as a function of time over a wide band of frequencies.
It is the repeated switching of frequencies during radio transmission to minimize the effectiveness of "electronic warfare" - that is, the unauthorized interception or jamming of telecommunication technologies that helps make Bluetooth effective. Frequency hopping also is known as frequency- hopping code division multiple access (FH-CDMA).
Whenever a connection is first established between 2 (or more) units (in a piconet), the Master-unit establishes a frequency-hopping scheme, which is communicated to the other units. This frequency selection scheme consists of two parts:
The mapping from the input to a particular hop frequency is performed in the selection box.
Basically, the input is the native clock and the current address. In the CONNECTION state, the native clock is modified by an offset equal to the master clock. Only the 27 MSBs of the clock are used. In the page and inquiry substates, all 28 bits of the clock are used. However, in the PAGE substate the native clock will be modified to the master?s estimate of the paged unit.
In a general FH-CDMA system, a transmitter "hops" between available frequencies according to a specified algorithm, which can be either random or pre-planned. The transmitter operates in synchronization with a receiver, which remains tuned to the same center frequency as the transmitter. A short burst of data is transmitted on a narrowband. Then, the transmitter tunes to another frequency and transmits again. The receiver thus is capable of hopping its frequency over a given bandwidth several times a second, transmitting on one frequency for a certain period of time, then hopping to another frequency and transmitting again. Frequency hopping requires a much wider bandwidth than is needed to transmit the same information using only one carrier frequency.
The frequency hopping technique reduces interference because an interfering signal from a narrowband system will only affect the spread spectrum signal if both are transmitting at the same frequency at the same time. Thus, the total sum of frequencies will have a very low interference presence, resulting in little or no bit errors. A frequency hopping radio, for example, will hop the carrier frequency over the 2.4 GHz frequency band between 2.4 GHzs and 2.483 GHz.This is important because Bluetooth has been designed to operate in noisy radio frequency environments.
File Transfer: This model allows file transfer between two Bluetooth enabled devices. Based on the GOEP (Generic Object Exchange Profile) protocols and procedures used by applications in handling object exchanges.
Internet Bridge: This model describes the use of AT commands and how to connect a mobile phone or a cordless modem to the internet via PC without the need of a DUN (Dial Up Networking) connection.
Lan Access: Based on the above model, the LAN Access usage model simply removes the AT commands and uses a LAN access point for a wireless connection to a LAN.
Synchronization: It allows various Bluetooth devices such as PDA's, Laptop's, Desktop PC's, Mobile Phone's to synchronize with one another using a common protocol and format.
Three in One Phone: The model explains how a simple phone can work as a cordless telephone being charged at a fixed pulse rate, how it can function as a walkie-talkie communicating with other similar phones and also act as a cell phone connected to the cellular network when moving around.
Ultimate Headset: This final fantasy device, though currently in the making, certainly adopts some of the existing features of Captain John Lu Picard's USS Enterprise Star Ship. This Bluetooth equipped device, probably a mobile phone, can act as a remote unit's audio input and output interface. It shall use AT commands to control the mobile phone and another stack to transfer speech for audio I/O.
Configuring the units for Linux can be a painstaking task. Though the kernel version that ships with RedHat 7.1 has support for Bluetooth, we recommend you download the latest kernel and build it in accordance with your Bluetooth device.
When wireless technologies first ushered in, their support was mainly limited to the products manufactured at Redmond's HeadQuarters. As developers realise the potential the penguin has inherited, they start looking out for other areas of interest. By the time Bluetooth came into existence, the SIG had made its point clear: do not restrict the development of Bluetooth technology to a proprietary operating system. Today, more than a dozen companies have ventured into the arena of "Bluetooth and Linux" with industry giants such as IBM leading the pack.
The first and foremost step each company concentrates on when developing Bluetooth based applications is, make a Bluetooth protocol stack for Linux. BlueZ has been developed by Quallcom and is now an Open Source project.
What is so different in BlueZ?
Bluetooth uses a set of well defined protocols. These protocols are standard for using any Bluetooth based device. Though some of the layers can be modified, the basic functions and commands remain the same.
Current version of BlueZ supports core Bluetooth protocols and layers. Offering flexibility by allowing RFCOMM to be integrated in the kernel (optional), mandatory presence of SDP in user-space, standard Unix socket interface and provision to use more than one Bluetooth device on a single machine. For those of us who cannot afford Bluetooth devices, we can realize our fantasies by using the HCI emulation daemon that comes with the package.
BlueZ:
Web Site : http://bluez.sourceforge.net
Platforms: glibc based Linux distro with kernel 2.4.x
Going on the same lines, another company named Axis is developing drivers for Bluetooth devices. Released under the Axis OpenBT Stack license and developed mainly for 2.0.33 kernel, the code can easily be used with higher versions of the kernel. Currently under development, the code allows interoperability only between the basic LAN profile, (PPP over RFCOMM) and simple Service Discovery Profile. Axis is concentrating on developing Bluetooth Access Point product which shall act as a hot spot for communicating between various devices and providing a link between wireless data networks and Bluetooth enabled devices.
Axis:
Web Site: http://developer.axis.com/
In addition, since BlueDrekar middleware can use any transport layer you can write your own Transport Drivers for Bluetooth and just insert the BlueDrekar on top of it to get going. This allows you to use UART (Universal Asynchronous Receiver Transmitter) as a reference transport driver to build drivers for USB based Bluetooth devices.
BlueDrekar
Web Site: http://www.alphaworks.ibm.com/aw.nsf/techmain/bluedrekar
Kernel Support : kernel 2.2.14 and 2.4.2
Security is a prime area of concern for any field. No company wants their valuable data caught from the thin air by an eavesdropper. Security has been given extreme importance right from the start in designing the core of Bluetooth. Techniques such as frequency hopping add some natural built-in security. Take a few more steps, and you will have a well secured network, protected from wandering eye balls.
Bluetooth has built in encryption and authentication and is thus secure in any environment. In addition to this, a frequency-hopping scheme with 1600 hops/sec. is employed. This is far quicker than any other competing system. This, together with an automatic output power adaption, both by the transmitter and the receiver, to reduce the range exactly to requirement, makes the system extremely difficult to eavesdrop.
The communicated data may have to be encrypted or the access to the device may have to be restricted by providing an authentication point. Both these functions are provided by the Bluetooth baseband. The application may itself encrypt its data for added security.
These procedures use four values:
As the keys have to be secret, they cannot be obtained by inquiry. The security procedure require a secret PIN to be known to the user(or stored by her application) for accessing a particular device.
The main steps in the procedure are:
tar zxvf linux-2.4.xx (xx is the version) /path/to/your/home/directory
If you need to know more about the HCI drivers and other software details required for your Bluetooth device, goto the following directory. /path/where/new/linux/exists/drivers/bluetooth
Note: The commands listed here are general commands and have been tried out on RedHat 7.1. This is not a how-to for upgrading/installing the kernel. Steps are given so that the reader can get an overview of how to get Bluetooth and the Kernel work in tandem. For details, please read the corresponding how-to's and man pages.
Anoto: A piece of paper, the Anoto pen and a web server, combine these and whatever you write on the patterned paper will be scanned by a digital eye. The system will make enough calculations to estimate the precise position of what you are scribbling out and transfer the information to your PDA or PC via the Bluetooth radio transreceiver.
Visit http://www.anoto.com for more information.
Ericsson R520
Model Name : Ericsson R520m
R520m is by far the most revolutionary mobile by Ericson. This 113 gm wonder has the unique distinction of being the last mobile both designed and manufactured by Erricson. It not only supports Bluetooth but also WAP and GPRS. It offers a decent data transfer rate of approx 100k through Bluetooth technology at a distance of 10 mtrs .
This hi-tech device offers more features than you will ever need and for just 249.99 pounds ;-) GO GET IT ! Medical Field
Though each technology changes our life in some way or the other, when the same device is used in the medical field to save/enhance human life, its significance has no bounds.
QRS Diagnostic, LLC and Advanced Medical Electronics Corporation are already developing Bluetooth enabled devices. Prototypes of the like of a Electrocardiograph, glucometer and weight scale are already under development.
Related LinksThough the authors of this article have taken utmost care to ensure that every thing related to Bluetooth is covered in a well structured manner, there may be instances where we may have skipped out some part or places where ambiguity prevails. For more information or in-depth knowledge about Bluetooth we recommend the following sites:
http://www.bluetooth.com
Anurag Phadke a.k.a. brainless is currently enjoying his 24/7 DSL connection on his new IBM Thinkpad i 1300 series. His other obsessions include playing Online Yahoo Games and whilst not online he loves to watch cartoons, Tom & Jerry being his favorite. He can be contacted at cbca@mantraonline.com