mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-07 01:53:34 +08:00
iwinfo: get htmode/hwmodelist base on wdev band uci config
This commit is contained in:
parent
c545172bdb
commit
44358db585
@ -690,15 +690,36 @@ static int mtk_get_hwmodelist(const char *dev, int *buf)
|
||||
const char *ifname;
|
||||
char chans[IWINFO_BUFSIZE] = { 0 };
|
||||
struct iwinfo_freqlist_entry *e = NULL;
|
||||
struct uci_section *s;
|
||||
const char* band = NULL;
|
||||
int len = 0;
|
||||
|
||||
*buf = 0;
|
||||
|
||||
/* get hwmode base on uci band config */
|
||||
s = iwinfo_uci_get_radio(dev, "mtwifi");
|
||||
if (!s)
|
||||
goto uciout;
|
||||
|
||||
band = uci_lookup_option_string(uci_ctx, s, "band");
|
||||
|
||||
uciout:
|
||||
iwinfo_uci_free();
|
||||
|
||||
if (band) {
|
||||
if (!strcmp(band,"2g"))
|
||||
*buf = (IWINFO_80211_N | IWINFO_80211_AX);
|
||||
else if (!strcmp(band,"5g"))
|
||||
*buf = (IWINFO_80211_AC | IWINFO_80211_AX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get hwmode base on iwrange */
|
||||
ifname = mtk_dev2phy(dev);
|
||||
if (!ifname)
|
||||
return -1;
|
||||
|
||||
*buf = 0;
|
||||
|
||||
if (!mtk_get_freqlist(ifname, chans, &len) )
|
||||
if (!mtk_get_freqlist(ifname, chans, &len))
|
||||
{
|
||||
for (e = (struct iwinfo_freqlist_entry *)chans; e->channel; e++ )
|
||||
{
|
||||
@ -723,15 +744,37 @@ static int mtk_get_htmodelist(const char *dev, int *buf)
|
||||
const char *ifname;
|
||||
char chans[IWINFO_BUFSIZE] = { 0 };
|
||||
struct iwinfo_freqlist_entry *e = NULL;
|
||||
struct uci_section *s;
|
||||
const char* band = NULL;
|
||||
int len = 0;
|
||||
|
||||
*buf = 0;
|
||||
|
||||
/* get htmode base on uci band config */
|
||||
s = iwinfo_uci_get_radio(dev, "mtwifi");
|
||||
if (!s)
|
||||
goto uciout;
|
||||
|
||||
band = uci_lookup_option_string(uci_ctx, s, "band");
|
||||
|
||||
uciout:
|
||||
iwinfo_uci_free();
|
||||
|
||||
if (band) {
|
||||
if (!strcmp(band,"2g"))
|
||||
*buf = (IWINFO_HTMODE_HT20 | IWINFO_HTMODE_HT40 | IWINFO_HTMODE_HE20 | IWINFO_HTMODE_HE40);
|
||||
else if (!strcmp(band,"5g"))
|
||||
*buf = (IWINFO_HTMODE_VHT20 | IWINFO_HTMODE_VHT40 | IWINFO_HTMODE_VHT80 | IWINFO_HTMODE_VHT160
|
||||
| IWINFO_HTMODE_HE20 | IWINFO_HTMODE_HE40 | IWINFO_HTMODE_HE80 | IWINFO_HTMODE_HE160);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get htmode base on iwrange */
|
||||
ifname = mtk_dev2phy(dev);
|
||||
if (!ifname)
|
||||
return -1;
|
||||
|
||||
*buf = 0;
|
||||
|
||||
if (!mtk_get_freqlist(ifname, chans, &len) )
|
||||
if (!mtk_get_freqlist(ifname, chans, &len))
|
||||
{
|
||||
for (e = (struct iwinfo_freqlist_entry *)chans; e->channel; e++ )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user