LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices


By drkstr at 2006-06-15 12:55
Intro.
I had a difficult time getting bluetooth working on my Slackware 10.2 system so I decided to document what I did to get it working. This guide will be broken into two parts. Part one will describe how to get the core bluetooth system working and part two will describe some basic usage.

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

If you have had success with any bluetooth clients that are not covered in this document, please let me know so I can add the,. Also let me know if you have any other recommendations or would like to report an error.

Please Note: In order to prevent the system reading parts of this as html code, spaces have been put between the < symbol and the > symbol. Make sure you don't leave the spaces in when running this on your own systems.

PART I
1. Download/install dbus
2. Download Bluez from CVS
3. Compile/install bluez-libs
4. Compile/install bluez-utils
5. Modify bluez-utils Build Before Makeing it Into a Package
6. Compile/install bluez-docs

PART II
1. Start the Bluez System
2. kdebluetooth
3. p3nfs



PART I

Needed 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 protocol 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.

Download the latest version here 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 called dbus-0.61, and then:

Code:
./configure --prefix=/usr
make
make install DESTDIR=< dbus build dir >
--prefix=/usr is required so bluez can easily find the dbus libraries and headers.

When finished, create your build directory into a Slackware package and install.


2. Download bluez from CVS

The CVS version of bluz has some added features and patches 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 list of modules. We will then need to check out each of the modules except libs2/utils2/obex (I will cover openobex in part II).
Create a directory called bluez-CVS-mm.dd.yy then 'cd' to the directory and run the following commands

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 repeat the last step for each of the needed modules.


3. Build bluez-libs

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

Create a temporary build directory called bluez-libs-CVS.mm.dd.yy. Then 'cd' to 'bluez-CVS/libs' and run the following:

Code:
./bootstrap 
./configure --prefix=/usr  #don't change this!
make
make install DESTDIR=< bluez-libs build dir >
When finished, create your build directory into a Slackware package and install.


4. Build bluez-utils

The next step will be to build the bluez-utils directory. Create a temporary build directory called bluez-utils-CVS.mm.dd.yy 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:

Run the following commands to compile:

Code:
./bootstrap
./configure --enable-all --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make
make install DESTDIR=< bluez-utils build dir >

5. Modify bluez-utils Build Directory

We will need to modify the bluez-utils build a little bit to make it compatible with Slackware.

First, we need to change the bluez init script. Rename < bluez-utils build dir >/etc/init.d to < bluez-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=rc.bluetooth
...
N=/etc/rc.d/$NAME
...
Open up < bluez-utils build dir >/etc/bluetooth/hcid.conf and change

Code:
...
passkey "< insert desired default pin >";
...
**NOTE**
If you are planning on using kdebluetooth you will also need to update hcid.conf as follows:

Code:
options {
 ...
  security user;
 ...
 pin_helper /opt/kde/lib/kdebluetooth/kbluepin;
}

device {
...
 class 0xff0100;
        
 # For some mobile phones you will have to tag your system
 # as a Audio/Handsfree device to be able to use your computer
 # as a Handsfree (only when connecting from the phone)
 # class 0xff0408;

 iscan enable; pscan enable;
 lm accept;
 lp hold,sniff,park;

}
**END NOTE**

When you are done changing the scripts, you will need to create a directory to put the documentation in:

Code:
mkdir < bluez-utils build dir >/usr/{doc,doc/bluez}

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.* < bluez-utils build dir >/usr/doc/bluez
When finished, create your build directory into a Slackware package and install.




PART II

1. Start the bluez System

I'm not going to cover all of the bluez 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, first, see if your dongle is recognized by running:

#hciconfig -a

The device name will most likely be hci0.

You can now 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


2. kdebluetooth

**HELP!**
My phone does not support kdebluetooth so I have no way of testing this. I was able to get it to run but need your help in debugging any errors. Please post any detailed errors you might come across and what you did if you were abel to fix it.
thanks!
**HELP!**

Kdebluetooth integrates bluetooth functionality into Konqueror. This can be a bit of a chore if you are running Slackware-10.2 since requires the KDE build implemented in Slackware-current. You can either rebuild your current KDE from the ground up with upgraded Qt support, or you can just upgrade to the KDE from Slack-current. This guide will cover the later.


