Sometimes when I get visitors I am politely asked for the Wi-Fi password of my network. No problem with that but as my password even for the guest Wi-Fi is a bit complicated it’s a pain to type it in. A nice solution: My Wi-Fi router can display a 2D bar code in the Web-UI which most mobile devices can read today either in the camera app or with a separate bar code app and detect that it contains Wi-Fi configuration information.
While this works very nicely with my router at home, I do have some Wi-Fi access points that don’t have this function, so I was wondering how I could generate such a bar code myself.
Turns out that this is straight forward. Just run the following string through a 2D bar code generator you trust:
# General syntax WIFI:S:<SSID>;T:WPA;P:<password>;; # Example: WIFI:S:martin;T:WPA;P:bestpasswordever;;
Quick and easy!
sudo apt install qrencode
echo “WIFI:S:martin;T:WPA;P:bestpasswordever;;” | qrencode -t PNG -o wifi.png
(if you want to have a bigger QRCode, the “-s” parameter is what you are looking for)
Btw:
https://f-droid.org/en/packages/com.google.zxing.client.android/
can decode it and shows a “connect to network” button…
Ah, totally forgot
https://github.com/zxing/zxing/wiki/Barcode-Contents#wi-fi-network-config-android-ios-11
has some info about the format. I’m still looking for an RFC or similar though…
For something close to a definitive description of the WIFI URIs:
https://www.iana.org/assignments/uri-schemes/uri-schemes.xml
links to
https://www.iana.org/assignments/uri-schemes/prov/wifi
which, in turn, give the URL of a horrible-to-read PDF which contains the description.