| From 9018c4fda0ef0dd03d20983311186a1a6788f899 Mon Sep 17 00:00:00 2001 |
| From: "Allen.Ye" <allen.ye@mediatek.com> |
| Date: Fri, 17 Jun 2022 09:51:36 +0800 |
| Subject: [PATCH] HAL: refactor beacon period/interval function |
| |
| --- |
| source/wifi/wifi_hal.c | 45 +++++++++++++++++++++++++++++++++++++----- |
| 1 file changed, 40 insertions(+), 5 deletions(-) |
| |
| diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c |
| index 5cad1e7..5c12139 100644 |
| --- a/source/wifi/wifi_hal.c |
| +++ b/source/wifi/wifi_hal.c |
| @@ -2344,16 +2344,38 @@ INT wifi_setRadioCarrierSenseThresholdInUse(INT radioIndex, INT threshold) //P3 |
| //Time interval between transmitting beacons (expressed in milliseconds). This parameter is based ondot11BeaconPeriod from [802.11-2012]. |
| INT wifi_getRadioBeaconPeriod(INT radioIndex, UINT *output) |
| { |
| - if (NULL == output) |
| + char cmd[MAX_BUF_SIZE]={'\0'}; |
| + char buf[MAX_CMD_SIZE]={'\0'}; |
| + |
| + WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__); |
| + if(output == NULL) |
| return RETURN_ERR; |
| - *output = 100; |
| |
| + snprintf(cmd, sizeof(cmd), "hostapd_cli -i %s%d status | grep beacon_int | cut -d '=' -f2 | tr -d '\n'", AP_PREFIX, radioIndex); |
| + _syscmd(cmd, buf, sizeof(buf)); |
| + *output = atoi(buf); |
| + |
| + WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__); |
| return RETURN_OK; |
| } |
| |
| INT wifi_setRadioBeaconPeriod(INT radioIndex, UINT BeaconPeriod) |
| { |
| - return RETURN_ERR; |
| + WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__); |
| + struct params params={'\0'}; |
| + char buf[MAX_BUF_SIZE] = {'\0'}; |
| + char config_file[MAX_BUF_SIZE] = {'\0'}; |
| + |
| + params.name = "beacon_int"; |
| + snprintf(buf, sizeof(buf), "%u", BeaconPeriod); |
| + params.value = buf; |
| + |
| + sprintf(config_file, "%s%d.conf", CONFIG_PREFIX, radioIndex); |
| + wifi_hostapdWrite(config_file, ¶ms, 1); |
| + |
| + wifi_hostapdProcessUpdate(radioIndex, ¶ms, 1); |
| + WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__); |
| + return RETURN_OK; |
| } |
| |
| //Comma-separated list of strings. The set of data rates, in Mbps, that have to be supported by all stations that desire to join this BSS. The stations have to be able to receive and transmit at each of the data rates listed inBasicDataTransmitRates. For example, a value of "1,2", indicates that stations support 1 Mbps and 2 Mbps. Most control packets use a data rate in BasicDataTransmitRates. |
| @@ -3825,8 +3847,21 @@ INT wifi_setApBeaconType(INT apIndex, CHAR *beaconTypeString) |
| // sets the beacon interval on the hardware for this AP |
| INT wifi_setApBeaconInterval(INT apIndex, INT beaconInterval) |
| { |
| - //save config and apply instantly |
| - return RETURN_ERR; |
| + WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__); |
| + struct params params={'\0'}; |
| + char buf[MAX_BUF_SIZE] = {'\0'}; |
| + char config_file[MAX_BUF_SIZE] = {'\0'}; |
| + |
| + params.name = "beacon_int"; |
| + snprintf(buf, sizeof(buf), "%u", beaconInterval); |
| + params.value = buf; |
| + |
| + sprintf(config_file, "%s%d.conf", CONFIG_PREFIX, apIndex); |
| + wifi_hostapdWrite(config_file, ¶ms, 1); |
| + |
| + wifi_hostapdProcessUpdate(apIndex, ¶ms, 1); |
| + WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__); |
| + return RETURN_OK; |
| } |
| |
| INT wifi_setDTIMInterval(INT apIndex, INT dtimInterval) |
| -- |
| 2.18.0 |
| |