This article is spawned from the following eeeuser.com discussion, all queries and reports of success and failure, should be reported there.
The following is an in depth guide to setting up a2dp (stereo bluetooth sound) under debian based systems xandros and *buntu (tested on 7.10), it has been tested and works under the default xandros operating system, this has been tested with 4 different bluetooth chipsets and so if you follow it correctly it should work for you.
NOTE: This driver will not work while using a bluetooth mouse, hidd should be disabled when using A2DP. Also, it is probably not a good idea to transfer files over bluetooth while using this.
Skip this section if you are not new to GNU/Linux.
Press ctrl+alt+t to get a terminal and Type “ls -a” and press enter, to see all files in a directory, now type “ls” and press enter, to see the only non-hidden files now type “ls Tr” and press tab instead of enter.
Notice how the console auto completes, this works for all other commands too and really speeds navigation. If there are two directories that start with the same letter, it will list those directories if you press tab twice, so you can make a choice which one to go to. For example try “cd /d” and pressing tab twice, the console lists the ”/disks/” and ”/dev/” dirs.
To copy and paste into the terminal highlight the text that you want to copy to the console, then click on the terminal window and use shift+ins or press both mouse keys at the same time (middle mouse key) and the highlighted text should appear in the terminal.
If you want to use traditional copy and paste (aka gui paste) you should use konsole instead. Simply type konsole in uxterm to start a console with paste support.
Add the following repository to ”/etc/apt/sources.list” (you may already have done this step if you have edited this file before):
deb http://xnv4.xandros.com/xs2.0/upkg-srv2 etch main contrib non-free
Using the command;
sudo kwrite /etc/apt/sources.list
Execute this command at the terminal (ctrl+alt+t to get to the terminal)
Then in the same terminal, install the required packages by executing the following commands:
sudo -i
apt-get update
apt-get install build-essential libbluetooth2-dev automake autoconf cvs libtool libasound2-dev libdbus-1-dev libdbus-glib-1-dev bluez-gnome
exit
This downloads a list of available packages from the repository you setup earlier, then installs the dependancies.
Execute the following commands to download the source of the packages and compile them for the EEEPC, when prompted for a password just hit return;
Installing SBC;
cvs -d:pserver:anonymous@sbc.cvs.sourceforge.net:/cvsroot/sbc login
cvs -d:pserver:anonymous@sbc.cvs.sourceforge.net:/cvsroot/sbc co sbc
cd sbc
./bootstrap
./configure --prefix=/usr
make
sudo make install
cd ..
Installing Bluetooth alsa modules;
cvs -d:pserver:anonymous@bluetooth-alsa.cvs.sourceforge.net:/cvsroot/bluetooth-alsa login
cvs -d:pserver:anonymous@bluetooth-alsa.cvs.sourceforge.net:/cvsroot/bluetooth-alsa co plugz
cd plugz
./bootstrap
./configure --prefix=/usr --sysconfdir=/etc
make
sudo make install
sudo cp alsa-plugins/a2dpd/sample.a2dprc /root/.a2dprc
You will need to install this small icon pack to use the bluetooth-applet;
wget http://cbebop.com/stuff/gbico.tar.bz2
tar -xvjf gbico.tar.bz2
cd gbico
chmod 777 install
./install
This checks for the icons and installs them if they don't exist, thanks goes to lchef, for pointing this out and thanks goes to va3uxb (Stephanie) for pointing out that not only the 2g but also the 4g and 8g models require this iconset, also pointed out mistakes in the icon theme which are now fixed.
All of the required software is now on your machine. Now continue to configuration.
Start the required dbus and bluetooth services first;
sudo /etc/init.d/dbus start
sudo /etc/init.d/bluetooth start
Next check that your bluetooth adapter has been detected using this command;
sudo hciconfig
The output of this command should look like this;
hci0: Type: USB
BD Address: 00:09:DD:50:76:5C ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:3615531 acl:47 sco:0 events:516258 errors:0
TX bytes:164399408 acl:774286 sco:0 commands:29 errors:0
If your bt adapter is listed as being down, try using the following command a few times and see if that brings the adapter up.
sudo hciconfig hci0 reset
When hciconfig is reporting the adapter as up and running, start the bluetooth applet using this command as user not root;
bluetooth-applet &
If you have followed the above steps and the adapter is still pluged in a bluetooth symbol should appear in the system tray;
If the icon does not appear in the system tray do the following commands (to restart bluetooth-applet), as user not root;
killall bluetooth-applet bluetooth-applet &
If that fails then do this command;
sudo hciconfig
Check that the card is listed as up if it isn't try “hciconfig hci0 reset” a couple of times and check hciconfig again. when you get the adapter listed as up restart the bluetooth applet again.
When the bluetooth icon is showing put the headset into discoverable mode and scan for the headset with the command;
hcitool scan
write down the mac address of the headphones, the mac address should be similar to this 00:11:67:00:00:00. Instructions on putting the headset into discoverable mode should be included in the manual. Example output;
Scanning ...
00:1A:75:15:A9:C0 W850i
00:0D:3C:A0:95:0E i.Tech BlueBAND
In this example my heaset is the second device, “i.Tech BlueBAND” and so the mac address I would use is “00:0D:3C:A0:95:0E”.
Edit the “address=” part of the ”/root/.a2dprc” file to contain this mac using kwrite (should be about the 4th line from the bottom of the file.)
sudo kwrite /root/.a2dprc
For reference here is my config file;
rate=44100
sbcbitpool=32
flags=0
enablereversestereo=1
enableautoconnect=1
timeout=20
enableavrcp=0
enablerereadconfig=0
enabledebug=1
enablestdin=0
enableredirectalsa=0
address=00:0D:3C:A0:95:0E
alsaoutput=
Now we edit/create the file ”/root/.asoundrc” to allow use of the a2dpd device.
sudo kwrite /root/.asoundrc
Add this to it;
pcm.a2dpd {
type a2dpd
}
Copy the /root/.asoundrc file so your normal user has access to the device, make sure you are not root with the “whoami” command if you are root use the “exit” command to get back to the user profile. Execute these commands, to copy the file;
cd ~ cat /root/.asoundrc > .asoundrc
In the terminal execute the following command;
sudo a2dpd
It is normal for this command to output alot of text, don't take that as a sign that it is not working. You will also notice that it has taken over the console. This isn't an issue as we will need too see the output generated by this program, so you must keep this console open. If it reports an Error and exits then you have problems, please post about these errors in the forum post mentioned at the start of this article, please include the output of a2dpd.
In a seprate user not root terminal, cd to a diretory with a .mp3 or .ogg file in it. Put the headset into discoverable mode and execute the following command;
mplayer -ao alsa:device=a2dpd test.mp3
(command to be executed while headset is in discoverable mode)
where test.mp3 is the file that you wish to play, this pipes the sound to the a2dpd program which inturn sends it to the headset, which then asks for a password. The bluetooth-applet should start flashing and clicking it will bring up the password dialog for your headset;
The password for the headset should be included in the headsets handbook, my password was “8888” but from what I have heard most use 0000. After a few seconds you should start to hear the mp3 playing.
If that worked you have done it, welldone. The hardware side is sorted now all you have to do is set up for boot and your media players and you are finished.
It really is up to you how you want this service to start but here are a few suggestions, which will be covered in this section;
If using Advanced mode or an ubuntu variant skip this section.
Add the following lines after wapmonitor &, using sudo kwrite /usr/bin/startsimple.sh
sudo /etc/init.d/dbus start sudo /etc/init.d/bluetooth start sudo a2dpd -s & bluetooth-applet &
When you reboot your computer, the new settings will be in use. Go to the setting media player section to get your favourite player working with these setting.
If using an ubuntu variant skip this section.
to set a2dp to auto start in advaced mode do the following commands;
cd ~/.kde/Autostart kwrite btstart
Add this to the btstart file;
#!/bin/bash sudo /etc/init.d/dbus start sudo /etc/init.d/bluetooth start sudo a2dpd -s & bluetooth-applet
Make the file executable;
chmod 777 btstart
When you reboot your computer, the new settings will be in use. Go to the setting media player section to get your favourite player working with these setting.
Setup bluetooth-applet to start when ubuntu starts
the execute the following commands;
sudo -i echo '#!/bin/bash' > /opt/a2dp ; echo '' >> /opt/a2dp ; echo 'a2dpd -s &' >> /opt/a2dp ; echo '' >> /opt/a2dp ; chmod 777 /opt/a2dp
Add that script in the same way, you added bluetooth applet. Use the “Add” button. The script is located in the /opt/ directory.
NOTE: the previous section could use some improvement.
In the following section We will setup various applications to use the a2dpd device, the following programs are able to use the device;
to get amarok working with the headset go to;
Settings > Configure Music Manager > Engine
change the “Output plugin” to alsa and click apply. Then under Alsa Device configuration set “Stereo” to “a2dpd”. You have to type a2dpd in…
If Amarok fails to find the device it will change the settings to default, so watchout for that.
To get the device to work with audacious or xmms, go to;
Preferences > Audio > Output Plugin Preferences
and under Audio device:
Type a2dpd
restart audacious/xmms for the settings to take effect.
To get rhythmbox and banshee (banshee failed to install on my system) working with the headset do the following commands;
gconftool -t string --set /system/gstreamer/0.10/default/musicaudiosink 'alsasink device=a2dpd' gconftool -t string --set /system/gstreamer/0.10/default/audiosink 'alsasink device=a2dpd'
Then start Banshee/Rhythmbox.
(remember to turn the volume up in the app), I made the mistake of thinking it didn't work because the apps volume was turned down, lol.
Getting SMplayer to work with the new device, In SMplayer go to;
Options > Prefrences > Advanced
and under the “options:” type the following;
-ao alsa:device=a2dpd
(That is the option you would use in regular mplayer as well.)
To get VLC to work with a2dp, s a normal user do “kwrite ~/.vlc/vlcrc” and change the value of “alsadev=” to;
alsadev=a2dpd
If their is a ”#” infront of alsadev=, remove the hash sign. Note the alsadev setting is near at the end of the file.
If you get you head set working please add it to the following list;
| Brand Name | Model | Details (quality, distance, etc) | Link to report | |
|---|---|---|---|---|
| iTECH | i-HT820 | Very good quality, I get about a 4 meter radius from a 100m internal bluetooth hack. | found at Ebay | |
| Zoom | iHiFi stereo | Working | Available at Amazon | |
| Jabra | BT8010 | I've been happy with it so far | This is the report? | |
| Nokia | BH-501 | Works perfect, but with Bluetooth v1.2 of headset 4 meter raduis | … | |
| BlueAnt | X-5 | Works perfectly | http://www.blueant.com.au | |
| Parrot | DS1120 | Works fine | ||
| Insignia | NS-BTHDP | Works well | this is the report | |