Testing bluetooth SCO connection on pandaboard

1,316 views
Skip to first unread message

PavelVPV

unread,
Sep 14, 2012, 1:11:56 AM9/14/12
to panda...@googlegroups.com
You can't test sco on panda, but you can switch audio routing from sco to hci, using special vendor specific hci command. You can also watch on bt_sco_app and scotest programs to learn more about using sco with bluez

Ahmed Abdelfattah

unread,
Sep 16, 2012, 10:36:17 AM9/16/12
to panda...@googlegroups.com
Why not ?
There are already some tools to test audio like hstest.
I ran hstest and the problem seems to happen after a Parameter Negotiation command to the HS, the HS doesn't reply with PN RSP but instead with DM.

Here is the log:
< HCI Command: Read Voice Setting (0x03|0x0025) plen 0
> HCI Event: Command Complete (0x0e) plen 6
    Read Voice Setting (0x03|0x0025) ncmd 5
    status 0x00 voice setting 0x0060
< HCI Command: Create Connection (0x01|0x0005) plen 13
    bdaddr 00:23:7F:EB:4F:10 ptype 0xcc18 rswitch 0x01 clkoffset 0x0000
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5
> HCI Event: Command Status (0x0f) plen 4
    Create Connection (0x01|0x0005) status 0x00 ncmd 5
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 128 bdaddr 00:23:7F:EB:4F:10 type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 128
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 5
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 128
    Features: 0xbc 0xec 0x01 0x00 0x18 0x18 0x00 0x00
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr 00:23:7F:EB:4F:10 mode 2 clkoffset 0x0000
< ACL data: handle 128 flags 0x00 dlen 10
    L2CAP(s): Info req: type 2
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 5
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 128 packets 1
> ACL data: handle 128 flags 0x02 dlen 16
    L2CAP(s): Info rsp: type 2 result 0
      Extended feature mask 0x0000
< ACL data: handle 128 flags 0x00 dlen 12
    L2CAP(s): Connect req: psm 3 scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 128 packets 1
> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr 00:23:7F:EB:4F:10 name 'PLT_MLXX'
> ACL data: handle 128 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x004c scid 0x0040 result 1 status 2
      Connection pending - Authorization pending
> HCI Event: Link Key Request (0x17) plen 6
    bdaddr 00:23:7F:EB:4F:10
< HCI Command: Link Key Request Reply (0x01|0x000b) plen 22
    bdaddr 00:23:7F:EB:4F:10 key 81305E3AB5D0447783B7079E1E107374
> HCI Event: Command Complete (0x0e) plen 10
    Link Key Request Reply (0x01|0x000b) ncmd 5
    status 0x00 bdaddr 00:23:7F:EB:4F:10
> ACL data: handle 128 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x004c scid 0x0040 result 0 status 0
      Connection successful
< ACL data: handle 128 flags 0x00 dlen 16
    L2CAP(s): Config req: dcid 0x004c flags 0x00 clen 4
      MTU 1013
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 128 packets 1
> ACL data: handle 128 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 0
      Success
> ACL data: handle 128 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 4
      MTU 1013
< ACL data: handle 128 flags 0x00 dlen 18
    L2CAP(s): Config rsp: scid 0x004c flags 0x00 result 0 clen 4
      MTU 1013
< ACL data: handle 128 flags 0x00 dlen 8
    L2CAP(d): cid 0x004c len 4 [psm 3]
      RFCOMM(s): SABM: cr 1 dlci 0 pf 1 ilen 0 fcs 0x1c
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 128 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 128 packets 1
> ACL data: handle 128 flags 0x02 dlen 8
    L2CAP(d): cid 0x0040 len 4 [psm 3]
      RFCOMM(s): UA: cr 1 dlci 0 pf 1 ilen 0 fcs 0xd7
< ACL data: handle 128 flags 0x00 dlen 18
    L2CAP(d): cid 0x004c len 14 [psm 3]
      RFCOMM(s): PN CMD: cr 1 dlci 0 pf 0 ilen 10 fcs 0x70 mcc_len 8
      dlci 12 frame_type 0 credit_flow 15 pri 7 ack_timer 0
      frame_size 1008 max_retrans 0 credits 7
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 128 packets 1
> ACL data: handle 128 flags 0x02 dlen 8
    L2CAP(d): cid 0x0040 len 4 [psm 3]
      RFCOMM(s): DM: cr 1 dlci 12 pf 1 ilen 0 fcs 0x69
