RetroPie Wifi Manager
-
Is there a problem with the video ? I can't get it to load (tried a few browsers).
It just shows 'Your video will be ready soon' with a spinning circle, like it would try to play it. -
@mitu That's weird.
I uploaded it to google drive, https://drive.google.com/file/d/15PjZa1qhb11TM-axPPGbGrH7b8z6ZfTh/view?usp=sharing, let's hope this works ^^
Let's try YouTube: -
@philcomm Your timing on this thread is freaky --- I was going to iterate on this since I have a GPi case coming (hopefully today!) and poke that thread again after I've had a chance to look at this some more.
I've tried a few different approaches to trying to solve this problem, but all are pretty clunky. I tried using universal server to use my phone as a keyboard, and also running and swapping wifi configuration by running scripts directly on my then-rooted phone. My latest is hardcoding the credentials for my phone hotspot and configuring that on the Pi with a script, then connecting via SSH with my phone and configuring it with another script to another hotspot. In theory that's not as bad as what I was trying before, but again, clunky, so I'd love to help out and test this.
I'm planning on scripting a few additional things as well like having different modes switched by the shutdown script switch on the back of the Gpi to switch themes, controller configuration, maybe disable samba for traveling, stuff like that, using the basic forked configuration file swap approach I pasted in the thread you mentioned --- the optimal thing I want to unlock is to plug this in via HDMI to a hotel TV and connect home via Kodi's Plex AddOn, controlling it via Kore on my phone.
Let me know if I can help! I'm going to be doing a bit of traveling so I hope to go through some basic scenarios.
EDIT: From your video there I can't tell how you configured/selected the network SID?
-
@paradoxgbb haha that's weird indeed.
I also tried different methods before and they didn't work well enough for my non IT friends.
So first I tried making a nice UI with python, but python is not my strength as well as ui without a window manager.
For this version, I am using Ruby 2.5.5 as a base (not the latest version, but the newest on the pi dependencies) and
curses
as the terminal cli.
Lucky enough, retropie maps the controller buttons to keyboard buttons, with the DPAD being the arrow keys, A being Enter and B being Space. So I just capture the controller inputs as keyboard inputs.Currently I have 3 screens coded:
The first one is for wifi selection. In the background it runs an
iwlist
which gives back all the networks. I run this through a regex to get the ssids. I also parse thewpa_supplicant.conf
to check if a config for that ap already exists (this is not included in the video, I have done some work since the video). you can go up and down and select a wifi, and you are then redirected to page 2.Page 2 is where the cool stuff happens. You can enter the password for the wifi here. I added a virtual keyboard, which lets you enter most of characters by selecting them via the dpad and then press a to append to the password. There is also a Shift state toggle. Then you select
Connect
, and you are redirected to the third page.The third page will take the ssid and password and run it through
wpa_passphrase
, which gives back a network configuration with the hashed password I can then append to thewpa_supplicant.conf
.Now that is the current state, but I am not quite finished yet.
I still haven't 100% figured out how to parse the full config file. Optimally, I don't wanna create two network configurations for the same network, so I need to be able to override them (which I have no idea how to right now).
I also would like to be able to delete networks and set priorities.
My main issue is that I need to take the config apart, do my changes, then put it back together with the new changes, and then overwrite the old file. Might take some time to figure this out though.I really hope someone from the RetroPie team sees this and is interested. I am probably not gonna make another pull request, just for it to be totally ignored again.
I think this is really gonna improve RetroPie, a lot of people would like to see something like this. -
@philcomm For what it's worth, I agree with you very much. I didn't really expect pushback in that other thread, but I did, a bit. The fact is people want to travel with their pis, and some others feel that this is outside the bounds of the project.
In my scripts I was leveraging generating wifikeyfile.txt (in clear text!) and dropping it into /boot. Then you can import it with RetroPie's existing wifi configuration screens.
I think the sticking point might be that there's not firm consensus on the cleanest way to integrate to get the job done. The previous approach was to build this in emulationstation but that doesn't directly configure WiFi. The existing screens RetroPie-Setup uses might be able to be extended, but I'm not sure what dependencies they leverage to work without digging.
Good luck and again, let me know if you want another pair of eyes.
-
@paradoxgbb said in RetroPie Wifi Manager:
@philcomm For what it's worth, I agree with you very much. I didn't really expect pushback in that other thread, but I did, a bit. The fact is people want to travel with their pis, and some others feel that this is outside the bounds of the project.
In my scripts I was leveraging generating wifikeyfile.txt (in clear text!) and dropping it into /boot. Then you can import it with RetroPie's existing wifi configuration screens.
I think the sticking point might be that there's not firm consensus on the cleanest way to integrate to get the job done. The previous approach was to build this in emulationstation but that doesn't directly configure WiFi. The existing screens RetroPie-Setup uses might be able to be extended, but I'm not sure what dependencies they leverage to work without digging.
Good luck and again, let me know if you want another pair of eyes.
I kinda get the RetroPie team on the topic of not baking a OSK into emulationstation, since this would mean they need to make a seperate build of
es
and then constantly rebasing it on a new release and making sure it works. So I think my solution is more reasonable. I would really be interested how thewifikeyfile.txt
stuff works, so far I have only worked with thewpa_supplicant.conf
(just a minute ago I finished the full parsing, so now I can disassemble it, do changes programatically, assemble it and then write it to the file). -
@philcomm Since you seem interested, this is an earlier version of the script I was using. It's super easy, just put the sid and psk and that's all you have to do. Very little fuss. I had another script that copied this into \boot. On the wifi screen option 3 allows you to import the credentials from there, so the integration might be easier as you won't have to deal with hashing. Since it's in a more secure cleartext should be ok to store temporarily but you'll need sudo.
#!/bin/bash ########## # GLOBALS ########## exportTarget="/home/pi/RetroPie/roms/wifikeyfile.txt" defaultssid="GregMotoX4" function logInfo() { echo [$(date)] $1 } ####### # MAIN ####### echo currentssid=$(wpa_cli get_network 0 ssid) currentssid=$(echo "$currentssid" | tail -1) #Second line currentssid=$(echo ${currentssid//$'"'}) #Trim quotes if [ "[$currentssid]" != "[FAIL]" ] && [ "[$currentssid]" != "[Using interface 'wlan0']" ]; then logInfo "Detected current SSID...[$currentssid]" defaultssid=$currentssid fi logInfo "Default SSID if entered blank: [$defaultssid]" read -p $'SSID: \x0a' ssid=${REPLY//$'\r\n'} logInfo "ENTERED SSID: [$ssid]" if [ "[$ssid]" == "[]" ]; then logInfo "SSID not set! Using default..." ssid=$defaultssid fi read -p $'PSK: \x0a' psk=${REPLY//$'\r\n'} logInfo "ENTERED PSK: [$psk]" if [ "[$psk]" == "[]" ]; then logInfo "PSK not set! Try again." exit fi if [ -f $exportTarget ]; then logInfo "Target [$exportTarget] found. Overwriting..." fi echo ssid=\"$ssid\" > $exportTarget echo psk=\"$psk\" >> $exportTarget logInfo "Done!" echo
-
The gdrive link worked, thanks.
Looks nice, it reminds me of the stage password screen for old games. -
Quick update on the project:
It is now in a fully usable state.
First you have the wifi selection screen where you ... select your wifi. If you select one that is already saved, a prompt pops up asking if you wanna proceed since the old config will be overwritten.
Then you need to enter the password. B now acts as backspace, so you don't need to use the one on the OSK.
The next screen shows the integrity of the entered password. Since
wpa_passphrase
, which I use to generate the config text, requires at least 8 characters, this needs to be checked before saving.If everything is valid, the next step then puts together the old
wpa_supplicant.conf
with the new network. The generated network also getspriority=1
, all other networks getpriority=0
.
Then the config is saved and the network card restarted.The next step is to add wifi deletion from the selection screen. I also wanna have a
set priority
button or something on the same page.I am really happy how this turned out. I will create a PR to the
RetroPie-Setup
repo, hopefully someone will look into it. -
Please send it some love: https://github.com/RetroPie/RetroPie-Setup/pull/3429
-
@paradoxgbb if you are interested,
wget -P /home/pi/RetroPie-Setup/scriptmodules/supplementary/ "https://raw.githubusercontent.com/OfficialPhilcomm/retropie-wifi-manager/master/advanced-wifi.sh"
will download a config file into your RetroPie-Setup. You can then open RetroPie Setup from EmulationStation -> Manage packages -> experimental -> advanced-wifi. Let me know your thoughts, would love to hear them! -
@philcomm I will very soon, thanks. Probably won't be until Monday or Tuesday though... good luck with the PR, I'll nudge there when I have the chance to play.
-
@philcomm if one would like to keep the local master of
RetroPie-Setup
clean (which has serveral advantages), it can be done by creating a local branch with your proposed pull request, as outlined here: https://retropie.org.uk/forum/post/260327 - saves you the burden of adding/removing files to/from the local master explicitly. -
@lolonois Thank you, I might do this when they don't accept the PR.
-
In the meantime, here are some development updates:
-
@philcomm my git hint was more general for anyone interested to testdrive your proposed change/PR. I just missed to remove your handle :/ -- However, your PR looks very promising.
-
@lolonois Thanks! I really hope it gets accepted. I put a solid 20 hours into this so far.
-
@lolonois said in RetroPie Wifi Manager:
@philcomm my git hint was more general for anyone interested to testdrive your proposed change/PR. I just missed to remove your handle :/ -- However, your PR looks very promising.
https://github.com/RetroPie/RetroPie-Setup/pull/3429#issuecomment-974847831 :(
-
@philcomm Sorry for the PR not being accepted, unfortunately maintainance considerations are always a big factor for new additions in RetroPie.
I liked your idea of adding a text (curses) based OSK and the minimal ui. My intention was to add some sort of OSK and was considering something SDL based (either
python-sdl2
orpython-imgui[sdl]
so it would be easy to script).I experimented a bit with the urwid
python
library to add a simple input box to the WiFi module. My main goals were to make it work withjoy2key
and to look similar to the existing text UI (based ondialog
) that RetroPie-Setup uses.It turned out pretty close to the
dialog
based screensDefault view Smaller screen Error message I have submitted a PR with this and some minor changes to the WiFi module.
NOTE: the changes I proposed don't include support for multiple networks or prioritization (which your WiFi manager has), but I think these can be added later in the main WiFi module.
-
@mitu Nice, I will check it out later!
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.