2.1 Upgrade KDE:

**WARNING**
This might not be the technical or correct way of doing this, but this is what worked for me. Upgrading KDE requires you to upgrade some key parts of you Linux system. proceed at your own risk.
**WARNING**

First, we need to create a temporary directory and download all of the necessary packages from Slackware-current into this directory.

From a Slackware mirror, grab the following packages:
kde/*
x/*
l/glibc
l/libpng
d/gcc
d/gcc++
a/acl

Change your run level to run level 3 by editing your /etc/inittab, then switch to this run level by rebooting or running 'init 3'.

From the command line 'cd' to the download directory and run 'upgradepkg *.tgz' Please note that if you do not already have a package installed, 'upgradepkg' will not install it. If you did not do a full install, you will need to manually install with 'installpkg < package-name >.tgz' You may not need all of the add-ons from the KDE directory but make sure all of the core packages get installed (kdelibs,kdebase,kdedevel,qt, etc.). Also note that acl is a new package that is not in 10.2 so you will have to install this with 'installpkg'

After everything is done, change your default run level back to 4 (if this is what you prefer) then run 'init 4' to get into a new (and much better looking) KDE.


2.2 OpenOBEX:

OpenOBEX is a required library needed by kdebluetooth. Create a directory called openobex-CVS-mm.dd.yy and run the following commands form that directory:

Code:
cvs -d:pserver:anonymous@openobex.cvs.sourceforge.net:/cvsroot/openobex login
#< enter at password prompt >
cvs -z3 -d:pserver:anonymous@openobex.cvs.sourceforge.net:/cvsroot/openobex \
  co -P openobex
Make a temporary build directory called openobex-1.2 then 'cd' to the openobex source directory. Run the following commands to build:

Code:
./bootstrap
./configure --prefix=/usr
make
make install DESTDIR=< obex build dir >
When finished, create your build directory into a Slackware package and install.


2.3 Unsermake:

Unsermake is required to build kdebluetooth.

Create a folder to download the CVS and from this directory run:

Code:
svn co svn://anonsvn.kde.org/home/kde/trunk/kdenonbeta/unsermake/
Then move the downloaded directory to '/usr/local/unsermake' and add it to your path:

export PATH=$PATH:/usr/local/unsermake


2.4 Install Kdebluetooth:

First, get kdebluetooth-1.0_beta1 from here then extract it to your source directory. Then download this patch and save it in the source directory as obexfix-1.1.2.patch

create a temporary build directory called kdebluetooth-1.0.beta1 then 'cd' to the kdebluetooth source directory and run the following commands:

Code:
patch -Np1 -i obexfix-1.2.patch
make -f admin/Makefile.common cvs
make -f Makefile.cvs
./configure --prefix=$(kde-config --prefix)
make
make install DESTDIR=< kdebluetooth build dir >
When finished, create your build directory into a Slackware package and install.

run 'kbluetoothd' to start start the service.


3. P3nfs

p3nfs is an a small CLI program that mounts normally unsupported devices in Linux. It uses a daemon program for your Linux box, and an nfs client for your phone.

Visit http://www.koeniglich.de/p3nfs.html to download the latest version. I will not reproduce the instructions located in doc/bluetooth.linux since they are pretty well covered. The only think I would like to add is

A) you do not need to recompile the binaries, look in the 'bin' for pre-compiled binaries.
B) the default port is 13 but this is in use on a lot of devices (my Series 80 phone had a problem with this) To fix, modify nfsclient.ini on the phone to change the default port.


If this was any use to you, please let me know. I would also like to hear some suggestions on anything you would like to see added.

Have fun using bluetooth!
...drkstr

**edit**
06/09/06 - added in necessary kernel options. (forgot to mention this)
06/12/06 - added instructions for kdebluetooth
06/14/06 - updated formating
06/14/06 - updated hcid configuration for kdebluetooth
06/14/06 - added section for p3nfs
06/26/06 - workaround for html code

While every effort is made to keep this updated and up to date, please visit http://www.drkstr.org/HOWTO-bluetooth.html for the latest version.

by drkstr on Thu, 2006-06-15 16:23
This thread is to discuss the article titled:
Bluetooth in Slackware HOWTO

by drkstr on Thu, 2006-06-15 20:15
Quote:
Originally Posted by drlouis
I looked but didn't see, I assume this requires a 2.6 kernel? I'm still running 2.4, planning on compiling a 2.6, but have been too chicken to try since I dont have time right now to trouble shoot if it goes badly.
Well I don't have to much experience with the 2.4 kernel since compiling the latest kernel was one of the first few things I did when I started using Linux (per the advice of my friend).

I belive bluez will still work with a 2.4 kernel, but I am not positive. When you build bluez-utils it will build a kernel modules for you if it does not detect one already. You might want to give the 2.6 kernel a try though. You will find it supports hardware much better then the 2.4 kernel.

Let me know if you get it working with 2.4 kernel and if you had to do anything extra, this way I can add it to the tutorial.

thanks!
...drkstr

by _gnomm on Sun, 2006-06-18 14:48
ok i upgraded KDE to 3.5.3 but now i have a problem:

KDEInit could not launch 'noatun'.

anyway...

i downloaded Unsermake and

Quote:
First, get kdebluetooth-1.0_beta1 from here then extract it to your source directory. Then download this patch and save it in the source directory as obexfix-1.1.2.patch
there is a problem with the links i can't download the pathch!! the same is with the other links!!!

by drkstr on Mon, 2006-06-19 14:23
Hmmm, it look slike I lost a lot of formatting, and all my links broke, when they copied it over to the Tutorial section. I can not edit the article directly but you can view the updated guide on my website here I just tested all the links, but let me know if any are broken.

Quote:
KDEInit could not launch 'noatun'.
The upgrade seems to have broken the KDE sound system (arts). I haven't figured out why yet, but in the meantime, use a media player that does not depend on arts. I have arts disabled on my system anyways since it's known to be quite buggy and CPU intensive. Try using alsa instead.

regards,
...aaron

**edit**
XMMS is a good media player (one of many) that does not rely on arts. Try using that until I can figure out why arts is broken.

by drkstr on Tue, 2006-06-20 11:32
You will need to upgrade the following packages from slackware-current to use the KDE sound system and any application that depend on them:

a/aaa_elflibs
l/arts
l/audiofile
l/libao
l/libmad
l/libogg
l/libvorbis

Just download them into a folder anr run
Code:
upgradepkg --install-new *.tgz
And it should work okay from theere.

Good catch _gnomm!
...aaron

by _gnomm on Tue, 2006-06-20 13:15
ok, thanx a lot!!!! i'll try it soon!!!

by Laban on Thu, 2006-07-06 08:40
Quote:
Go to the CVS repository browser to view a list of modules. We will then need to check out each of the modules except libs2/utils2/obex (I will cover openobex in part II).
Create a directory called bluez-CVS-mm.dd.yy then 'cd' to the directory and run the following commands
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 repeat the last step for each of the needed modules.
Does that mean that all of the following modules should be downloaded / built?
  • Bluehood
  • bluefw
  • doc
  • firmware
  • gnome
  • hcidump
  • hciemu
  • kernel
  • libs
  • packages
  • pan
  • rfcomm
  • sdp
  • utils
  • utils2

by drkstr on Thu, 2006-07-06 09:55
Welcome to LQ!

Quote:
Does that mean that all of the following modules should be downloaded / built?
You can skip libs2/utils2, kernel if you compiled in support yourself, and gnome unless you are using it as a desktop manager. Same goes for packages. However, I would recommend just checking out all the modules and following the build directions to make sure you don't miss anything.

regards,
...aaron

by Laban on Fri, 2006-07-07 03:30
Checked the list, found out that the only usable ones are libs, utils, firmware, hcidump and doc. The rest is empty.

by drkstr on Fri, 2006-07-07 14:05
empty? I don't think so. Did you go though the repository browser? Not only are they not empty, they are required for certain bluez functionality.

regards,
...aaron


  



All times are GMT -5. The time now is 11:07 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration