Add AP info, Add Compile-Time Transmit Power Fixing & Boost

Turns out these devices can serve as really decent access points.
Adding txpower control info as well. See my other PR.

This is in a separate PR because the readme instructed to do so.

Update README.md

Move my lines more to the bottom

 Implement simple transmit power boost and fixed setting

Source: 80b9bc47b3

Turns out the "higher levels" of this driver are not actually able to affect the device's physical power output, like via cfg80211, yet.
After some extensive testing I finally found the code responsible for setting the device's power and added some compile-time
tunables to influence it. For example here we give the transmit power index a tiny boost of two, which can be changed by the user via the source.

This is as far as my skills go so if you want to try and make this accessible to iw and iwconfig please give it a go.
Note that this will take an index between 1 (min power the device can put out) and 63 (max power the device can put out). I have no idea what these values actually translate to in dBm, but setting the override to max, 63, on my rtl card really gave range a boost.

Add AP and TXPOWER CONTROL info

Turns out these devices can serve as really decent access points.
Adding txpower control info as well. See my other PR.

This is in a separate PR because the readme instructed to do so.

Update README.md

Move my lines more to the bottom

 Implement simple transmit power boost and fixed setting

Source: 80b9bc47b3

Turns out the "higher levels" of this driver are not actually able to affect the device's physical power output, like via cfg80211, yet.
After some extensive testing I finally found the code responsible for setting the device's power and added some compile-time
tunables to influence it. For example here we give the transmit power index a tiny boost of two, which can be changed by the user via the source.

This is as far as my skills go so if you want to try and make this accessible to iw and iwconfig please give it a go.
Note that this will take an index between 1 (min power the device can put out) and 63 (max power the device can put out). I have no idea what these values actually translate to in dBm, but setting the override to max, 63, on my rtl card really gave range a boost.

Add AP and TXPOWER CONTROL info

Turns out these devices can serve as really decent access points.
Adding txpower control info as well. See my other PR.

This is in a separate PR because the readme instructed to do so.

Update README.md

Move my lines more to the bottom

 Implement simple transmit power boost and fixed setting

Source: 80b9bc47b3

Turns out the "higher levels" of this driver are not actually able to affect the device's physical power output, like via cfg80211, yet.
After some extensive testing I finally found the code responsible for setting the device's power and added some compile-time
tunables to influence it. For example here we give the transmit power index a tiny boost of two, which can be changed by the user via the source.

This is as far as my skills go so if you want to try and make this accessible to iw and iwconfig please give it a go.
Note that this will take an index between 1 (min power the device can put out) and 63 (max power the device can put out). I have no idea what these values actually translate to in dBm, but setting the override to max, 63, on my rtl card really gave range a boost.
This commit is contained in:
yagoplx/y 2020-06-18 16:16:13 -03:00 committed by yagoplx
parent 2bd66378a6
commit 666bfeb0f0
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)
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;
return power_idx; return power_idx;
} }