Getting On-line Anywhere with Bluetooth and GPRS
Bluetooth and General Packet Radio Service (GPRS) are used widely today to make devices on the move Internet accessible. Bluetooth is a low-range wireless technology that can be made a part of almost any device due to its low cost and power consumption, GPRS offers always-on connectivity to the Internet.
Bluetooth and GPRS can provide standalone network connectivity to your PDA or laptop. Bluetooth roaming enables continuous connectivity when you move your device from one floor of your building to another, and GPRS roaming preserves your Internet connection when you are on the road and move from one service provider's area to another. Figure 1 describes some of these scenarios.
Because Linux runs on a variety of embedded devices including Bluetooth-aware consumer electronics devices, GPRS cell phones and wireless-enabled PDAs, a discussion on how Linux works with Bluetooth and GPRS can be helpful in using and designing such devices.
Bluetooth is a protocol for wireless communication using radio frequency and was conceived as a replacement for cables. It supports speeds of 723 kbps(asymmetric) and 432 kbps (symmetric) and it can be used to transfer both data and voice. Bluetooth devices have a range of about 10 meters (30 feet).
BlueZ is the official Linux Bluetooth protocol stack. Although there are other popular Bluetooth implementations on Linux, such as the Affix stack, the rest of this section is devoted to BlueZ.
BlueZ supports the core Bluetooth protocols, including host control interface (HCI), logical link control and adaptation protocol (L2CAP), personal area networking (PAN), service discovery protocol (SDP), synchronous connection oriented (SCO) audio and serial port emulation (RFCOMM). It also comes bundled with a bunch of user space dæmons and configuration tools.
BlueZ supports the different user profiles described by the Bluetooth specification. BlueZ BNEP (Bluetooth Network Encapsulation Protocol) implements Ethernet emulation, which lets TCP/IP run directly over Bluetooth. The BNEP module, together with a user mode dæmon called pand implements Bluetooth PAN. BlueZ RFCOMM allows serial port applications, such as terminal emulators, and protocols, such as point-to-point protocol (PPP), to run unchanged over Bluetooth. The RFCOMM module, along with a user mode dæmon called dund implements Bluetooth dial-up networking.
The Bluetooth specification defines the use of UART and USB transport mechanisms to transfer HCI packets between a Bluetooth device and a host system. For UART interfaces, the main protocols available to encapsulate HCI packets are H4/UART and Blue Core Serial Protocol (BCSP). Whereas H4 serves as the standard method for transmitting Bluetooth data over a UART interface, BCSP is a proprietary protocol from CSR that supports error checking and retransmission. BlueZ supports both H4 and BCSP. If the Bluetooth chip used on your board has a UART interface to the host processor and is programmed to encapsulate HCI packets using BCSP, you need to inform the BlueZ stack of this. Do so using hciattach: hciattach ttySx bcsp, where x is the UART channel number connected to the Bluetooth chip. The BlueZ UART link driver hci_uart now talks to the chip using BCSP and passes the Bluetooth data to and from the BlueZ stack.
BlueZ also has a link driver hci_usb, which supports USB Bluetooth devices. The driver uses the services and data structures provided by the Linux kernel USB core to manage data transfers asynchronously between the host and the Bluetooth USB device. As per the Bluetooth specification, the hci_usb driver uses the corresponding USB pipes—control, interrupt, isochronous or bulk—to transport different types of Bluetooth data—HCI commands, HCI events, SCO audio or asynchronous connectionless data). The Belkin Bluetooth USB adapter is an example Bluetooth USB device that works with BlueZ.
BlueZ also supports the transfer of audio data to devices such as Bluetooth headsets. An application on the host Bluetooth device uses BlueZ SCO APIs to send audio data to the headset. The audio data pumped through the SCO APIs has to be in a format understood by the headset, for example, A-law pulse code modulation (PCM) format is used for the Sony Ericsson HBH-30 Bluetooth headset. If the Bluetooth chipset on your host device has a PCM interface connected to another audio source, you might have to configure the chipset to receive the SCO audio over its HCI interface rather than over its PCM interface.
BlueZ utilities can be used to set up Bluetooth connections. For example, the hcitool utility can be used to initiate an inquiry process and discover the names and Bluetooth addresses of units within range. You then can set up a PAN or a dial-up connection to a discovered Bluetooth device using pand or dund. The sdptool program can be used to register or search for a service, say, printing or networking. The important BlueZ user space dæmons, utilities and kernel modules, along with a brief description of each, are listed below:
hciconfig --a: examine the HCI interface.
hcitool -f hci0 scan --flush: discover other Bluetooth devices within range.
hciattach ttySx any [baud]: attach an encapsulation method (H4, BCSP), baud rate and a flow control mechanism to the serial port connected to the Bluetooth device.
hcidump: HCI sniffer.
hcid: HCI dæmon.
/etc/bluetooth/hcid.conf: HCI dæmon configuration file used by hcid that specifies link mode (master or slave), link policy, inquiry and scan mode and so on.
/etc/bluetooth/pinDB: BlueZ PIN database.
sdpd: service discovery protocol dæmon.
pand: runs TCP/IP over Bluetooth (--listen for the server, --connect<bluetooth_address> for the client).
/etc/bluetooth/pan/dev-up: pand invokes this script when bringing up TCP/IP. This script can contain a command like ifconfig bnep0<ip_address>up to configure the Bluetooth interface with an IP address.
dund: runs PPP over Bluetooth RFCOMM (--listen for the server, --connect<bluetooth_address> for the client).
BlueZ kernel modules:
bluez: the BlueZ core layer.
l2cap: L2CAP implementation.
hci_uart: UART transport driver (supports H4/BCSP).
hci_usb: USB transport driver.
bnep: Ethernet emulation (used along with pand).
rfcomm: serial port emulation.
SCO: support for voice transport over Bluetooth.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- SUSE LLC's SUSE Manager
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- My +1 Sword of Productivity
- Non-Linux FOSS: Caffeine!
- Managing Linux Using Puppet
- Doing for User Space What We Did for Kernel Space
- SuperTuxKart 0.9.2 Released
- Parsing an RSS News Feed with a Bash Script
- Google's SwiftShader Released
- Rogue Wave Software's Zend Server
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide