developer | 3bffd01 | 2022-08-19 11:16:18 +0800 | [diff] [blame^] | 1 | From 575fbc6a67f1c7f30bbe0db9ff60ed1817260d85 Mon Sep 17 00:00:00 2001 |
developer | 30b3264 | 2022-08-17 18:14:43 +0800 | [diff] [blame] | 2 | From: "Allen.Ye" <allen.ye@mediatek.com> |
developer | 3bffd01 | 2022-08-19 11:16:18 +0800 | [diff] [blame^] | 3 | Date: Fri, 19 Aug 2022 10:50:01 +0800 |
developer | 30b3264 | 2022-08-17 18:14:43 +0800 | [diff] [blame] | 4 | Subject: [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 | |
| 10 | diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c |
developer | 3bffd01 | 2022-08-19 11:16:18 +0800 | [diff] [blame^] | 11 | index b4628c9..bde3349 100644 |
developer | 30b3264 | 2022-08-17 18:14:43 +0800 | [diff] [blame] | 12 | --- 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__); |
developer | 3bffd01 | 2022-08-19 11:16:18 +0800 | [diff] [blame^] | 34 | + snprintf(cmd, sizeof(cmd), "iw dev %s%d info | grep MHz | awk '{print $9}'", AP_PREFIX, radioIndex); |
developer | 30b3264 | 2022-08-17 18:14:43 +0800 | [diff] [blame] | 35 | + _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 | -- |
| 52 | 2.18.0 |
| 53 | |