I am trying to support this device (it's on some legacy hardware and there's no chance to replace it with something else during migration to openWRT).
The device (at least v2 and v3) are based on the Realtek 8188 chipset. I managed to compile the driver (currently in staging) on v22.03. I see that the driver is loaded and I can scan wifi networks using:
ubus call iwinfo scan '{"device":"wlan1"}
But I don't see the device in the interfaces/devices/wireless configuration pages of LUCI.
I think it's because the driver does not support CFG80211 (that is still in the TODO list, even in latest kernel releases).
I tried to have it supported by adding a new network device type and providing scripts under /lib/wifi/r8188.sh and /lin/netifd/wireless/r8188.sh.
This is my wifi configuration script:
check_r8188_device() {
config_get devtype "$1" type
[ "$devtype" = "r8188" ] && found=1
}
detect_r8188() {
config_load wireless
found=0
config_foreach check_r8188_device wifi-device
[ "$found" = 0 ] && {
uci -q batch <<-EOF
set wireless.wlan1=wifi-device
set wireless.wlan1.type=r8188
set wireless.wlan1.band=2g
set wireless.wlan1.disabled=0
set wireless.wlan1.channel=auto
set wireless.default_wlan1=wifi-iface
set wireless.default_wlan1.device=wlan1
set wireless.default_wlan1.network=wlan1
set wireless.default_wlan1.mode=sta
set wireless.default_wlan1.encryption=psk2
EOF
uci -q commit wireless
}
}
I also added a network interface (via uci-default script):
uci set network.wlan1=interface
uci set network.wlan1.proto='dhcp'
uci set network.wlan1.device='wlan1'
uci commit network
In this way I am able to run the scan command and configure the network, but I can't choose an encryption type and don't see the connection as active.
I tried to add netifd script by copying the reference one (netifd-2022-08-25-76d2d41b/examples/wireless/mac80211.sh) changing script and function names.
Is this the right way to support such a legacy driver?
Is there some documentation about those scripts and what they are supposed to do to activate a connection (I just need client mode, no need to have it working as AP)?
I tried to run wpa_supplicant after having created a conf file with my SSID/credentials, but I got some errors:
wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan1
Successfully initialized wpa_supplicant
Could not read interface wlan1 flags: No such device
nl80211: Driver does not support authentication/association or connect commands
nl80211: deinit ifname=wlan1 disabled_11b_rates=0
Could not read interface wlan1 flags: No such device
wlan1: Failed to initialize driver interface
wlan1: CTRL-EVENT-DSCP-POLICY clear_all
May this be due to the fact that I am also running hostapd (I have another adapter that works as AP)?
Or should I build the code in a different way to support drivers with wEXT and not cfg80211 support?
Sorry for having asked so many questions, but I would appreciate any hint that could help me figure out this issue.