Zimans, how is latency with your prog? I have quite a bit of delay but I suspect that's because aplay might be buffering it a little before playing it. Or maybe the pipe is buffering it. Anybody know how to prevent a pipe from buffering?

Zimans, how is latency with your prog? I have quite a bit of delay but I suspect that's because aplay might be buffering it a little before playing it. Or maybe the pipe is buffering it. Anybody know how to prevent a pipe from buffering?

I can only guess, but I believe my app is pretty quick. Asterisk sends me 320 bytes at a time, so I buffer and send 320 bytes at a time in return. This makes asterisk happier than sending smaller chunks. 320 bytes = 50ms.

FYI Sco data comes in chunks of 48 bytes. I buffer what I get from asterisk and send 48 bytes for every 48 bytes I get from the phone. Asterisk really handles all the timing.

When I called my GF's phone using the setup, there was a delay between 0.5 and 1 second. But there are alot of sources of delay in the chain (PAP2, Asterisk, Phone Network, GSM network) WHen I make regular calls it really is no different then when I'm talking on the phone normally).

--Zims

--------------------------------------------------------------------------------
Now, Where are my Pants?

At the end of this process i check my mobile phone and it is said that the phone is connected to a handsfree device. However if i make a phone call the only thing i get from the prompt is that i had a "Segmentation fault".

Any idea of what could be wrong? i am working with mandriva 2007 and i checked my alsa drivers.

I am also interested in using my pc as a handsfree with bluetooth!!
So far i get connection with my mobile phone but my sound seems to have some kind of problems because i get the next result;

Yes, that's exactly what I got. So I commented out all of the alsa-related calls and instead just wrote the sco data to /tmp/audioOut (which I created with mkfifo). Then I did aplay -f S16_LE /tmp/audioOut, and I can hear audio, albeit with some lag and random crashes.

Rewriting this may have to wait a few days, as I just got a new car yesterday (03 passat glx ) and will have to play around with it a little...

Thanks to you all, I have handsfree connecting to my phone now. It appears as though an active connection is required for 'hcitool con' to return any data for my phone. To be honest, I have not used handsfree since I had originally attempted back at the beginning of December. Now, after simply running 'handsfree [address] [channel]', my phone connected, Bluetooth icon appears on the phone. In terms of audio, I get tones (ie pressing buttons), but audio playback doesn't come through. Still looking into that.

To get this to work, all I did was place the command 'sdptool add hf' in my local initialization script, configured hcid.conf, and started the Bluetooth init script. Then simply executed handsfree as above.

I am using gentoo as well, with bluez-utils 2.25-r1, bluez-libs 2.25, and a 2.6.19-rc5 kernel. I am beginning to think an update to bluez is what got this to work better. I did not make any changes to the code, nor did I 'mkfifo /tmp/ctrl' yet. Also, it seems there is a lot of Bluetooth in the kernel now, and that the latest kernel patch is for 2.6.19, though I did a quick grep and think I don't have the latest patch. 2.6.20-rc6-mm3 does however have the latest patch, but I haven't compiled this kernel yet.

In the meantime, I've been attempting to setup DUN via Sprint, but haven't had enough time yet.

This is great how many people are interested in using Bluetooth on Linux, and the potential for progress seems great.

I am using U8 because i think is the pcm code way of coding the audio. You used S16_LE, i also tried with this one but i even get more errors.

So any idea how to solve this lost sco sudio connection?

The lost sco audio connection stuff is not an error, that is normal. You said when you used S16_LE you got even more errors... you mean from aplay? Also, without modifying the code /tmp/audioOut is not used at all... that's just something I added to mine.