Wifi sniffer promiscuous & BLE coexistence
Posted: Mon Sep 25, 2017 6:51 am
I need to sniffer around macs, and then post them to android phone via BLE.
But It comes to error.
my code is
crash messageļ¼
But It comes to error.
my code is
Code: Select all
// init wifi sniffer
esp_err_t ret;
// Initialize NVS
ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES)
{
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
tcpip_adapter_init();
one_shot_timer_start();
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL));
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM));
// ESP_ERROR_CHECK(esp_wifi_set_promiscuous_filter(WIFI_PROMIS_FILTER_MASK_MGMT));
ESP_ERROR_CHECK(esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb));
ESP_ERROR_CHECK(esp_wifi_set_promiscuous(true));
// ble init
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
ret = esp_bt_controller_init(&bt_cfg);
if (ret) {
ESP_LOGE(GATTS_TAG, "%s initialize controller failed\n", __func__);
return;
}
ret = esp_bt_controller_enable(ESP_BT_MODE_BTDM);
if (ret) {
ESP_LOGE(GATTS_TAG, "%s enable controller failed\n", __func__);
return;
}
ret = esp_bluedroid_init();
if (ret) {
ESP_LOGE(GATTS_TAG, "%s init bluetooth failed\n", __func__);
return;
}
ret = esp_bluedroid_enable();
if (ret) {
ESP_LOGE(GATTS_TAG, "%s enable bluetooth failed\n", __func__);
return;
}
ret = esp_ble_gatts_register_callback(gatts_event_handler);
if (ret){
ESP_LOGE(GATTS_TAG, "gatts register error, error code = %x", ret);
return;
}
ret = esp_ble_gap_register_callback(gap_event_handler);
if (ret){
ESP_LOGE(GATTS_TAG, "gap register error, error code = %x", ret);
return;
}
ret = esp_ble_gatts_app_register(PROFILE_A_APP_ID);
if (ret){
ESP_LOGE(GATTS_TAG, "gatts app register error, error code = %x", ret);
return;
}
// ret = esp_ble_gatts_app_register(PROFILE_B_APP_ID);
// if (ret){
// ESP_LOGE(GATTS_TAG, "gatts app register error, error code = %x", ret);
// return;
// }
esp_err_t local_mtu_ret = esp_ble_gatt_set_local_mtu(500);
if (local_mtu_ret){
ESP_LOGE(GATTS_TAG, "set local MTU failed, error code = %x", local_mtu_ret);
}
Code: Select all
I (1370) cpu_start: App cpu up.
I (1383) heap_init: Initializing. RAM available for dynamic allocation:
I (1404) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (1423) heap_init: At 3FFD9270 len 00006D90 (27 KiB): DRAM
I (1442) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (1462) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1482) heap_init: At 400923CC len 0000DC34 (55 KiB): IRAM
I (1501) cpu_start: Pro cpu start user code
assertion "res == pdTRUE" failed: file "/Users/wiki/esp/esp-idf/components/esp32/./dport_access.c", line 184, function: esp_dport_access_int_init
abort() was called at PC 0x40100c8b on core 0
0x40100c8b: __assert_func at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdlib/../../../.././newlib/libc/stdlib/assert.c:63 (discriminator 8)
Backtrace: 0x400892e4:0x3ffe3b50 0x400893e3:0x3ffe3b70 0x40100c8b:0x3ffe3b90 0x400d0e9a:0x3ffe3bc0 0x40080e3c:0x3ffe3bf0 0x4008107d:0x3ffe3c20 0x40078c12:0x3ffe3c40 0x40078cc5:0x3ffe3c70 0x40078f2e:0x3ffe3cb0 0x40079073:0x3ffe3e70 0x40007c31:0x3ffe3eb0 0x4000073d:0x3ffe3f20
0x400892e4: invoke_abort at /Users/wiki/esp/esp-idf/components/esp32/./panic.c:553
0x400893e3: abort at /Users/wiki/esp/esp-idf/components/esp32/./panic.c:553
0x40100c8b: __assert_func at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdlib/../../../.././newlib/libc/stdlib/assert.c:63 (discriminator 8)
0x400d0e9a: esp_dport_access_int_init at /Users/wiki/esp/esp-idf/components/esp32/./dport_access.c:184 (discriminator 1)
0x40080e3c: start_cpu0_default at /Users/wiki/esp/esp-idf/components/esp32/./cpu_start.c:324
0x4008107d: call_start_cpu0 at /Users/wiki/esp/esp-idf/components/esp32/./cpu_start.c:207