From ea08860a345ed77ac2a139812dff98e0ac90bb09 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Dutta Date: Tue, 14 Nov 2023 12:31:59 +0530 Subject: [PATCH] wifi: Use 20MHz as deafult bandwidth --- libbbfdm/dmtree/tr181/wifi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libbbfdm/dmtree/tr181/wifi.c b/libbbfdm/dmtree/tr181/wifi.c index 03ab992f..40cb5a21 100644 --- a/libbbfdm/dmtree/tr181/wifi.c +++ b/libbbfdm/dmtree/tr181/wifi.c @@ -166,11 +166,21 @@ static char *get_data_model_standard(char *standard) return standard; } +// Use 20MHz as default value, in case of null or 0 static char *get_data_model_band(const char *bandwidth) { char *band = NULL; + const char *tmp = "20"; - dmasprintf(&band, "%sMHz", (DM_STRLEN(bandwidth) == 0) ? "20" : bandwidth); + if (DM_STRLEN(bandwidth) == 0) { + tmp = "20"; + } else if (bandwidth[0] == '0') { + tmp = "20"; + } else { + tmp = bandwidth; + } + + dmasprintf(&band, "%sMHz", tmp); return band; }