Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: How to use a Bluetooth headset with DSL, Part 6 of Bluetooth on DSL< Next Oldest | Next Newest >
Juanito Offline





Group: Members
Posts: 1601
Joined: Sep. 2005
Posted: April 09 2007,06:31 QUOTE

This is part 6 of the DSL Bluetooth how-to. In order to proceed from here, you will need to have Bluetooth up and running on your DSL machine and be able to "pair" with a Bluetooth device as described in part 1 - "How to start Bluetooth & Pair with a remote device".

Since bluezsco uses an alsa driver, snd-bluez-sco, based on an older version of alsa than that in alsa.dsl, make sure that alsa.dsl is not loaded. Use lsmod to make sure that no sound drivers are loaded except for soundcore. If some sound drivers are loaded, use rmmod to unload them.

You will need to download both bluez-utils.dsl and alsa_bluezsco.dsl and load bluez-utils.dsl first - this is because alsa_bluezsco.dsl will overwrite the pin file (all headsets seem to use 0000) and the hci-usb module (modified to support bluezsco).

First load the headset sound driver and check it loaded OK:
Code Sample

# modprobe snd-bluez-sco
# lsmod
Module                  Size  Used by    Not tainted
snd-bluez-sco           7584   0  (unused)
snd-pcm                53604   0  [snd-bluez-sco]
snd-timer              13124   0  [snd-pcm]
snd-hwdep               4484   0  [snd-bluez-sco]
snd-page-alloc          5364   0  [snd-bluez-sco snd-pcm]
snd                    25412   0  [snd-bluez-sco snd-pcm snd-timer snd-hwdep]
soundcore               3428   0  (autoclean) [snd]
...
# cat /proc/asound/cards
0 [Headset        ]: Bluez SCO - Bluez Headset
                    Bluez Headset 1


Next load the bluetooth modules and bring up the bluetooth interface as described in part 1 of the how-to. Once this is done, you are ready to start to connect to the headset.

First put your headset into pairing mode - to put my headset into pairing mode, I needed to hold the volume + & - keys for 5 seconds. Note that this assumes your headset pin is 0000 - change /etc/bluetooth/pin and restart hcid if your pin is something different. If your machine pairs successfully with your headset, it will revert to standby mode. On my headset, the light changes from flashing green/red (pairing mode) to intermittently flashing green (standby) when the prompt returns after the "auth" command:
Code Sample

# hcitool cc 00:12:EE:A6:1D:F4 [use your bt address here]
# hcitool auth 00:12:EE:A6:1D:F4


In order to check that your machine's Bluetooth interface supports hci/sco and to find out which bluetooth channel your headset uses, issue the commands below. Note that you may have to try this more than once - my headset did not always reply first time.
Code Sample

# hciconfig hci0 revision
hci0:   Type: USB
       BD Address: 00:10:C6:56:F4:9F ACL MTU: 192:8 SCO MTU: 64:8
       Build 1266
       Chip version: BlueCore02-External
       Max key size: 128 bit
       SCO mapping:  HCI [if you don't have this apparently you can give up now]

# sdptool search --bdaddr 00:12:EE:A6:1D:F4 HS [enter your bt address here]
Searching for HS on 00:12:EE:A6:1D:F4 ...
Service Name: SonyEricsson Headset Service
Service RecHandle: 0x10002
Service Class ID List:
 "Headset" (0x1108)
 "Generic Audio" (0x1203)
Protocol Descriptor List:
 "L2CAP" (0x0100)
 "RFCOMM" (0x0003)
   Channel: 1 [this is the information required]
Profile Descriptor List:
 "Headset" (0x1108)
   Version: 0x0100


Now you know the bt channel for your headset, the setup can be completed:
Code Sample

# rfcomm bind 1 00:0A:D9:E8:4A:65 1 [bind rfcomm1 to bt channel 1]
# mknod -m 666 /dev/rfcomm1 c 216 1 [create rfcomm1]
# hciconfig hci0 voice 0x0040


With the set up complete, all that remains is to open the link to the headset - note that the prompt will not return until the link is broken by either pressing the button on your headset or <ctrl-c>. To continue to issue commands, you will need to open another terminal window:
Code Sample

# bluezsco 00:12:EE:A6:1D:F4 1 [use your bt address here]
# Device is 1:0
Voice setting: 0x0040
RFCOMM channel connected
SCO audio channel connected (handle 49, mtu 64)
Setting sco fd
Done setting sco fd
AT*ECBP=?
AT+VGS=6
Sending up speaker change 6
AT+CLIP=1
AT+CSCS="UTF-8"
AT*SEAM="HBH-610",13
AT+CLAN?
[to close connection, press headset button, prompt returns &]
AT+CKPD=200


In a second terminal window, you can now communicate with the headset:
Code Sample

# alsamixer [allows to you adjust sound, microphone and loopback]
# aplay -D plughw:Headset /path-to-file/music.wav [works but stops after a few secs]
# aplay -B 1000000 -D plughw:Headset /path-to-file/music.wav [works]
# mpg123 -o alsa /path-to-file/music.mp3
...
Directory: /path-to-file/music.mp3
Playing MPEG stream from music.mp3 ...
MPEG 1.0 layer III, 192 kbit/s, 44100 Hz stereo
ALSA snd_pcm_hw_params_set_period_size error: Invalid argument
Can't find a suitable libao driver. (Is device in use?)


Changes made in alsamixer will be echoed in the first terminal window. The snd-bluez-sco driver is apparently 8-bit mono - there are more recent drivers, but only for 2.6.x - so the microphone loopback sounds fine but music does not sound that great.

Edit 1
------
I could not get mp3 files to play with alsa, but I suspect this is because I did not get the alsa device naming convention right. According to Google, this might require using .asoundrc to create a "real" rather than a "virtual" device but I have no clue how to go about that.

I did get mp3 files to play with oss using mpg123 and mplayer-nogui.uci (which does not have an alsa output module). To do this, the oss modules need to be loaded:
Code Sample
# modprobe snd-pcm-oss
# mpg123 -o oss /path-to-file/music.mp3
# mplayer-nogui -ao oss /path-to-file/music.mp3

xmms will play also play mp3 files using the oss default (audio device /dev/dsp - mixer /dev/mixer).

Edit 2
-------
I manage to download Skype -1.3.0.53 whilst travelling (the government blocks Skype where I live) and it seems to work OK. On start-up Skype automatically detected the alsa headset driver and a test call worked reasonably - my voice was a little distorted but I could hear the other end pefectly. I also tried with OSS and Skype worked fine with /dev/dsp.
Back to top
Profile PM 
0 replies since April 09 2007,06:31 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: How to use a Bluetooth headset with DSL

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code