进行hciconfig hci0重置时出现无效的参数问题 [英] Invalid Params issue when doing hciconfig hci0 reset

查看:372
本文介绍了进行hciconfig hci0重置时出现无效的参数问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在5.0以上的内核中观察到此问题.并启用了具有扩展广告功能的控制器.我目前已使用bluez-5.50进行了测试.

This issue I am observing with kernel above 5.0. And with controllers that have extended advertising enabled. I have currently tested with bluez-5.50.

问题与我可以从代码中获得的"MGMT_ADV_FLAG_SEC_MASK"标志有关.但是我不了解何时以及如何修改此标志.

The issue is something to do with "MGMT_ADV_FLAG_SEC_MASK" flag is what I could get from the code. But when and how will this flag be modified is what I dont understand.

配置:内核5.4.24(在任何5.0+内核中均可见),bluez 5.50我正在执行以下步骤:1. hciattach启用BLE扩展ADV的控制器.2.重置hciconfig hci0.

Config: kernel 5.4.24(issue seen with any 5.0+ kernel) , bluez 5.50 I am doing following steps: 1. hciattach the BLE extended ADV enabled controller. 2. hciconfig hci0 reset.

我在扩展扫描rsp命令中遇到以下错误(在hciconfig hci0重置序列期间):

I am getting following error for Extended Scan rsp command (during the hciconfig hci0 reset sequence):

LE Set Extended Scan Response Data (0x08|0x0038) ncmd 1
        Status: Invalid HCI Command Parameters (0x12)

由于下面用core_v5.2编写的内容,我得到了这一点:"如果广告集不可扫描,并且主机使用此命令而不是丢弃现有数据,则控制器应返回错误代码Invalid HCI Command Parameters(0x12).如果广告集使用可扫描的旧广告PDU和操作不是0x03或Scan_Response_Data_Length参数超过31个八位位组,控制器应返回错误代码Invalid HCI Command Parameters(0x12).如果操作不是0x03且Scan_Response_Data_Length为零,则控制器应返回错误代码Invalid HCI Command Parameters(0x12)"

And this I am getting because of below written in core_v5.2: "If the advertising set is non-scannable and the Host uses this command other than to discard existing data, the Controller shall return the error code Invalid HCI Command Parameters (0x12). If the advertising set uses scannable legacy advertising PDUs and either Operation is not 0x03 or the Scan_Response_Data_Length parameter exceeds 31 octets, the Controller shall return the error code Invalid HCI Command Parameters (0x12). If Operation is not 0x03 and Scan_Response_Data_Length is zero, the Controller shall return the error code Invalid HCI Command Parameters (0x12) "

因此,在我的扩展HCI命令扩展广告集命令中,恰好在扩展扫描rsp集之前:

So in my extended HCI Command Extended Advertising set command just before extended scan rsp set:

*LE Set Extended Advertising Parameters (0x08|0x0036) plen 25 

        Handle: 0x00
        Properties: 0x0010
          Use legacy advertising PDUs: ADV_NONCONN_IND

设置此旧版广告的原因是内核代码中已检查了MGMT_ADV_FLAG_SEC_MASK.我想知道控制器LE功能中的哪个参数或需要其他任何参数才能正确设置.

This legacy advertising is set because of the MGMT_ADV_FLAG_SEC_MASK as checked in kernel code. I want to know which parameter from the controller LE features or anything else is required to set it right.

在我的蓝牙控制器中,不支持多ADV,支持扩展ADV.

推荐答案

解决了这个问题,它是针对5.4.24内核的扩展adv.在内核版本5.7.7中.我在文件hci_request.c,函数get_adv_instance_scan_rsp_len中发现了这种差异,当前(内核5.4.24)的代码是:

Got the issue, it was with extended adv for kernel 5.4.24. In the kernel version 5.7.7. I found this difference in file hci_request.c, function get_adv_instance_scan_rsp_len, currently(kernel 5.4.24) the code is:

static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance)
{
        struct adv_info *adv_instance;

        /* Ignore instance 0 */
        if (instance == 0x00)
                return 0;

在5.7.7中,它更改为:

In the 5.7.7 it is changed to:

static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance)
{
        struct adv_info *adv_instance;

        /* Instance 0x00 always set local name */
        if (instance == 0x00)
                return 1;

这应该更改的是,它应该满足以下条件,而当前条件不是.因此,基本上应该设置scannable标志,通过该标志,扫描rsp数据cmd不会失败:

What this should change is, it should satisfy the condition below, which currently wasn’t. So basically should set the scannable flag by which the scan rsp data cmd doesnt fail:

 } else if (get_adv_instance_scan_rsp_len(hdev, instance)) {
                if (secondary_adv)
                        cp.evt_properties = cpu_to_le16(LE_EXT_ADV_SCAN_IND);
                else
                        cp.evt_properties = cpu_to_le16(LE_LEGACY_ADV_SCAN_IND);

这篇关于进行hciconfig hci0重置时出现无效的参数问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