From 1f06c1deed15c83450c97c8416c5b75507a53926 Mon Sep 17 00:00:00 2001 From: CattySteve Date: Wed, 22 Nov 2023 20:42:15 +0800 Subject: [PATCH] Add 802.11ax capability and UI --- src/scripts/create_ap.conf | 1 + src/ui/glade/wifih.ui | 412 ++++++++++++++++++++----------------- src/ui/h_prop.c | 4 + src/ui/read_config.cpp | 3 + src/ui/read_config.h | 2 + src/ui/ui.c | 12 ++ 6 files changed, 245 insertions(+), 189 deletions(-) diff --git a/src/scripts/create_ap.conf b/src/scripts/create_ap.conf index aa4527d..029adea 100644 --- a/src/scripts/create_ap.conf +++ b/src/scripts/create_ap.conf @@ -12,6 +12,7 @@ ISOLATE_CLIENTS=0 SHARE_METHOD=nat IEEE80211N=0 IEEE80211AC=0 +IEEE80211AX=0 HT_CAPAB=[HT40+] VHT_CAPAB= DRIVER=nl80211 diff --git a/src/ui/glade/wifih.ui b/src/ui/glade/wifih.ui index bb38fec..d339338 100644 --- a/src/ui/glade/wifih.ui +++ b/src/ui/glade/wifih.ui @@ -1,34 +1,31 @@ - + True - False + False Wi Hotspot - - - True - False - 5 - 10 + False + 5 + 10 vertical 5 True - False + False 3 True True - False + False start - 10 + 10 SSID @@ -41,7 +38,7 @@ True - True + True False @@ -53,13 +50,13 @@ True - False - 20 + False + 20 10 True - False + False Password @@ -72,11 +69,11 @@ Open True - True - False + True + False start - 10 - True + 10 + True False @@ -94,7 +91,7 @@ True - True + True False @@ -114,14 +111,14 @@ True - False + False True True - False + False start - 10 + 10 Wifi interface @@ -134,7 +131,7 @@ True - False + False False @@ -146,9 +143,9 @@ True - False + False start - 20 + 20 Internet interface @@ -161,7 +158,7 @@ True - False + False False @@ -181,7 +178,7 @@ True - False + False False @@ -192,224 +189,225 @@ True - True - True - True + True + True + True True - True - never - in - 160 - True + True + never + in + 160 + True True - False + False True - False + False vertical + True - False - 10 - 5 - 10 - True + False + 10 + 5 + 10 + True 2.4Ghz True - True - False - True + True + False + True rb_freq_auto - 2 - 0 + 2 + 0 Auto True - True - False - True + True + False + True rb_freq_5 - 1 - 0 + 1 + 0 True - False + False start Frequency band - 0 - 0 + 0 + 0 5Ghz True - True - False - True + True + False + True rb_freq_auto - 3 - 0 + 3 + 0 Hidden True - True - False - True + True + False + True - 0 - 1 + 0 + 1 Use psk True - True - False - True + True + False + True - 0 - 2 + 0 + 2 Set MAC True - True - False - True + True + False + True - 0 - 3 + 0 + 3 True - True + True start - 1 - 3 + 1 + 3 No Virt True - True - False - Do not create virtual interface - True + True + False + Do not create virtual interface + True - 0 - 4 + 0 + 4 Channel True - True - False - True + True + False + True - 0 - 5 + 0 + 5 True - True + True start - 1 - 5 + 1 + 5 Gateway True - True - False - True + True + False + True - 0 - 6 + 0 + 6 True - True + True start - 1 - 6 + 1 + 6 Mac Filter True - True - False - True + True + False + True - 0 - 7 + 0 + 7 True - True - False - GTK_INPUT_HINT_UPPERCASE_CHARS | GTK_INPUT_HINT_NONE + True + False + GTK_INPUT_HINT_UPPERCASE_CHARS | GTK_INPUT_HINT_NONE True - 1 - 7 + 1 + 7 2 @@ -417,43 +415,53 @@ IEEE80211n True - True - False - True + True + False + True - 0 - 9 - - - - - IEEE80211ac - True - True - False - True - - - 2 - 9 + 0 + 9 No Haveged True - True - False - True + True + False + True - 0 - 10 + 0 + 10 - + + IEEE80211ac + True + True + False + True + + + 1 + 9 + + + + + IEEE80211ax + True + True + False + True + + + 2 + 9 + @@ -543,7 +551,7 @@ True - False + False Advanced @@ -557,71 +565,96 @@ True - True + True True - True - in - 100 + True + in + 100 True - False + False True - False + False vertical + True - False - True + False + True True - False + False Number - 0 - 0 + 0 + 0 True - False + False Hostname - 1 - 0 + 1 + 0 True - False + False IP - 2 - 0 + 2 + 0 True - False + False MAC - 3 - 0 + 3 + 0 + + + + + + + + + + + + + + + + + + + + + + + + False @@ -630,12 +663,13 @@ + True - False - True - True - 1 + False + True + True + 1 @@ -674,13 +708,13 @@ Refresh True - True - True + True + True False True - end + end 2 @@ -693,7 +727,7 @@ True - False + False Connected devices @@ -707,14 +741,14 @@ True - False + False end About True - True - True + True + True False @@ -727,8 +761,8 @@ Open QR True - True - True + True + True False @@ -740,15 +774,15 @@ Create hotspot True - True - True + True + True end False True 10 - end + end 2 @@ -756,8 +790,8 @@ Stop True - True - True + True + True end @@ -778,12 +812,12 @@ True - False - 10 - 10 - 1 - 1 - 0.20000000000000001 + False + 10 + 10 + 1 + 1 + 0.20 False @@ -794,7 +828,7 @@ True - False + False False @@ -805,17 +839,17 @@ True - False - 5 + False + 5 vertical True - False + False start - 5 - 1 - 1 + 5 + 1 + 1 Running status @@ -827,7 +861,7 @@ True - False + False center @@ -840,7 +874,7 @@ False True - end + end 8 diff --git a/src/ui/h_prop.c b/src/ui/h_prop.c index 7c50d30..06bda69 100644 --- a/src/ui/h_prop.c +++ b/src/ui/h_prop.c @@ -136,6 +136,10 @@ const char *build_wh_mkconfig_command(ConfigValues* cv){ strcat(cmd_mkconfig," --ieee80211ac "); } + if(cv->ieee80211ax!=NULL && (strcmp(cv->ieee80211ax,"1") == 0)){ + strcat(cmd_mkconfig," --ieee80211ax "); + } + if(cv->mac!=NULL) { strcat(cmd_mkconfig, " --mac "); strcat(cmd_mkconfig, cv->mac); diff --git a/src/ui/read_config.cpp b/src/ui/read_config.cpp index 3e2dc72..7148a95 100644 --- a/src/ui/read_config.cpp +++ b/src/ui/read_config.cpp @@ -133,6 +133,9 @@ static void setConfigValues(const char * key, char *value){ if( !strcmp ( IEEE80211AC, key )) configValues.ieee80211ac = value; + + if( !strcmp ( IEEE80211AX, key )) + configValues.ieee80211ax = value; if( !strcmp ( GATEWAY, key )) configValues.gateway = value; diff --git a/src/ui/read_config.h b/src/ui/read_config.h index 2fb240f..51996ae 100644 --- a/src/ui/read_config.h +++ b/src/ui/read_config.h @@ -52,6 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define SHARE_METHOD "SHARE_METHOD" #define IEEE80211N "IEEE80211N" #define IEEE80211AC "IEEE80211AC" +#define IEEE80211AX "IEEE80211AX" #define HT_CAPAB "HT_CAPAB" #define VHT_CAPAB "VHT_CAPAB" #define DRIVER "DRIVER" @@ -91,6 +92,7 @@ typedef struct{ char *accepted_macs; char *ieee80211n; char *ieee80211ac; + char *ieee80211ax; char *no_haveged; char *gateway; } ConfigValues; diff --git a/src/ui/ui.c b/src/ui/ui.c index d43cd8c..63c6c74 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -98,6 +98,7 @@ GtkCheckButton *cb_open; GtkCheckButton *cb_mac_filter; GtkCheckButton *cb_ieee80211n; GtkCheckButton *cb_ieee80211ac; +GtkCheckButton *cb_ieee80211ax; GtkProgressBar *progress_bar; @@ -440,6 +441,7 @@ int initUi(int argc, char *argv[]){ cb_mac_filter = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_mac_filter"); cb_ieee80211n = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_ieee80211n"); cb_ieee80211ac= (GtkCheckButton *) gtk_builder_get_object(builder, "cb_ieee80211ac"); + cb_ieee80211ax= (GtkCheckButton *) gtk_builder_get_object(builder, "cb_ieee80211ax"); rb_freq_auto = (GtkRadioButton *) gtk_builder_get_object(builder, "rb_freq_auto"); rb_freq_2 = (GtkRadioButton *) gtk_builder_get_object(builder, "rb_freq_2"); @@ -557,6 +559,11 @@ void init_ui_from_config(){ gtk_toggle_button_set_active((GtkToggleButton*) cb_ieee80211ac,TRUE); } + if(strcmp(values->ieee80211ax,"1")==0){ + + gtk_toggle_button_set_active((GtkToggleButton*) cb_ieee80211ax,TRUE); + } + if(strcmp(values->channel,"")!=0 && strcmp(values->channel,"default")!=0){ gtk_toggle_button_set_active((GtkToggleButton*) cb_channel,TRUE); gtk_entry_set_text(entry_channel,values->channel); @@ -943,6 +950,11 @@ static int init_config_val_input(ConfigValues* cv){ else cv->ieee80211ac =NULL; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb_ieee80211ax))) + cv->ieee80211ax = "1"; + else + cv->ieee80211ax =NULL; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb_mac_filter))){ cv->mac_filter = "1";