blob: a58ee34761c8f0deffad99340c0f2ff5d897fc44 [file] [log] [blame]
developer3bffd012022-08-19 11:16:18 +08001From 575fbc6a67f1c7f30bbe0db9ff60ed1817260d85 Mon Sep 17 00:00:00 2001
developer30b32642022-08-17 18:14:43 +08002From: "Allen.Ye" <allen.ye@mediatek.com>
developer3bffd012022-08-19 11:16:18 +08003Date: Fri, 19 Aug 2022 10:50:01 +0800
developer30b32642022-08-17 18:14:43 +08004Subject: [PATCH] HAL: add tri-band support and index to band
5
6---
7 source/wifi/wifi_hal.c | 23 +++++++++++++++++++++++
8 1 file changed, 23 insertions(+)
9
10diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
developer3bffd012022-08-19 11:16:18 +080011index b4628c9..bde3349 100644
developer30b32642022-08-17 18:14:43 +080012--- a/source/wifi/wifi_hal.c
13+++ b/source/wifi/wifi_hal.c
14@@ -164,6 +164,7 @@ typedef enum
15 band_invalid = -1,
16 band_2_4 = 0,
17 band_5 = 1,
18+ band_6 = 2,
19 } wifi_band;
20
21 #ifdef WIFI_HAL_VERSION_3
22@@ -425,6 +426,28 @@ static int _syscmd(char *cmd, char *retBuf, int retBufSize)
23 return cmd_ret >> 8;
24 }
25
26+wifi_band wifi_index_to_band(int radioIndex)
27+{
28+ char cmd[64] = {0};
29+ char buf[64] = {0};
30+ int freq = 0;
31+ wifi_band band = band_invalid;
32+
33+ WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
developer3bffd012022-08-19 11:16:18 +080034+ snprintf(cmd, sizeof(cmd), "iw dev %s%d info | grep MHz | awk '{print $9}'", AP_PREFIX, radioIndex);
developer30b32642022-08-17 18:14:43 +080035+ _syscmd(cmd, buf, sizeof(buf));
36+ freq = atoi(buf);
37+ if (freq > 2401 && freq < 2495)
38+ band = band_2_4;
39+ else if (freq > 5160 && freq < 5915)
40+ band = band_5;
41+ else if (freq > 5955 && freq < 7125)
42+ band = band_6;
43+
44+ WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
45+ return band;
46+}
47+
48 static int wifi_hostapdRead(char *conf_file, char *param, char *output, int output_size)
49 {
50 char cmd[MAX_CMD_SIZE]={'\0'};
51--
522.18.0
53