< ACL data: handle 128 flags 0x00 dlen 8
    L2CAP(d): cid 0x004c len 4 [psm 3]
      RFCOMM(s): DISC: cr 1 dlci 0 pf 1 ilen 0 fcs 0xfd
< ACL data: handle 128 flags 0x00 dlen 12
    L2CAP(s): Disconn req: dcid 0x004c scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 128 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 128 packets 1
> ACL data: handle 128 flags 0x02 dlen 8
    L2CAP(d): cid 0x0040 len 4 [psm 3]
      RFCOMM(s): UA: cr 1 dlci 0 pf 1 ilen 0 fcs 0xd7
> ACL data: handle 128 flags 0x02 dlen 12
    L2CAP(s): Disconn rsp: dcid 0x004c scid 0x0040
< HCI Command: Disconnect (0x01|0x0006) plen 3
    handle 128 reason 0x13
    Reason: Remote User Terminated Connection
> HCI Event: Command Status (0x0f) plen 4
    Disconnect (0x01|0x0006) status 0x00 ncmd 5
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 128 reason 0x16
    Reason: Connection Terminated by Local Host

Pavan Savoy

unread,
Sep 16, 2012, 10:40:24 AM9/16/12
to panda...@googlegroups.com

Can someone send across the alsa a mixer or tinymix output.
To generally test sco on non modem platforms we do HFP Tx as in play via media player and listen to on the Bluetooth headset. This is what BT_sco_app is expected to setup.

Droid sent - Ignore typos

Ahmed Abdelfattah

unread,
Sep 16, 2012, 12:03:13 PM9/16/12
to panda...@googlegroups.com
Thanks for the hint.
Testing with BT_sco_app gave me connection rejected due to limited resources, here is the log:

< HCI Command: Vendor (0x3f|0x0106) plen 34
> HCI Event: Command Complete (0x0e) plen 4
    Vendor (0x3f|0x0006) ncmd 5

< HCI Command: Create Connection (0x01|0x0005) plen 13
    bdaddr 00:23:7F:EB:4F:10 ptype 0xcc18 rswitch 0x01 clkoffset 0x0000
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5
> HCI Event: Command Status (0x0f) plen 4
    Create Connection (0x01|0x0005) status 0x00 ncmd 5
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 128 bdaddr 00:23:7F:EB:4F:10 type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 128
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 5
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 128
    Features: 0xbc 0xec 0x01 0x00 0x18 0x18 0x00 0x00
< HCI Command: Setup Synchronous Connection (0x01|0x0028) plen 17
    handle 128 voice setting 0x0060 ptype 0x003f

> HCI Event: Command Status (0x0f) plen 4
    Setup Synchronous Connection (0x01|0x0028) status 0x00 ncmd 5

< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr 00:23:7F:EB:4F:10 mode 2 clkoffset 0x0000
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 5
> HCI Event: Synchronous Connect Complete (0x2c) plen 17
    status 0x0d handle 384 bdaddr 00:23:7F:EB:4F:10 type SCO
    Error: Connection Rejected due to Limited Resources

> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr 00:23:7F:EB:4F:10 name 'PLT_MLXX'
< HCI Command: Disconnect (0x01|0x0006) plen 3
    handle 128 reason 0x13
    Reason: Remote User Terminated Connection
> HCI Event: Command Status (0x0f) plen 4
    Disconnect (0x01|0x0006) status 0x00 ncmd 5
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 128 reason 0x16
    Reason: Connection Terminated by Local Host


Ahmed Abdelfattah

unread,
Sep 16, 2012, 12:24:09 PM9/16/12
to panda...@googlegroups.com
BT_sco_app is configured to work on the WL12xx chip but I am testing another bluetooth chip connected to the board through UART.

On Sunday, September 16, 2012 4:40:27 PM UTC+2, Pavan Savoy wrote:

Pavan Savoy

unread,
Sep 16, 2012, 12:29:12 PM9/16/12
to panda...@googlegroups.com

Yes. It previously did contain vendor specific command .. but doesn't anymore it does exactly what scotest does.

