Back to the index page  
  FAQ    Search    Memberlist    Usergroups     fChat    Register   Profile   Log in to check your private messages   Log in 
Linux Bluetooth Mini HOWTO

 
Post new topic   Reply to topic    HelpTechPro.net Forum Index » Linux Hardware View previous topic :: View next topic  
Linux Bluetooth Mini HOWTO
 PostPosted: Fri Jun 09, 2006 4:39 am Reply with quote  
Message
  MonkeySeeMonkeyDo
Linux Moderator

Joined: 09 Jun 2006
Posts: 4

Intro.
This guide is meant for BSD-Style systems such as Slackware. If you have a Debien based system, it will still work, you just do not have to modify the build at all. Bluetooth is supported through the bluez project which is written for debien based systems.

In this guide, I will be using a feature of Slackware which allows you to create packages from a source build. I am not going to cover this process in detail, but you can read this guide for more information on building packages. Building bluez into a package is not ony good software management practice, but will also allow us to modify the build before installing it.

If you are not running Slackware, you can still download their package manegment system and install it on your distro. Just get the source from a Slackware mirror and compile it to suit yoru needs. The package you would need is called pkgtools.

Quick Overview.
Download/install dbus
Download bluez from CVS
Compile/install bluez-libs
Compile/install bluez-utils
Modify bluez-utils build before makeing it into a package
Compile/install bluez-docs

Required Kernel Support

Code:
<M> Bluetooth subsystem support
   <M> L2CAP protocol support
   <M> RFCOMM protocol support
     <*> RFCOMM TTY support
    Bluetooth device drivers --->
     <M> HCI USB driver



1. Install dbus.

dbus is a system that handles system messages between applications and your hardware. The dbus header files are needed to compile bluez so you will need to get this first.

[url=Download the latest version http://dbus.freedesktop.org/releases/] here[/url], then extract the source and build it into a Slackware package.

A standard build will work fine for bluez but use './configure --help' for a full list of options if you plan on using it for anything else. Otherwise, create a temporary build directory for dbus called dbus-0.61 (or whichever version you have), and then:
Code:
./configure --prefix=/usr
make
make install DESTDIR=<build dir>

--prefix=/usr is required so bluez can easily find the dbus libraries and headers.
note: you need to pass the full directory path to 'DESTDIR=', no short cuts (IE '../dbus-0.61' or '~/dbus-0.61'

When this is done, 'cd' to the build directory and turn it into a SLackware package with 'makepkg' (don't forget the slack-desc file!) When finished, install it to your system.


2. Download bluez from CVS

The CVS version of bluz has some added features and patched that the 2.25 release does not have. I found it easier to get the CVS version working on my Slackware system so we will need to get it from there.

Go to the CVS repository browser to view a few list of modules. We will then need to check out each of the modules except libs2 & utils2. Libs2 and utils2 are the first release of bluez and are now out dated and will not work with the new version. Create a directory called bluez-CVS-<date> then 'cd' to the directory and run the following
Code:
cvs -d:pserver:anonymous@cvs.bluez.org:/cvsroot/bluez login
#<hit enter at the password prompt>
cvs -d:pserver:anonymous@cvs.bluez.org:/cvsroot/bluez co -P modulename

You will need to repeate the last step for each of the modules.


3. Build bluez-libs

We will need to build and install bluez-libs first in order to properly compile bluez-utils.

Create a temporary buld directory for bluez-libs. I just called it bluez-libs-2.25 but you can name it acording to your CVS version if you wish. Then 'cd' to '<bluez-CVS dir>/libs' and run the following:
Code:
./bootstrap  #generates config file
./configure --prefix=/usr  #so bluez-utils can find the libraries
make
make install DESTDIR=<bluez-libs build dir>

When finished compiling, 'cd' to the build directory, turn it into a Slackware package, then install it to your system.


4. Build bluez-utils

The next step will be to build the bluez-utils directory. Create a temporary build directory called 'bluez-utils-2.25' then 'cd' to '<bluez-CVS>/utils'. In this guide, I will be enabling all of the bluez features. If you would only like to enable the specific ones you will need, use './configure --help' for a full list of options. To compile:
Code:
./bootstrap  #generates configure script
./configure --enable-all --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make
make install DESTDIR=<utils build dir>



5. Modify bluez-utils Build Directory

We will need to modify the bluez-utils build a little bit to make it into a good Slackware package.

The first thing is to change the bluez init scrip since it was made for a debien based system. First thing we need to do is rename the '<utils build dir>/etc/init.d' to '<utils build dir>/etc/rc.d'. Then rename the 'bluetooth' file in that directory to 'rc.bluetooth'. You will also need to modify this file a little bit to reflect the change.
Code:
[...]
NAME=[B]rc.[/B]bluetooth
[...]
N=/etc/[B]rc.d[/B]/$NAME
[...]


Next, open up '<utils build dir>/etc/bluetooth/hcid.conf' and change
Code:
passkey "[B]<desired default pin>[/B]";


When you are done changing the scripts, you will need to build a directory to put the documentation in:
Code:
mkdir <utils build dir>/usr/doc
mkdir <utils build dir>/usr/doc/bluez-2.25


The bluez documentation is created by compiling it in the source directory. You will need the 'doxygen' package in order to do this.

'cd' to '<bluez-CVS>/doc/howto', then run:
Code:
./configure
make
cp bluezhowto.* <utils build dir>/usr/doc/bluez-2.25


When you are done setting up the build directory, turn it into a SLackware package and install.


6. Basic Usage

I'm not going to cover all of the usage since it is covered in the howto documents you just built, but here are a few quick things to get you started.

To start the bluetooth system, just run as root:
Code:
#sh /etc/rc.d/rc.bluetooth start


To bring the bluetooth device online, you will first need to see the device name with
Code:
#hciconfig -a

It will most likley be hci0. You can then bring it online with
Code:
#hciconfig hci0 up


If you want this to start at boot up, add these lines to your '/etc/rc.d/rc.local'
Code:
PATH=/bin:/sbin:/usr/bin:/usr/sbin
/etc/rc.d/rc.bluetooth start
hciconfig hci0 up


To use the rfcomm device you will need to enable RFCOMM Support and RFCOMM TTY support in your kernel. Then run the following as root:
Code:
hcitool inq #get adr to mobile device
rfcomm bind /dev/rfcomm0 <BDADDR> <port> #create device node

The <BDADDR> is the address from the previous command, and <port> is the port your phone is listening on. This will be 13 on a lot of devices.

Once you have the bluez base system, you can download and use GUI bluetooth apps such as plptools or Kandy.

Have fun using bluetooth!
...monkey

**edit**
06/10/2006 - added required kernel support
_________________

View user's profile Send private message Send e-mail Visit poster's website
Post new topic   Reply to topic    HelpTechPro.net Forum Index » Linux Hardware

Page 1 of 1
All times are GMT


Display posts from previous:

  

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum