11.07.2015 Views

Configuring Linux for a Bluetooth stereo headset - Linux Magazine

Configuring Linux for a Bluetooth stereo headset - Linux Magazine

Configuring Linux for a Bluetooth stereo headset - Linux Magazine

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

COVER STORY<strong>Bluetooth</strong> Headsets./bootstrap./configure --prefix=U/usr --sysconfdir=/etcmakesudo make installThis completes the installation. The nextstep is to configure the A2DP daemon.Configuration FilesFor playback, you need to tell the daemonwhich <strong>headset</strong> to use, and you needa .asoundrc file to create a matchingALSA device. If you do not have a.asoundrc file in your home directory,create a new file like so:pcm.a2dpd {type a2dpd}If the file already exists, add the threepreceding lines at the end of the file. Toconfigure the A2DP daemon, copy thesample.a2dprc file called .a2dprc fromthe plugz/also-plugins directory to yourhome directory. Note that both files startwith a dot. Then open the .a2dprc file,remove the pound sign (#) in line 48 toenable the entry #address=00:08:F4:30:07:64, and replace the <strong>Bluetooth</strong>address in this entry with the address <strong>for</strong>your dongle. To find the address, refer tothe next section.<strong>Bluetooth</strong> BasicsTo play music on your <strong>headset</strong>, you needto connect it to your PC. To allow this tohappen, you need to make sure your<strong>headset</strong> is visible. If you have a Jabra<strong>headset</strong>, press the pads on both earphones<strong>for</strong> about five seconds. You cantell that the <strong>headset</strong> is in pairing modebecause the LEDs will alternately flashred, blue, and green.If you have the Logitech <strong>headset</strong>, holddown the button at the center of the leftearphone until the LED starts to flashquickly. Now enter hcitool scan at thecommand line, and you should see the<strong>Bluetooth</strong> address and name of the <strong>headset</strong>s– <strong>for</strong> example:marcel@kim:~> hcitool scanScanning ...00:13:17:70:44:5A Jabra BT620sNow enter this address in the .a2dprc filein your home directory. If the commandfails to find a <strong>Bluetooth</strong> device, eitheryour computer’s <strong>Bluetooth</strong> dongle is notworking or the <strong>headset</strong> is not in pairingmode. To find out whether <strong>Linux</strong> hasdetected the dongle, give the hcitool devcommand. It should display the <strong>Bluetooth</strong>address <strong>for</strong> the dongle.Let’s RockIf you have created the two configurationfiles <strong>for</strong> the ALSA configuration andthe A2DP daemon, you can launch thedaemon at the command line by typinga2dpd. You don’t need to be root to dothis. The following two lines shouldappear as output:avrcp: Accepting Uincoming connectionavdtp: Accepting Uincoming connectionIf you see an error message stating Cannotopen /dev/ input/ uinput: No such fileor directory, you can just ignore it.Leaving the terminal window open,launch XMMS and press Ctrl+P to openthe configuration dialog. As your OutputPlugin, select ALSA [libALSA.so] andthen click on Configure. In the Audiodevice box, manually enter a2dpd (youcan’t select the device from the list), andthen click OK twice to apply the settings.When you startto play back inXMMS, a dialogbox appears,prompting you topair the device.The <strong>headset</strong> mustbe in pairing mode<strong>for</strong> this.On SUSE <strong>Linux</strong>,the pairing dialogappears in theKDE <strong>Bluetooth</strong>framework; onUbuntu, you willsee a Gnome<strong>Bluetooth</strong> dialogbox, assumingyou have installedthe bluez-passkeygnomepackage onEdgy.If pairing worksas intended, theplayer should startto play back. Youwill then see the following message inthe terminal window with the a2dpdcommand:DEBUG: a2dp_transfer_raw: UBandwith: 27250 (212 kbps) 32Instead of XMMS, you could just as easilyuse Amarok or Kaffeine <strong>for</strong> soundoutput. To do so in Amarok, select Settings| Configure Amarok | Audio output,and set the Output module to Alsa. Afterclicking on Apply, enter the a2dpd devicein both the Mono and Stereo boxes(Figure 2).In Kaffeine, select Settings | Xine EngineParameters | Audio, click the ExpertOptions tab, and scroll down until yousee device.alsa_front_device device used<strong>for</strong> <strong>stereo</strong> output. Instead of default,enter a2dpd here.Pros and ConsOne of the biggest advantages of the<strong>Bluetooth</strong> approach compared with legacywireless <strong>headset</strong>s is that you can usea <strong>Bluetooth</strong> <strong>headset</strong> to send commandsto your <strong>Linux</strong> computer. For example,you can stop the player, move to the nexttrack, or backtrack.The .a2dprc file specifies which commandsthe A2DP daemon receives whenyou press a button. In the # AVRCP Com-Figure 2: To be able to play music via the A2DP daemon, you need toset up a2dpd as an ALSA device in Amarok.40 ISSUE 80 JULY 2007 W W W. L I N U X- M A G A Z I N E . C O M

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!