Allow wifi-connect to refresh networks while connected#492
Open
tomasgareau wants to merge 2 commits intobalena-os:masterfrom
Open
Allow wifi-connect to refresh networks while connected#492tomasgareau wants to merge 2 commits intobalena-os:masterfrom
tomasgareau wants to merge 2 commits intobalena-os:masterfrom
Conversation
This uses wifiscanner (which in turn uses iw) to scan for networks. This means we can refresh our list of networks while still providing an AP via NetworkManager. Unfortunately, wifiscanner does not currently parse security for networks on Linux, so we can't use its results. Fortunately, just doing the scan seems to be enough for NetworkManager to pick up the results!
Nickinthebox
added a commit
to mapado/wifi-connect
that referenced
this pull request
Nov 14, 2023
This didn't work for me on a pi4 for whatever reason. NetworkManager was only returning the broadcasted AP, even after the iw scan. I therefore switched to using a pull request on wifiscanner that has security info and adding the parsing of the results to I've created a new pull request of that here: #521 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This introduces a quick-and-dirty way that we could allow
wifi-connectto refresh its list of nearby APs without restarting the device or interrupting the captive portal. Not sure if this would work for all ofwifi-connect's use-cases but it has worked for us so I thought I'd put up a PR to see if there was any interest in this approach (or something like it).We fire off a
wifiscanner::scanon every call toactivate.wifiscannerusesiwunder the hood on Linux which means we can scan for nearby APs while still providing the captive portal via NetworkManager.We could convert the resultant
wifiscanner::Wifito aNetworkbut unfortunatelywifiscannerdoesn't currently parse security info from the output ofiw😬 Fortunately, this scan still seems to allow NetworkManager to discover new APs, so we can just refresh our list of access points andget_networksas usual.This means that every call to
/networkswill kick off a new scan. This should allow #354 to "just work" since it would get an updated list of networks every time. Otherwise I've found I can also just refresh the captive portal page.