Linux下Bluetooth HCI Command的实现
来源:互联网 发布:ios编程语言是什么 编辑:程序博客网 时间:2024/05/16 18:04
作者:Sam(甄峰) sam_code@hotmail.com
Linux下写Bluetooth程序,首先接触到的就是使用HCI Command来设置BluetoothModules(USB Bluetooth dongle)。那这些HCIcommand在blueZ中是如何实现的呢?举例说明。
if ((ctl = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI))
在此之前,因为hci_sock.c已经被built-in.所以hci_sock_init()已经被执行。
另外,因为hci usb driver也已经insmod。所以hci_usb_init()被执行,这个driver指出,当USBBluetoothDongle插入时,调用hci_usb_probe()。这时,就会指出open为hci_usb_open()
hci_usb_open()中则设置hci_dev->flag=HCI_RUNNING.
并向USB Core提交一个中断URB。当有中断URB被USB Core出来完毕后,调用hci_usb_rx_complete()。它则调用__recv_frame()。它处理所有USB Dongle通过中断URB送来的数据。
利用hci_init_req()发送request.
hci_init_req()调用hci_send_cmd()发送命令。
hci_send_cmd() 则调用skb_queue_tail()将命令skb添加到发送队列。再调用hci_sched_cmd()去调用发送命令去发送。发送命令为:hci_cmd_task()
hci_cmd_task()-〉hci_send_frame()-〉hci_send_frame()-〉hdev->send(skb);=hci_usb_send_frame();发送命令给USBbluetooth dongle.
HCI就是通过这个途径发送Command到Dongle的。所以HCISocket其实就是PC和Dongle之间的一个通道。注意,不是PC和远端bluetooth设备的通道,而是本地Dongle。
- Linux下Bluetooth HCI Command的实现
- Linux下 Bluetooth HCI Command的实现
- Linux下Bluetooth HCI Command的实现
- Linux下Bluetooth HCI Command的实现
- Linux下Bluetooth HCI Command的实现
- linux下bluetooth编程(三)HCI层编程
- linux下bluetooth编程(三)HCI层编程
- linux下bluetooth编程(三)HCI层编程
- Bluetooth HCI Event的处理
- Bluetooth HCI Event的处理
- Bluetooth HCI Event的处理
- Bluetooth HCI Event的处理
- Bluetooth HCI Event的处理
- Bluetooth HCI Event的处理
- Bluetooth HCI
- Linux Bluetooth编程 HCI层编程
- Linux 下的Bluetooth 架构
- Linux 下的Bluetooth 架构
- Linux BlueZ 下 Inquiry的实现
- C语言编译原理简介
- gcc和g++的区别。四个理解误区
- IIS 无法安装提示错误,无法复制一个或多个文件,错误码0x4b8
- linux之搜索
- Linux下Bluetooth HCI Command的实现
- Framework-Res.apk 反编译、编译、打包、替换详细教程
- 搭建环境
- xml语法学习
- 一键GHOST 优盘版 安装运行
- Rapid Software Testing【by James Bach】
- Linux Kernel module isnmod 时的检查以及MODVERSIONS
- PeopleTools Cache Clearing Guide
- HQL语法