Active scanning failed to start (err -134)
param.type = BT_LE_SCAN_TYPE_ACTIVE;
param.options = BT_LE_SCAN_OPT_NONE;
param.interval = BT_GAP_SCAN_FAST_INTERVAL;
param.window = BT_GAP_SCAN_FAST_WINDOW;
// err = bt_le_scan_start(BT_LE_SCAN_ACTIVE, scan_results_cbk); // this has
// filter duplicate option set
err = bt_le_scan_start(¶m, scan_results_cbk);
if (err) {
LOG_ERR("Scanning failed to start (err %d)", err);
return;
}
--
alok
Hi Alok,
I suspect the reason might be that you’re not explicitly setting the param.timeout field, so it’s left uninitialized and potentially containing a non-zero value (which causes the -ENOTSUP error return). It would be safer to initialize the struct in the following way, so that any members you don’t explicitly mention get implicitly initialized to zero:
struct bt_le_scan_param param = {
.type = BT_LE_SCAN_TYPE_ACTIVE,
.options = BT_LE_SCAN_OPT_NONE,
…
};
Johan
From:
users@... <users@...> on behalf of Alok Sethi <alok.sethi1@...>
Date: Thursday, 20. October 2022 at 23.27
To: users@... <users@...>
Subject: [Zephyr-users] Active scanning failed to start (err -134)
Hi,
I am trying to start active scanning, however I do want the duplicates.
For this i am giving "BT_LE_SCAN_OPT_NONE" option in parameters to the `bt_le_scan_start`.
This however is resulting in error -134, which seems to be "ENOTSUP".
This does not make much sense to me as this problem is intermittent, as in it is somehow related to compilation and binary.
Scanning is working without this option though, i.e., if I just give `BT_LE_SCAN_ACTIVE` as parameter, then scanning works and I get the scan results.
Please advise.
struct bt_le_scan_param param;
param.type = BT_LE_SCAN_TYPE_ACTIVE;
param.options = BT_LE_SCAN_OPT_NONE;
param.interval = BT_GAP_SCAN_FAST_INTERVAL;
param.window = BT_GAP_SCAN_FAST_WINDOW;
// err = bt_le_scan_start(BT_LE_SCAN_ACTIVE, scan_results_cbk); // this has
// filter duplicate option set
err = bt_le_scan_start(¶m, scan_results_cbk);
if (err) {
LOG_ERR("Scanning failed to start (err %d)", err);
return;
}
--
BR
alok