From c97d11ed5612b17efc66d16f9a87264e042907b7 Mon Sep 17 00:00:00 2001 From: Amin Ben Ramdhane Date: Sat, 11 Jul 2020 09:15:13 +0100 Subject: [PATCH] WiFi.Radio.: fix get/set of [AutoChannelRefreshPeriod,RegulatoryDomain,SupportedOperatingChannelBandwidths] parameters --- dmtree/tr181/wifi-iopsyswrt.c | 6 +++--- dmtree/tr181/wifi.c | 25 +++++-------------------- json/tr181.json | 2 +- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/dmtree/tr181/wifi-iopsyswrt.c b/dmtree/tr181/wifi-iopsyswrt.c index 4623ae67..9463b4fe 100644 --- a/dmtree/tr181/wifi-iopsyswrt.c +++ b/dmtree/tr181/wifi-iopsyswrt.c @@ -495,13 +495,13 @@ int os__get_WiFiRadio_SupportedOperatingChannelBandwidths(char *refparam, struct DM_ASSERT(res, *value = ""); dmjson_foreach_obj_in_array(res, arrobj, supp_channels, i, 1, "supp_channels") { bandwidth = dmjson_get_value(supp_channels, 1, "bandwidth"); - if (bandwidth && !strstr(bandwidth_list, bandwidth)) { + if (bandwidth && !strstr(bandwidth_list, !strcmp(bandwidth, "8080") ? "80+80" : !strcmp(bandwidth, "80") ? ",80MHz" : bandwidth)) { if (*bandwidth_list == '\0') - dmasprintf(&bandwidth_list, "%sMHz", bandwidth); + dmasprintf(&bandwidth_list, "%sMHz", !strcmp(bandwidth, "8080") ? "80+80" : bandwidth); else { char *tmp = dmstrdup(bandwidth_list); dmfree(bandwidth_list); - dmasprintf(&bandwidth_list, "%s,%sMHz", tmp, bandwidth); + dmasprintf(&bandwidth_list, "%s,%sMHz", tmp, !strcmp(bandwidth, "8080") ? "80+80" : bandwidth); dmfree(tmp); } } diff --git a/dmtree/tr181/wifi.c b/dmtree/tr181/wifi.c index f10e5561..5a9e2aa2 100644 --- a/dmtree/tr181/wifi.c +++ b/dmtree/tr181/wifi.c @@ -300,10 +300,10 @@ static int get_WiFiRadio_AutoChannelSupported(char *refparam, struct dmctx *ctx, return 0; } -/*#Device.WiFi.Radio.{i}.AutoChannelRefreshPeriod!UCI:wireless/wifi-device,@i-1/scantimer*/ +/*#Device.WiFi.Radio.{i}.AutoChannelRefreshPeriod!UCI:wireless/wifi-device,@i-1/acs_refresh_time*/ static int get_WiFiRadio_AutoChannelRefreshPeriod(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "scantimer", value); + dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "acs_refresh_time", value); return 0; } @@ -315,7 +315,7 @@ static int set_WiFiRadio_AutoChannelRefreshPeriod(char *refparam, struct dmctx * return FAULT_9007; break; case VALUESET: - dmuci_set_value_by_section(((struct wifi_radio_args *)data)->wifi_radio_sec, "scantimer", value); + dmuci_set_value_by_section(((struct wifi_radio_args *)data)->wifi_radio_sec, "acs_refresh_time", value); break; } return 0; @@ -529,34 +529,19 @@ static int set_WiFiRadio_TransmitPower(char *refparam, struct dmctx *ctx, void * /*#Device.WiFi.Radio.{i}.RegulatoryDomain!UCI:wireless/wifi-device,@i-1/country*/ static int get_WiFiRadio_RegulatoryDomain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - char *country, **arr; - size_t length; - - dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "country", &country); - arr = strsplit(country, "/", &length); - if (arr && arr[0]) - dmasprintf(value, "%s ", arr[0]); + dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "country", value); return 0; } static int set_WiFiRadio_RegulatoryDomain(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { - char *country, **arr; - size_t length; - switch (action) { case VALUECHECK: if (dm_validate_string(value, 3, 3, NULL, 0, RegulatoryDomain, 1)) return FAULT_9007; break; case VALUESET: - dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "country", &country); - if (strlen(country) > 0) { - arr = strsplit(country, "/", &length); - dmasprintf(&country, "%s/%s", value, arr[1]); - } else - dmasprintf(&country, "%s/1", value); - dmuci_set_value_by_section(((struct wifi_radio_args *)data)->wifi_radio_sec, "country", country); + dmuci_set_value_by_section(((struct wifi_radio_args *)data)->wifi_radio_sec, "country", value); break; } return 0; diff --git a/json/tr181.json b/json/tr181.json index 8fdaf00f..b886ef7b 100644 --- a/json/tr181.json +++ b/json/tr181.json @@ -29458,7 +29458,7 @@ "index": "@i-1" }, "option": { - "name": "scantimer" + "name": "acs_refresh_time" } } }