ok, you guys got me curious enough to download the handsfree source and give it a whirl. Having successfully connected to my phone for bluetooth DUN, I figured it was worth a shot.
Here's what I did, and how far I got:
First off, I am running gentoo, and currently have bluez-utils-2.25-r1 installed - I tried compiling with and without dbus support - had no change in my results.
If you don't know your phone's bdaddr use hcitool to find it:
(make sure your phone is "discoverable")
> hcitool scan
Scanning ...
00:14:9A:19:75:22 Mazda3
Now use sdptool to find the channel for the handsfree gateway:
> sdptool browse 00:14:9A:19:75:22
Browsing 00:14:9A:19:75:22 ...
<snip>
Service Name: Handsfree Voice Gateway
Service RecHandle: 0x10002
Service Class ID List:
"Handfree Audio Gateway" (0x111f)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 4
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Handsfree" (0x111e)
Version: 0x0101
</snip>
So for me, channel 4 is the handsfree gateway
Now run handsfree:
(first register the handsfree service)
>sdptool add hf
Handsfree service registered
>./handsfree 00:14:9A:19:75:22 4
You will be prompted on your phone to enter your pin. If you have not changed the default, it is either 0000 or 1234. I entered my pin which was verified and accepted.
At this point I received an error from handsfree:
Voice setting: 0x0060
RFCOMM channel connected
sending.cmd AT+BRSF=31
poll descriptors count 1
poll descriptors count 1
opening control pipe - set to stdin: No such file or directory
>>
ERROR
Error found in phase 0.
Error: 0.96 handsfree detected (or you are using the wrong channel!)
sending.cmd AT+CIND=?
>>
ERROR
Error found in phase 1.
>>
+MBAN: Copyright 2000-2004 Motorola, Inc.
But here is the good news: At this point, my phone believes it is connected to a handsfree set. I verified this by making a call and confirming no sound came out of the phone ear piece. So, my pc connected, the phone accteped the connection - now to find out what went wrong...
I straced the process, and found that handsfree was trying to open /tmp/ctrl - a pipe it uses for stdin:
write(1, "poll descriptors count 1\n", 25) = 25
write(1, "poll descriptors count 1\n", 25) = 25
open("/tmp/ctrl", O_RDWR) = -1 ENOENT (No such file or directory)
write(2, "opening control pipe - set to stdin: No such file or directory\n", 63) = 63
select(7, [0 6], NULL, NULL, {0, 1000000}) = 1 (in [6], left {0, 956000})
read(6, "\r\nERROR\r\n", 2048) = 9
write(2, ">>\r\nERROR\r\n\n", 12) = 12
write(2, "Error found in phase 0.\n", 24) = 24
write(2, "Error: ", 7) = 7
Looking through the code, I do not see anywhere the pipe is created. For giggles, I did a `mkfifo /tmp/ctrl` and ran handsfree again. This time I got the following output:
Voice setting: 0x0060
RFCOMM channel connected
sending.cmd AT+BRSF=31
poll descriptors count 1
poll descriptors count 1
>>
ERROR
Error found in phase 0.
Error: 0.96 handsfree detected (or you are using the wrong channel!)
sending.cmd AT+CIND=?
>>
ERROR
Error found in phase 1.
>>
+MBAN: Copyright 2000-2004 Motorola, Inc.
Still got an error, but the "no such file" is gone. strace showed the following:
write(1, "poll descriptors count 1\n", 25) = 25
write(1, "poll descriptors count 1\n", 25) = 25
open("/tmp/ctrl", O_RDWR) = 8
select(7, [6], NULL, NULL, {0, 1000000}) = 1 (in [6], left {0, 956000})
read(6, "\r\nERROR\r\n", 2048) = 9
write(2, ">>\r\nERROR\r\n\n", 12) = 12
write(2, "Error found in phase 0.\n", 24) = 24
write(2, "Error: ", 7) = 7
I looked at the code some more and determined that it dies when it requests the audio link:
wlen = writecmd(rd, "AT+BRSF=31\r"); // request audio link
This command is not making it to the phone, so the phone just stays in limbo - connected to the pc, but not sending anything.
I am not a programmer, so I do not know where to go from here. If anyone has any suggestions to debug, I'd be happy to try it
Hopefully this will help get someone a little closer!