Skip to content

Commit c31bbbe

Browse files
authored
Merge pull request #1074 from kernelkit/wifi-fixes
2 parents 88958a0 + 0d03f87 commit c31bbbe

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

package/feature-wifi/Config.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ config BR2_PACKAGE_FEATURE_WIFI
55
select BR2_PACKAGE_WPA_SUPPLICANT_DEBUG_SYSLOG
66
select BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN
77
select BR2_PACKAGE_WPA_SUPPLICANT_CLI
8+
select BR2_PACKAGE_WIRELESS_REGDB
9+
select BR2_PACKAGE_IW
810
help
911
Enables WiFi in Infix. Enables all requried applications.
1012

package/feature-wifi/feature-wifi.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ FEATURE_WIFI_PACKAGE_LICENSE = MIT
1010
define FEATURE_WIFI_LINUX_CONFIG_FIXUPS
1111
$(call KCONFIG_ENABLE_OPT,CONFIG_WLAN)
1212
$(call KCONFIG_ENABLE_OPT,CONFIG_RFKILL)
13-
$(call KCONFIG_ENABLE_OPT,CONFIG_MAC80211)
14-
$(call KCONFIG_ENABLE_OPT,CONFIG_CFG80211)
13+
$(call KCONFIG_SET_OPT,CONFIG_MAC80211,m)
14+
$(call KCONFIG_SET_OPT,CONFIG_CFG80211,m)
15+
1516
$(if $(filter y,$(BR2_PACKAGE_FEATURE_WIFI_DONGLE_REALTEK)),
1617
$(call KCONFIG_ENABLE_OPT,CONFIG_WLAN_VENDOR_REALTEK)
1718
$(call KCONFIG_ENABLE_OPT,CONFIG_RTW88)

src/confd/src/infix-if-wifi.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ static int wifi_gen_config(const char *ifname, const char *ssid, const char *cou
1212
char *encryption_str;
1313
int rc = SR_ERR_OK;
1414

15-
if (!secret || !ssid || !country || !encryption) {
15+
if (!secret && (ssid && country && encryption)) {
1616
/* Not an error, updated from two ways, interface cb and keystore cb. */
1717
return 0;
1818
}
@@ -24,15 +24,26 @@ static int wifi_gen_config(const char *ifname, const char *ssid, const char *cou
2424
}
2525

2626
fprintf(wpa, "# Generated by Infix confd\n");
27+
28+
fprintf(wpa, "if [ -f '/etc/finit.d/enabled/wifi@%s.conf' ];then\n", ifname);
29+
fprintf(wpa, "initctl -bfqn touch wifi@%s\n", ifname);
30+
fprintf(wpa, "else\n");
2731
fprintf(wpa, "initctl -bfqn enable wifi@%s\n", ifname);
32+
fprintf(wpa, "fi\n");
2833
fclose(wpa);
2934

3035
wpa_supplicant = fopenf("w", WPA_SUPPLICANT_CONF, ifname);
3136
if (!wpa_supplicant) {
3237
rc = SR_ERR_INTERNAL;
3338
goto out;
3439
}
35-
if (ssid) {
40+
41+
if (!secret || !ssid || !country || !encryption) {
42+
fprintf(wpa_supplicant,
43+
"ctrl_interface=/run/wpa_supplicant\n"
44+
"autoscan=periodic:10\n"
45+
"ap_scan=1\n");
46+
} else {
3647
if (!strcmp(encryption, "disabled")) {
3748
asprintf(&encryption_str, "key_mgmt=NONE");
3849
} else {
@@ -48,14 +59,7 @@ static int wifi_gen_config(const char *ifname, const char *ssid, const char *cou
4859
"ssid=\"%s\"\n"
4960
"%s\n"
5061
"}\n", country, ssid, encryption_str);
51-
free(encryption_str);
52-
} else {
53-
fprintf(wpa_supplicant,
54-
"ctrl_interface=/run/wpa_supplicant\n"
55-
"autoscan=periodic:10\n"
56-
"ap_scan=1\n");
57-
58-
62+
free(encryption_str);
5963
}
6064
fclose(wpa_supplicant);
6165

@@ -75,11 +79,6 @@ int wifi_gen(struct lyd_node *dif, struct lyd_node *cif, struct dagger *net)
7579
return wifi_gen_config(ifname, NULL, NULL, NULL, NULL, net);
7680
}
7781

78-
if (dif && !lydx_get_child(dif, "wifi")) {
79-
return SR_ERR_OK;
80-
}
81-
82-
8382
enabled = lydx_get_bool(cif, "enabled");
8483
wifi = lydx_get_child(cif, "wifi");
8584

0 commit comments

Comments
 (0)