Feature #1063
openAdd phone mode to PiNet to configure WiFi
90%
Description
When built for phones, PiNet should not try to setup an AP. Instead it should scan the wifi for open SSIDs and present in a full screen scrolled list.
It should also allow configuring a hidden SSID and set the password and security type for any selected SSID.
I may want to look if there is a wifi app already written for PPP.
Related issues
Updated by Hammel about 1 year ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
The best way to do this is to create a new GTK+ widget, based on the wifiscanwidget in pnc. In this case the trick will be to make not just a scrolled list but accept touch input to select one. For simplicity sake the list might be static with a left/right arrow to go to the next or previous set. That will be easier than try to write a bunch of code for allowing sliding a finger across the screen.
The widget will also require allowing input of a hidden SSID.
Updated by Hammel about 1 year ago
Note that PiNet has two build options: normal and headless. The latter compiles in most of the .c files. The former just compiles pinet.c. The headless mode is used for Ironman, but that mode may go away with PiBox 3.0.
For this version, another build option can be added that builds a new pinet.c plus the new GTK+ widget.
Updated by Hammel about 1 year ago
- Severity changed from 03 - Medium to 02 - High
Updated by Hammel 8 months ago
Now that pigtk is implemented for keyboard and textline widgets, a new widget can be written to display simple lists that are paged using left/right buttons. This can be used to display the available SSIDs found by scanning.
A selection widget might need to be written for choosing security model (like WSK/WPA Peronal, etc.) or I can just use something from the GTK2 widgets.
The keyboard and textline widget should be sufficient for input of hidden SSIDs and passwords, although the latter might need a "hidden" option added.
Updated by Hammel 8 months ago
Initial implementation of UI is ready and tested on build system.
Needs testing on PPP hardware - rebuilds are ready so just make the SD card and try it.
pinet-client needs an exit button to close app.pinet-client needs an accept button to accept config an configure network.- Add wifiscan support to pnc library and then use it in pinet to get SSIDs.
- Add network setup based on pinet config.
The wifiscan.c module from pnc library app can be copied to pinet and updated to just pull BSSIDs (we don't need channels). This will provide a mechanism for polling in a thread, which can then be queried by a timer_exec() function in the main to update the UI. Note: when the bss update is done, and we're not on the first page of ssids in the UI, we might not have enough SSIDs to fill to the page we're on, so be sure to check if we need to drop back to page 1.
Once we have the pw and ssid via the UI, on "accept" we can call a function like this (from pnc UI):
updateWPA()
{
gchar *value;
value = g_strdup(gtk_entry_get_text(GTK_ENTRY(pwField)));
pncSetWPAField( PNC_ID_WPA_PSK, value );
g_free(value);
value = g_strdup(gtk_entry_get_text(GTK_ENTRY(ssidText)));
pncSetWPAField( PNC_ID_WPA_SSID, value );
g_free(value);
}
Then the wpa config can be saved.
filename = pncGetFilename( PNC_ID_WPASUPPLICANT );
updateWPA();
pncSaveWPA(filename);
g_free(filename);
If -T is used I can use a test output file instead of PNC_ID_WPASUPPLICANT.
Updated by Hammel 7 months ago
Testing writing of the config file. File is not generated. Log shows this.
button_press[pinet-client.c:272] INFO Key: Enter gtk_textline_get[pigtk-textline.c:590] INFO Entered. gtk_textline_get[pigtk-textline.c:590] INFO Entered. pncSaveWPA[save.c:433] INFO pncSaveWPA: (null) pncSaveWPA[save.c:437] ERROR Failed to open wireless configuration file: (null) - Bad address gtk_keyboard_expose[pigtk-keyboard.c:725] INFO Entered.
Updated by Hammel 7 months ago
The pnc library was not initialized (pncInit()). Fixed that. Saved config file looks like this.
# Wireless configuration file # Created by pibox-network-config. # -------------------------------------- ctrl_interface=/var/run/wpa_supplicant ap_scan=1 network={ ssid="xxxxx" scan_ssid=1 proto=WPA RSN psk="tgb" pairwise=CCMP group=CCMP }
This looks good enough to test on the PPP.
Updated by Hammel 7 months ago
- Has duplicate Feature #986: Check if PiNet works on PPP added