This article illustrates how to install a Bluetooth USB adapter on the CORE9G25 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:~#
Install Bluez
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
Discover the Bluetooth devices in range
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.
Send an image to your mobile phone
Let's try to use OBEX to send an image to our Bluetooth mobile phone.
Download on your FOX this image:
typing:
wget http://www.CORE9G25systems.it/download/examples/tuxcase.jpg --2010-08-20 13:55:19-- http://www.CORE9G25systems.it/download/examples/tuxcase.jpg Resolving www.CORE9G25systems.it... 78.47.10.198 Connecting to www.CORE9G25systems.it|78.47.10.198|: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
Enable the Linux Kernel Bluetooth support on CORE9G25
$ 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)
Documentation Terms of Use
The Acme Systems srl provides this Debian system development and user manual.
The origin of these doc came from the website: http://www.acmesystems.it
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.