nerves-networking / vintage_net_wifi

WiFi networking for VintageNet
Apache License 2.0
32 stars 18 forks source link

Noisy logs when wifi not configured in config.exs #92

Open axelson opened 2 years ago

axelson commented 2 years ago

Describe the bug vintage_net_wifi generates noisy logs even when not configured for wifi

To Reproduce Steps to reproduce the behavior:

  1. Run a project that does not configures VintageNetWifi in config.exs
  2. Connect to the device via ssh
  3. Run RingLogger.attach
  4. Every 5 seconds or so you get the following 4 log messages
07:41:59.148 [info]  WPASupplicant ignoring {:event, "WPS-AP-AVAILABLE"}
07:41:59.169 [debug] wpa_supplicant: wlan0: Failed to initiate sched scan
07:41:59.170 [info]  wpa_supplicant(wlan0): Failed to initiate sched scan
07:41:59.172 [info]  WPASupplicant ignoring {:event, "CTRL-EVENT-NETWORK-NOT-FOUND"}
07:42:04.678 [info]  WPASupplicant ignoring {:event, "WPS-AP-AVAILABLE"}
07:42:04.699 [debug] wpa_supplicant: wlan0: Failed to initiate sched scan
07:42:04.701 [info]  wpa_supplicant(wlan0): Failed to initiate sched scan
07:42:04.702 [info]  WPASupplicant ignoring {:event, "CTRL-EVENT-NETWORK-NOT-FOUND"}

Expected behavior Instead I'd expect it to not log or try to connect

VintageNet Info

Output of VintageNet.info (please hide any sensitive information like WiFi PSKs)

iex(livebook@nerves-517f.local)7> VintageNet.info
VintageNet 0.11.2

All interfaces:       ["lo", "usb0", "wlan0"]
Available interfaces: []

Interface usb0
  Type: VintageNetDirect
  Present: true
  State: :configured (0:10:15)
  Connection: :lan (0:10:15)
  Addresses: fe80::bc84:e0ff:fe43:5c57/64, 172.31.219.153/30
  Configuration:
    %{type: VintageNetDirect}

Interface wlan0
  Type: VintageNet.Technology.Null
  Present: true
  State: :configured (0:10:16)
  Connection: :disconnected (0:10:16)
  Configuration:
    %{type: VintageNet.Technology.Null}

Note: this was take after running VintageNet.deconfigure

Environment

|nerves_bootstrap| Loadpaths Start

Nerves environment MIX_TARGET: rpi0 MIX_ENV: dev

|nerves_bootstrap| Environment Variable List target: rpi0 toolchain: /home/jason/.local/share/nerves/artifacts/nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-1.4.3 system: /home/jason/.local/share/nerves/artifacts/nerves_system_rpi0-portable-1.17.1 app: .

|nerves_bootstrap| Loadpaths End

Note: originally I was going to report this as vintage_net_wifi trying to connect even when not configured but now I'm not able to reproduce that anymore (I doubt that `VintageNet.deconfigure persists). Of course now after rebooting I'm not able to reproduce it anymore!

Okay, after actually reading the VintageNet.configure docs (and checking in the code), it turns out that VintageNet.deconfigure actually persists, which totally caught me off guard. So I guess this issue should actually be about not trying to scan when not "configured". I'm using configured here to refer to the configuration files (e.g. config.exs), not VintageNet's definition of "configured".