Droid sent - Ignore typos

Ahmed Abdelfattah

unread,
Sep 16, 2012, 1:11:20 PM9/16/12
to panda...@googlegroups.com
As I mentioned before scotest fails after Parameter Negotiation command to the HS, the HS doesn't reply with PN RSP but instead with DM.  

PavelVPV

unread,
Sep 17, 2012, 2:21:42 PM9/17/12
to panda...@googlegroups.com
Strange, because i couldn't listen music on PandaBoard (rev. A2, A4 and B1) over SCO with bt_sco_app. At the same time, it successfully works on Blaze without GSM module. Nevertheless, sco connection successfully establishes on PandaBoard.

To Ahmed Abdelfatta:
You should also understand, that you can't see a sco data flow in software layer, because it is proceeding directly to the CPU.

Ahmed Abdelfattah

unread,
Sep 18, 2012, 9:41:32 AM9/18/12
to panda...@googlegroups.com
I know this but at least the log will be like this
> SCO data: handle 71 flags 0x00 dlen 48
> SCO data: handle 71 flags 0x00 dlen 48
> SCO data: handle 71 flags 0x00 dlen 48
< SCO data: handle 71 flags 0x00 dlen 48
this log was taken from ubuntu 11.10 with the same headset, anyway my problem isn't with SCO data it's way before this point during creation of RFCOMM connection.

richi chen

unread,
Nov 12, 2012, 3:32:10 AM11/12/12
to panda...@googlegroups.com
Hi, PavelVPV,

How can i  let Headset's mic-input as Skype's  voice input?
Should i implement SCO connection/receiving like bt_sco_app in Audio HAL or any Audio policy?
My Headset is with A2DP and phone audio input.



PavelVPV於 2012年9月18日星期二UTC+8上午2時21分43秒寫道:

Pavan Savoy

unread,
Nov 12, 2012, 9:25:10 AM11/12/12
to panda...@googlegroups.com
Android has a settings called voice_capable, and AFAIK omap4460panda has set it to false.
This might be one of the reason why SCO connection fails because there is no HFP rfcomm listener at all.

So, try setting this to "true" and rebuild mainly Phone.apk and BluetoothService framework. That should enable SCO connection. However to route data through SCO connection, You will need to set few mixer settings.
BT_VX mainly to begin with. Send out tinymixer output for more information...
--
--Pavan Savoy

richi chen

unread,
Nov 12, 2012, 10:10:21 PM11/12/12
to panda...@googlegroups.com
Hi Pavan,

Thank you for your reply! I found panda and panda5 have config.xml overlay

    <!-- This device is not "voice capable"; it's data-only. -->
    <bool name="config_voice_capable">false</bool>

since they are data-only devices.

But i also found in frameworks/base/core/res/res/values/config.xml :

    <!-- Boolean indicating if current platform supports bluetooth SCO for off call
    use cases -->
    <bool name="config_bluetooth_sco_off_call">true</bool>

Can this make SCO connection working without voice_capable?



Pavan Savoy於 2012年11月12日星期一UTC+8下午10時25分18秒寫道:

Ahmed Abdelfattah

unread,
Nov 13, 2012, 8:52:52 AM11/13/12
to panda...@googlegroups.com
Just FYI I was able to play SCO audio data using hstest.c (which is a
low level native application that communicates directly with bluez
stack) . Recording data is fine but playing produces a hissing sound.
I guess this won't be helpful in your case because you are trying to
route audio over SCO the whole way starting from application level. I
am interested to see the results of your work.
--
regards ,
Ahmed Abdelfattah

richi chen

unread,
Nov 13, 2012, 8:59:09 AM11/13/12
to panda...@googlegroups.com

thank you for your information. btw, where is the source code of hstest.c?

Ahmed Abdelfattah

unread,
Nov 13, 2012, 9:01:13 AM11/13/12
to panda...@googlegroups.com
/external/bluez/test

but you have to modify it a bit to make it work .

jip...@gmail.com

unread,
May 21, 2014, 9:56:52 AM5/21/14
to panda...@googlegroups.com
could you please give some tips about where exactly modify the hstest.c file??

thanks.
José
Reply all
Reply to author
Forward
0 new messages