Project

General

Profile

Actions

Feature #1063

open

Add phone mode to PiNet to configure WiFi

Added by Hammel 6 months ago. Updated 4 days ago.

Status:
In Progress
Priority:
Immediate
Assignee:
Target version:
Start date:
31 Oct 2023
Due date:
% Done:

90%

Estimated time:
Severity:
02 - High

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

Has duplicate Xeon - Feature #986: Check if PiNet works on PPPRejectedHammel18 May 2023

Actions
Blocked by Xeon - Bug #1137: No wifi interface foundIn ProgressHammel25 Apr 2024

Actions
Actions #1

Updated by Hammel 6 months 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.

Actions #2

Updated by Hammel 6 months 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.

Actions #3

Updated by Hammel 5 months ago

  • Severity changed from 03 - Medium to 02 - High
Actions #4

Updated by Hammel 22 days 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.

Actions #5

Updated by Hammel 16 days ago

  • % Done changed from 10 to 30

The simplelist widget is ready, I think. It's been added to libpigtk and it's test app.

I still need to add hidden text support to the textline widget. Then I can start to write the pinet UI for Xeon.

Actions #6

Updated by Hammel 15 days ago

Need multiple page keyboard with:
1. letters, upper and lower case
2. Numbers and punctuation

Might need a third page. Test with two pages to find out.

Actions #7

Updated by Hammel 11 days 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.

After validating the initial UI works on PPP, next steps.
  1. pinet-client needs an exit button to close app.
  2. pinet-client needs an accept button to accept config an configure network.
  3. Add wifiscan support to pnc library and then use it in pinet to get SSIDs.
  4. 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.

Actions #8

Updated by Hammel 5 days ago

  • % Done changed from 30 to 60

Most of this is implemented but needs testing, first on a laptop with wifi, then on PPP.
Also need to validate the wpa_supplicant.conf config that it generates.

Actions #9

Updated by Hammel 4 days 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.
Actions #10

Updated by Hammel 4 days 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.

Actions #11

Updated by Hammel 4 days ago

  • % Done changed from 60 to 90

Just needs testing on PPP. All code up to this point is committed and pushed.

Actions #12

Updated by Hammel 4 days ago

  • Has duplicate Feature #986: Check if PiNet works on PPP added
Actions #13

Updated by Hammel 3 days ago

  • Blocked by Bug #1137: No wifi interface found added
Actions

Also available in: Atom PDF