Merge pull request #184 from yagoplx/realtek-4.4.x

Add AP info, Add Compile-Time Transmit Power Fixing & Boost
This commit is contained in:
Carlos Garcés 2020-06-19 20:01:39 +02:00 committed by GitHub
commit ea7cfbd672
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 87 additions and 11 deletions

View File

@ -129,6 +129,61 @@ If you wish to uninstall the driver at a later point, use
_sudo dkms uninstall rtl8192eu/1.0_. To completely remove the driver from DKMS use _sudo dkms uninstall rtl8192eu/1.0_. To completely remove the driver from DKMS use
_sudo dkms remove rtl8192eu/1.0 --all_. _sudo dkms remove rtl8192eu/1.0 --all_.
## Using as AP
Reference: Intelbras IWA 3001 USB WiFi Adapter
Devices using the 8192eu chip can serve as decent access points, with speeds up to ~50Mbps.
Using hostapd to manage your AP, set the proper ht-capab field for this device, which is:
`HT_CAPAB=[RX-STBC1][SHORT-GI-40][SHORT-GI-20][DSSS_CCK-40][MAX-AMSDU-7935]`
Optionally enable wideband, if you don't have neighbours:
Note that while this will result in a increase in network throughput it may cause clients further away to fail connecting.
It may also make the device work better with repeaters repeating its signal.
`HT_CAPAB=[HT40+][RX-STBC1][SHORT-GI-40][SHORT-GI-20][DSSS_CCK-40][MAX-AMSDU-7935]` (for channels 1-7), or
`HT_CAPAB=[HT40-][RX-STBC1][SHORT-GI-40][SHORT-GI-20][DSSS_CCK-40][MAX-AMSDU-7935]` (for channels 5-13)
## Changing transmit power
Currently there is no way to change transmit power in the driver with iw or iwconfig tools, as you would with other wireless devices.
The values returned by these tools are purely fictional on this driver.
However, you can still manually change the transmit power at compile time
by editing the file `hal/rl8192e/rtl8192e_phycfg.c` and changing the lines below:
```
/* Manual Transmit Power Control
The following options take values from 0 to 63, where:
0 - disable
1 - lowest transmit power the device can do
2 - highest transmit power the device can do
Note that these options may override your country's regulations about transmit power.
Setting the device to work at higher transmit powers most of the time may cause premature
failure or damage by overheating. Make sure the device has enough airflow before you increase this.
It is currently unknown what these values translate to in dBm.
*/
// Transmit Power Boost
// This value is added to the device's calculation of transmit power index.
// Useful if you want to keep power usage low while still boosting/decreasing transmit power.
// Can take a negative value as well to reduce power.
// Zero disables it. Default: 2, for a tiny boost.
int transmit_power_boost = 2;
// (ADVANCED) To know what transmit powers this device decides to use dynamically, see:
// https://github.com/lwfinger/rtl8192ee/blob/42ad92dcc71cb15a62f8c39e50debe3a28566b5f/hal/phydm/rtl8192e/halhwimg8192e_rf.c#L1310
// Transmit Power Override
// This value completely overrides the driver's calculations and uses only one value for all transmissions.
// Zero disables it. Default: 0
int transmit_power_override = 0;
/* Manual Transmit Power Control */
```
## Submitting patches ## Submitting patches
1. Fork repo 1. Fork repo

View File

@ -13,18 +13,34 @@
* *
*****************************************************************************/ *****************************************************************************/
#define _RTL8192E_PHYCFG_C_ #define _RTL8192E_PHYCFG_C_
/* #include <drv_types.h> */
#include <rtl8192e_hal.h> #include <rtl8192e_hal.h>
/*---------------------Define local function prototype-----------------------*/ /* Manual Transmit Power Control
The following options take values from 0 to 63, where:
0 - disable
1 - lowest transmit power the device can do
2 - highest transmit power the device can do
Note that these options may override your country's regulations about transmit power.
Setting the device to work at higher transmit powers most of the time may cause premature
failure or damage by overheating. Make sure the device has enough airflow before you increase this.
It is currently unknown what these values translate to in dBm.
*/
/*----------------------------Function Body----------------------------------*/ // Transmit Power Boost
// This value is added to the device's calculation of transmit power index.
// Useful if you want to keep power usage low while still boosting/decreasing transmit power.
// Can take a negative value as well to reduce power.
// Zero disables it. Default: 2, for a tiny boost.
int transmit_power_boost = 2;
// (ADVANCED) To know what transmit powers this device decides to use dynamically, see:
// https://github.com/lwfinger/rtl8192ee/blob/42ad92dcc71cb15a62f8c39e50debe3a28566b5f/hal/phydm/rtl8192e/halhwimg8192e_rf.c#L1310
/* // Transmit Power Override
* 1. BB register R/W API // This value completely overrides the driver's calculations and uses only one value for all transmissions.
* */ // Zero disables it. Default: 0
int transmit_power_override = 0;
/* Manual Transmit Power Control */
u32 u32
PHY_QueryBBReg8192E( PHY_QueryBBReg8192E(
@ -715,13 +731,18 @@ PHY_GetTxPowerIndex_8192E(
} }
by_rate_diff = by_rate_diff > limit ? limit : by_rate_diff; by_rate_diff = by_rate_diff > limit ? limit : by_rate_diff;
power_idx = base_idx + by_rate_diff + tpt_offset + extra_bias; power_idx = base_idx + by_rate_diff + tpt_offset + extra_bias + transmit_power_boost;
if (power_idx < 0) if (power_idx < 0)
power_idx = 0; power_idx = 0;
else if (power_idx > hal_spec->txgi_max)
if (transmit_power_override != 0)
power_idx = transmit_power_override;
if (power_idx > hal_spec->txgi_max)
power_idx = hal_spec->txgi_max; power_idx = hal_spec->txgi_max;
return power_idx; return power_idx;
} }