wifisniffer.cpp: settings changed

This commit is contained in:
Klaus K Wilting 2018-03-20 22:58:51 +01:00
parent daa0b2e58e
commit 825943c2e5
2 changed files with 9 additions and 25 deletions

View File

@ -1,5 +1,5 @@
// program version // program version
#define PROGVERSION "1.2.2" // use max 10 chars here! #define PROGVERSION "1.2.21" // use max 10 chars here!
#define PROGNAME "PAXCNT" #define PROGNAME "PAXCNT"
// Verbose enables serial output // Verbose enables serial output

View File

@ -13,23 +13,6 @@
#include <esp_event.h> #include <esp_event.h>
#include <esp_event_loop.h> #include <esp_event_loop.h>
#define WIFI_INIT_CONFIG_PAXCOUNTER() { \
.event_handler = &esp_event_send, \
.wpa_crypto_funcs = g_wifi_default_wpa_crypto_funcs, \
.static_rx_buf_num = CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM,\
.dynamic_rx_buf_num = CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM,\
.tx_buf_type = CONFIG_ESP32_WIFI_TX_BUFFER_TYPE,\
.static_tx_buf_num = WIFI_STATIC_TX_BUFFER_NUM,\
.dynamic_tx_buf_num = WIFI_DYNAMIC_TX_BUFFER_NUM,\
.ampdu_rx_enable = WIFI_AMPDU_RX_ENABLED,\
.ampdu_tx_enable = WIFI_AMPDU_TX_ENABLED,\
.nvs_enable = 0,\
.nano_enable = WIFI_NANO_FORMAT_ENABLED,\
.tx_ba_win = WIFI_DEFAULT_TX_BA_WIN,\
.rx_ba_win = WIFI_DEFAULT_RX_BA_WIN,\
.magic = WIFI_INIT_CONFIG_MAGIC\
};
// Local logging tag // Local logging tag
static const char *TAG = "wifisniffer"; static const char *TAG = "wifisniffer";
@ -61,13 +44,14 @@ typedef struct {
} wifi_ieee80211_packet_t; } wifi_ieee80211_packet_t;
void wifi_sniffer_init(void) { void wifi_sniffer_init(void) {
wifi_init_config_t cfg = WIFI_INIT_CONFIG_PAXCOUNTER(); wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); cfg.nvs_enable = 0; // we don't want wifi settings from NVRAM
ESP_ERROR_CHECK( esp_wifi_set_country(&wifi_country) ); ESP_ERROR_CHECK(esp_wifi_init(&cfg));
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) ); ESP_ERROR_CHECK(esp_wifi_set_country(&wifi_country));
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_NULL) ); //ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
ESP_ERROR_CHECK( esp_wifi_start() ); //ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_NULL) );
ESP_ERROR_CHECK( esp_wifi_set_max_tx_power(-128) ); // we don't need to TX, so we use lowest power level to save energy //ESP_ERROR_CHECK( esp_wifi_start() );
//ESP_ERROR_CHECK( esp_wifi_set_max_tx_power(-128) ); // we don't need to TX, so we use lowest power level to save energy
wifi_promiscuous_filter_t filter = {.filter_mask = WIFI_PROMIS_FILTER_MASK_MGMT}; // we need only MGMT frames wifi_promiscuous_filter_t filter = {.filter_mask = WIFI_PROMIS_FILTER_MASK_MGMT}; // we need only MGMT frames
ESP_ERROR_CHECK(esp_wifi_set_promiscuous_filter(&filter)); // set MAC frame filter ESP_ERROR_CHECK(esp_wifi_set_promiscuous_filter(&filter)); // set MAC frame filter
ESP_ERROR_CHECK(esp_wifi_set_promiscuous_rx_cb(&wifi_sniffer_packet_handler)); ESP_ERROR_CHECK(esp_wifi_set_promiscuous_rx_cb(&wifi_sniffer_packet_handler));