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.
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.
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.
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)
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) "
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
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.
In my bluetooth controller multi ADV is not supported , extended ADV is supported.