From f6461d311d5732a340b1381899818f4729b553f6 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Mon, 16 Jul 2018 22:14:20 +0200 Subject: [PATCH 1/3] Implemented txpower control --- Makefile | 2 +- hal/rtl8812a/rtl8812a_dm.c | 1 + os_dep/linux/ioctl_cfg80211.c | 26 +++++++++++++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5910267..1da2d36 100755 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ CONFIG_AUTOCFG_CP = n CONFIG_MULTIDRV = n CONFIG_RTL8188E = n CONFIG_RTL8812A = y -CONFIG_RTL8821A = y +CONFIG_RTL8821A = n CONFIG_RTL8192E = n CONFIG_RTL8723B = n CONFIG_RTL8814A = n diff --git a/hal/rtl8812a/rtl8812a_dm.c b/hal/rtl8812a/rtl8812a_dm.c index 0e7912c..d40d9b4 100644 --- a/hal/rtl8812a/rtl8812a_dm.c +++ b/hal/rtl8812a/rtl8812a_dm.c @@ -344,6 +344,7 @@ void rtl8812_init_dm_priv(IN PADAPTER Adapter) Init_ODM_ComInfo_8812(Adapter); odm_init_all_timers(podmpriv); + pHalData->CurrentTxPwrIdx = 13; } void rtl8812_deinit_dm_priv(IN PADAPTER Adapter) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 8d95c8b..b7713c5 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -3581,6 +3581,26 @@ static int cfg80211_rtw_set_txpower(struct wiphy *wiphy, enum tx_power_setting type, int dbm) #endif { +_adapter *padapter = wiphy_to_adapter(wiphy); +HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); +int value; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE) + value = mbm/100; +#else + value = dbm; +#endif + +if(value < 0) + value = 0; +if(value > 40) + value = 40; + +if(type == NL80211_TX_POWER_FIXED) { + pHalData->CurrentTxPwrIdx = value; + rtw_hal_set_tx_power_level(padapter, pHalData->current_channel); +} else + return -EOPNOTSUPP; + #if 0 struct iwm_priv *iwm = wiphy_to_iwm(wiphy); int ret; @@ -3617,9 +3637,13 @@ static int cfg80211_rtw_get_txpower(struct wiphy *wiphy, #endif int *dbm) { + _adapter *padapter = wiphy_to_adapter(wiphy); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + RTW_INFO("%s\n", __func__); - *dbm = (12); + // *dbm = (12); + *dbm = pHalData->CurrentTxPwrIdx; return 0; } From d9ab8842c35d5249586aa2c2b4d02125a82bd4f4 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Tue, 17 Jul 2018 22:42:36 +0200 Subject: [PATCH 2/3] Enable the 8821au support by default --- Makefile | 2 +- dkms.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1da2d36..5910267 100755 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ CONFIG_AUTOCFG_CP = n CONFIG_MULTIDRV = n CONFIG_RTL8188E = n CONFIG_RTL8812A = y -CONFIG_RTL8821A = n +CONFIG_RTL8821A = y CONFIG_RTL8192E = n CONFIG_RTL8723B = n CONFIG_RTL8814A = n diff --git a/dkms.conf b/dkms.conf index b241807..435ad1b 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="realtek-rtl88xxau" -PACKAGE_VERSION="5.2.20.2~20180715" +PACKAGE_VERSION="5.2.20.2~20180717" BUILT_MODULE_NAME[0]="8812au" PROCS_NUM=`nproc` [ $PROCS_NUM -gt 16 ] && PROCS_NUM=16 From 2e9132eb4e9c0a482cfdef600b414dfa2c882255 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Tue, 17 Jul 2018 22:49:30 +0200 Subject: [PATCH 3/3] Update README.md --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d034b73..e8b40ff 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,13 @@ ## Realtek 8812AU driver v5.2.20.2 with monitor mode and frame injection -This driver supports 8812au & 8821au chipsets, not the 8814au chipset. +This driver supports 8812au & 8821au chipsets, not the 8814au chipset at this moment. ### Building / Installing To build and install module manually: ``` -$ "make" will build the 8812au, while "make RTL8821=1" will build the 8821au driver +$ sudo make $ sudo make install ``` @@ -63,6 +63,14 @@ sudo iw dev wlan0 set type monitor sudo ip link set wlan0 up ``` +### TX Power Control + +The txpower may be adjusted with these commands +``` +ifconfig down +iwconfig txpower 30 +``` + ### LED control #### You can now control LED behaviour statically by Makefile, for example: