From 666bfeb0f049f1b965953b0c2b35f4c75bdeb8f0 Mon Sep 17 00:00:00 2001 From: yagoplx/y <57966308+yagoplx@users.noreply.github.com> Date: Thu, 18 Jun 2020 16:16:13 -0300 Subject: [PATCH] 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: https://github.com/lwfinger/rtl8192ee/pull/12/commits/80b9bc47b347baccdc9246936aa43b92585d560e 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: https://github.com/lwfinger/rtl8192ee/pull/12/commits/80b9bc47b347baccdc9246936aa43b92585d560e 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: https://github.com/lwfinger/rtl8192ee/pull/12/commits/80b9bc47b347baccdc9246936aa43b92585d560e 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. --- README.md | 55 ++++++++++++++++++++++++++++++++++ hal/rtl8192e/rtl8192e_phycfg.c | 43 +++++++++++++++++++------- 2 files changed, 87 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 68ecfaa..3247741 100644 --- a/README.md +++ b/README.md @@ -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 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 1. Fork repo diff --git a/hal/rtl8192e/rtl8192e_phycfg.c b/hal/rtl8192e/rtl8192e_phycfg.c index 7c67e9a..2ac0d51 100644 --- a/hal/rtl8192e/rtl8192e_phycfg.c +++ b/hal/rtl8192e/rtl8192e_phycfg.c @@ -13,18 +13,34 @@ * *****************************************************************************/ #define _RTL8192E_PHYCFG_C_ - -/* #include */ - #include -/*---------------------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 -/* - * 1. BB register R/W API - * */ +// 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 */ u32 PHY_QueryBBReg8192E( @@ -715,13 +731,18 @@ PHY_GetTxPowerIndex_8192E( } 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) 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; }