问题:监控主从蓝牙之间的sco数据包。
问题描述。我有一个小型内部蓝牙设备(在Linux fedora OS中开发)并配置为从设备。
我对以下事情感兴趣:
掌握连接我们的内置设备并建立sco链接。 我如何验证链接是否已建立?
掌握将sco数据包发送到slave和slave发回(loopback) 掌握相同的数据包。绝对不知道怎么做?
到目前为止我做了什么:
我已将内置设备配置为slave并通过蓝牙成功连接到Windows笔记本电脑。
我已经在我的内部BT设备中启用了耳机配置文件,我可以在Windows上看到耳机图标。
在Linux端通过c ++代码我修改了/etc/asound.conf以包含连接设备的mac-address(在我的案例中是windows笔记本电脑)。 样品如下所示
pcm.btheadset {
type plug
slave {
pcm {
type bluetooth
device DC:A9:71:8D:2D:C6
profile "auto"
}
}
然后通过命令
在我的内部BT播放声音aplay -D btheadset " path of audio_file"
我可以在Windows笔记本电脑上成功听到声音。
到目前为止一切顺利。
现在我做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
注意:
我做了hcidump并在音乐播放时保存文件。我将保存文件转储到wireshark并使用" bthci_sco"过滤数据包,发现没有数据包。想知道音乐如何运作呢?
答案 0 :(得分:0)
经过几天与Ubuntu的斗争经常崩溃后,它终于有效了。
以下是我尝试过的步骤。请把它作为参考,因为我很可能忘记写一些步骤
............................................... .................................................. ..
问题概述:尝试将Linux操作系统连接到BT耳机并建立sco链接以播放音乐
UBuntu配置:
内核版本: 3.0.0-32-generic
Ubuntu Verion - > 11.10
测试设备: JABRA EASY GO耳机..
.................................................. ............................
1)安装上面的Ubuntu版本。这个Ubuntu版本不受支持,但由于我的内部设备使用几乎相同的内核版本,所以我坚持使用这个版本。
2)配置apt-get sources列表。由于安装的版本不受支持,apt-get将无法使用。要使其有效,请修改/etc/apt/sources.list
示例 - >
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)我建议安装synaptic以安装软件包和缺少库。
4)安装以下软件包 - >
bluez-hcidump
bluez-utils
libbluetooth1
libbluetooth1-dev
install automake-1.7 and autoconfig
cvs
5)Google可以下载btsco的源代码或者
使用以下命令
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)现在正在编译和安装
i)转到btsco目录
ii)./ bootstrap
问题:
如果错误/警告:宏`AM_PATH_SDL'在库安装libbsdl1.2-dev
一旦bootsrap通过execute configure ii)./configure 问题:
iii)制作
问题: ./libtool:第841行:X - tag = CXX:找不到命令,还有更多这样的错误
解决该错误:下载libtool-1.5.24 tar ball。提取它并做configure and make
。
现在再次在btsco上配置并将libtool从libtool dir复制到btsco。
iv)make install v)使mainatiner清洁 O / p:btsco构建成功,您可以在/ usr / local / bin中找到它。
7)构建内核模块
i)cd / usr / src / btsco / kernel
ii)制作
问题:我猜你会得到大量的错误。打开btsco.cand逐步处理每个错误
1错误声音/ driver.h未找到bla bla - >在btsco.c文件中评论 2评论#include因为现在已经过时了 3)添加
#include< linux/smp.h>
#include< linux/muxtex.h>
4)DEFINE_MUTEX(os_mutex);
5)snd_assert已过时,因此请使用if statment example
替换uitif( bt_sco->playback == NULL)
{
}
6)用9以下的函数替换kill_proc(再次过时)从net ... tahnks复制到那个人)
链接: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;
}
然后而不是kill_proc应该是
my_kill_proc( bt_sco->thread_pid, SIGINT )
6)将%d to %lu
替换为错误long int
7)replace lock_kernal to mutex_lock( &os_mutex)
同样用于解锁
希望在那之后成功
8)make install 9)depmod -e 10 0清洁
11)modprobe snd_bt_sco
......................................
现在运行btsco
a)hciconfig hci0 voice 0X0060
b)hcitool扫描
获取JABRA的mac_addre4ss
c)/ usr / local / bin / btsco -r -v mac_addrees
如果得到错误?:控制打开(hw:1)然后jabra不支持sco或内核模块未加载
d)在另一个终端上做 - > sudo hcidump -i hci0 sco
监控sco数据包
e)一旦建立了jabr连接
运行aplay -D plughw:Headset /home/my_home_dir/my_sample_fiile.wav