This article illustrates how to install a Bluetooth USB adapter on the Acme boards and how to use it to comunicate with other Bluetooth devices using the Linux standard utilities
The default Linux Debian distribution has the Bluetooth driver already installed so plugging a Bluetooth USB adapter and typing dmesg you will obtain the following messages:
debarm:~# dmesg ... usb 1-1: new full speed USB device using at91_ohci and address 2 Bluetooth: Core ver 2.15 NET: Registered protocol family 31 Bluetooth: HCI device and connection manager initialized Bluetooth: HCI socket layer initialized Bluetooth: Generic Bluetooth USB driver ver 0.6 usbcore: registered new interface driver btusb debarm:~# lsusb Bus 002 Device 002: ID 1131:1004 Integrated System Solution Corp. Bluetooth Device Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub debarm:~#
Bluez is the Official Linux Bluetooth protocol stack (http://www.bluez.org/) and you need to install it to do any further action with Bluetooth. This stack is available as standard Debian package with the name bluez-utils so to install it simply type:
debarm:~# apt-get update ... debarm:~# apt-get install bluez ...
then type again:
debarm:~# dmesg ... Bluetooth: L2CAP ver 2.15 Bluetooth: L2CAP socket layer initialized Bluetooth: RFCOMM TTY layer initialized Bluetooth: RFCOMM socket layer initialized Bluetooth: RFCOMM ver 1.11 Bluetooth: BNEP (Ethernet Emulation) ver 1.3 Bridge firewalling registered Bluetooth: SCO (Voice Link) ver 0.6 Bluetooth: SCO socket layer initialized
Turn on you mobile phone and enable on it the Bluetooth features.
On the FOX command line type hcitool scan to discover the Bluetooth devices visible from your board:
debarm:~# hcitool scan Scanning ... 00:25:48:FC:98:6D Sergio
On this list Sergio is my own mobile phone name and 00:25:48:FC:98:6D is its Bluetooth unique address (learn more about hcitool...).
Let's try to check which services are available on my mobile phone typing:
debarm:~# sdptool search OPUSH 00:25:48:FC:98:6D Inquiring ... Searching for OPUSH on 00:25:48:FC:98:6D ... Service Name: OBEX Object Push Service RecHandle: 0x1000a Service Class ID List: "OBEX Object Push" (0x1105) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 6 "OBEX" (0x0008) Language Base Attr List: code_ISO639: 0x454e encoding: 0x6a base_offset: 0x100 Profile Descriptor List: "OBEX Object Push" (0x1105) Version: 0x0100
OBEX is the first service we'll use to do the first experiment and it is on the Channel 6.
OBEX (abbreviation of OBject EXchange) is a communications protocol that facilitates the exchange of binary objects between devices. OpenOBEX, an open source implementation of the OBEX protocol, is used on the Debian Linux distribution.
Let's try to use OBEX to send an image to our Bluetooth mobile phone.
Download on your FOX this image:
wget http://www.acmesystems.it/download/examples/tuxcase.jpg --2010-08-20 13:55:19-- http://www.acmesystems.it/download/examples/tuxcase.jpg Resolving www.acmesystems.it... 188.8.131.52 Connecting to www.acmesystems.it|184.108.40.206|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 4710 (4.6K) [image/jpeg] Saving to: `tuxcase.jpg' 100%[======================================>] 4,710 --.-K/s in 0.07s 2010-08-20 13:55:20 (69.0 KB/s) - `tuxcase.jpg' saved [4710/4710] debarm:~#
Now install ObexFtp an utility to transfer files using the OBEX protocol (learn mode about ObexFtp...).
debarm:~# apt-get install obexftp ...
then send the Tux to your mobile phone typing:
debarm:~# obexftp --nopath --noconn --uuid none --bluetooth 00:25:48:FC:98:6D --channel 6 -p tuxcase.jpg Suppressing FBS. Connecting..\done Tried to connect for 628ms Sending "tuxcase.jpg"...|done Disconnecting../done
$ make ARCH=arm menuconfig [*] Networking support ---> <*> Bluetooth subsystem support ---> --- Bluetooth subsystem support [*] L2CAP protocol support [ ] SCO links support (NEW) <*> RFCOMM protocol support [ ] RFCOMM TTY support (NEW) < > BNEP protocol support (NEW) < > HIDP protocol support (NEW) Bluetooth device drivers ---> <*> HCI USB driver < > HCI SDIO driver <*> HCI UART driver [ ] UART (H4) protocol support (NEW) [ ] BCSP protocol support (NEW) [ ] Atheros AR300x serial support (NEW) [ ] HCILL protocol support (NEW) < > HCI BCM203x USB driver (NEW) < > HCI BPA10x USB driver (NEW) < > HCI BlueFRITZ! USB driver (NEW) < > HCI VHCI (Virtual HCI device) driver (NEW) < > Marvell Bluetooth driver support (NEW) < > Atheros firmware download driver (NEW)
Atmel© Certified Partner
Acme Systems provides this documentation "as is" without warranty or guarantees of any kind. We not provide any direct support for the Open Source preinstalled software but, through these pages and forum posts, all of the information required to obtain the sources, install, use and update the Open Source software that can be run on the Acme boards. Please note that all of the preinstalled software, used on the Acme Systems products, are Open Source so you have to check the license terms provided by the authors (usually the GPL) before using it in any commercial or non-commercial product, by yourself. Before to contact us please note that WE ARE MAINLY HARDWARE DESIGNERS and NOT LINUX GURUS and therefore could be better to post your questions to the Acme Systems forum and ensure that all of the site contributors and large software community can read and reply to your questions.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.