Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我正在通过 hci.c 文件中的 hci_send_req 实现。在向控制器发送 hci 命令后在此函数中。控制器发送事件包。通过 读取缓冲区中的事件包后 read(dd, buf, sizeof(buf)) (dd is hci socket descriptor),现在我们需要事件包头并获取事件包头,buf 被筛选 1 个字节。为什么??
read(dd, buf, sizeof(buf)) (dd is hci socket descriptor)
hdr = (void *) (buf + 1); (line number 1049 of hci.c)
请让我知道这件事。谢谢。
HCI 事件包:主机控制器通知 HCI 驱动程序事件:
数据包指示符(UART 接口)为 4。 事件代码(8 位):标识事件。 参数长度(8 位):所有参数的总长度,以字节为单位。 事件参数:参数的数量及其长度是特定于事件的。
因此,第一个八位字节用于数据包指示符,即事件数据包的 0x04。
用于命令包 - 0x01(用于 UART 接口) 用于 ACL 数据包 - 0x02(用于 UART 接口) 用于 SCO 数据包 - 0x03(用于 UART 接口)