Issue : Monitor sco packets between master and slave bluetooth.

Description of problem. I have small in-house Bluetooth device (developed in Linux fedora OS) and is configured as slave device.

I am interested in following things:

  1. Master to connect to our in-built device and establish an sco link. How would I verify link is established?

  2. Master to send sco packets to slave and slave send back( loopback) the same packets to master. Absolutely no idea how to do that?

What I did so far:

  1. Well I have configured our in-built device to slave and successfully connected to windows laptop via bluetooth.

  2. I have enabled headset profile in my in-house BT device and I can see headset icon on windows.

  3. on Linux side via c++ code I have modified /etc/asound.conf to include mac-address of connected device( in my case windows laptop) .
    sample is shown below

    pcm.btheadset {
       type plug
       slave {
           pcm {
               type bluetooth
               device DC:A9:71:8D:2D:C6
               profile "auto"
  4. then play the sound on my in-house BT via command aplay -D btheadset " path of audio_file"

And I can successfully hear sound on my windows laptop.

So far so good.
Now when I do hciconfig -a

acl packets have increase but sco remain at 0

RX bytes:1041 acl:456 sco:0 events:36 errors:0
TX bytes:1347 acl:567 sco:0 commands:34 errors:0

Will this proof that audio is working but not via sco?

  1. I have found that I don't have btsco driver or hcid.conf file. Do you think that could be an issue?

  2. if my audio is working via sco could someone provide me an example of how to test via hcidump?

  3. how to loop it back to master?

  • I did hcidump and save the file while music was playing. I dump the save file in wireshark and use "bthci_sco" to filter packets and found no packets. Wondering then how does music works then? – samprat Sep 30 '14 at 8:07

fter few days of struggle with Ubuntu crashing frequently finally it worked.

Below are the steps I have tried. Please take it as a reference as there is high chances that I might have forgotten to write some steps

................................................................................................... Overview of a problem: Trying to connect Linux OS to BT headset and to establish sco link to play music

UBuntu configuration: Kernel version : 3.0.0-32-generic Ubuntu Verion ->11.10

Testing Device : JABRA EASY GO headset.. .............................................................................. 1) Install above version of Ubuntu . This Ubuntu version is out of support but since my in -house device use nearly same kernel version so I sticked with this version.

2) Configure apt-get sources list. Since installed version is out of support , apt-get will not work. To make it work, modify the /etc/apt/sources.list. example->

sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

sudo apt-get update && sudo apt-get dist-upgrade 3) I would recommend to install synaptic as well to install packages and missing libraries.

4) Install following packages -->

 install automake-1.7 and autoconfig

5) Google it to download source code of btsco or alternatively

use following comand

cvs -d:pserver:anonymous@bluetooth-alsa.cvs.sourceforge.net:/cvsroot/bluetooth-alsa login cvs -d:pserver:anonymous@bluetooth-alsa.cvs.sourceforge.net:/cvsroot/bluetooth-alsa co btsco 6) NOW COMPILING AND INSTALLING

i) go to btsco directory

ii) ./bootstrap issues: if error/ warning: macro `AM_PATH_SDL' not found in library install libbsdl1.2-dev

once bootsrap passed execute configure ii) ./configure issues :

if bluetooth/bluetooth .h missing -> install libbluetooth-dev package requirement dbus-1>=0.36 not meet & dbus-glib not found -->install libdbus-glib-1-dev iii) make

issues: ./libtool: line 841: X--tag=CXX: command not found and many more errors like this

To resolve that error : download libtool-1.5.24 tar ball . extract it and do configure and make . now again do configure on btsco and copy libtool executeable from libtool dir to btsco.

iv) make install v) make mainatiner-clean O/p : btsco is build successfull and you can find it in /usr/local/bin.

7) Build Kernel module

i) cd /usr/src/btsco/kernel

ii) make

issues: I assume you will get huge list of errors. open btsco.cand handle each error step by step

1 error sound/driver.h not found bla bla -> comment that in btsco.c file 2 comment #include as this is obsolete now 3) add

#include< linux/smp.h> #include< linux/muxtex.h> 4) DEFINE_MUTEX(os_mutex);

5) snd_assert is obsolete so replace uit by if statment example

if( bt_sco->playback == NULL) {

} 6) replace kill_proc( again obsolete ) by function below 9 copied from net .. tahnks to that guy) link : http://www.linuxquestions.org/questions/linux-kernel-70/is-there-any-kill_proc-replacement-for-proprietary-linux-kernel-drivers-4175460017/

int my_kill_proc(pid_t pid, int sig) { int error = -ESRCH; /* default return value / struct task_struct p; struct task_struct* t = NULL; struct pid* pspid; rcu_read_lock(); p = &init_task; /* start at init / do { if (p->pid == pid) { / does the pid (not tgid) match? / t = p;
break; } p = next_task(p); /
"this isn't the task you're looking for" / } while (p != &init_task); / stop when we get back to init */ if (t != NULL) { pspid = t->pids[PIDTYPE_PID].pid; if (pspid != NULL) error = kill_pid(pspid,sig,1); } rcu_read_unlock(); return error; } and then instead of kill_proc should be

my_kill_proc( bt_sco->thread_pid, SIGINT )
6) replace %d to %lu for error long int

7) replace lock_kernal to mutex_lock( &os_mutex) same for unlock

hopefully make will be successful after that

8) make install 9) depmod -e 10 0 make clean

11) modprobe snd_bt_sco


Now run btsco

a) hciconfig hci0 voice 0X0060

b) hcitool scan

get mac_addre4ss of JABRA

c) /usr/local/bin/btsco -r -v mac_addrees

if get error ?: control open (hw:1) then jabra doesnt support sco or kernel module is not loaded

d) on another terminal do -> sudo hcidump -i hci0 sco to monitor sco packets

e) once jabr connection is established run aplay -D plughw:Headset /home/my_home_dir/my_sample_fiile.wav

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.