Last active
March 23, 2024 09:32
-
-
Save BigNerd95/6ad73f59e19169ac0f95dbf3b9a272ac to your computer and use it in GitHub Desktop.
Atheros ART power limit bypass, linux regulatory will be applied (e.g.: iw phy phy0 set txpower fixed 3100)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |
@@ -5142,6 +5142,11 @@ static void ar9003_hw_set_power_per_rate | |
scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit, | |
antenna_reduction); | |
+ minCtlPower = (u8) min(MAX_RATE_POWER, scaledPower); | |
+ for (i = 0; i < ar9300RateSize; i++) | |
+ pPwrArray[i] = (u8) minCtlPower; | |
+ return; | |
+ | |
if (is2ghz) { | |
/* Setup for CTL modes */ | |
/* CTL_11B, CTL_11G, CTL_2GHT20 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah, | |
struct ath9k_channel *chan, | |
u8 *pPwrArray, u16 cfgCtl, | |
u8 antenna_reduction, | |
u16 powerLimit) | |
{ | |
struct ath_common *common = ath9k_hw_common(ah); | |
struct ar9300_eeprom *pEepData = &ah->eeprom.ar9300_eep; | |
u16 twiceMaxEdgePower; | |
int i; | |
u16 scaledPower = 0, minCtlPower; | |
static const u16 ctlModesFor11a[] = { | |
CTL_11A, CTL_5GHT20, CTL_11A_EXT, CTL_5GHT40 | |
}; | |
static const u16 ctlModesFor11g[] = { | |
CTL_11B, CTL_11G, CTL_2GHT20, CTL_11B_EXT, | |
CTL_11G_EXT, CTL_2GHT40 | |
}; | |
u16 numCtlModes; | |
const u16 *pCtlMode; | |
u16 ctlMode, freq; | |
struct chan_centers centers; | |
u8 *ctlIndex; | |
u8 ctlNum; | |
u16 twiceMinEdgePower; | |
bool is2ghz = IS_CHAN_2GHZ(chan); | |
ath9k_hw_get_channel_centers(ah, chan, ¢ers); | |
scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit, | |
antenna_reduction); | |
minCtlPower = (u8) min(MAX_RATE_POWER, scaledPower); // [MOD] | |
for (i = 0; i < ar9300RateSize; i++) // [MOD] | |
pPwrArray[i] = (u8) minCtlPower; // [MOD] | |
return; // [MOD] | |
if (is2ghz) { | |
// [...] |
Hey, if i dont want to compile the whole image, is it possible to compile it with make -j5 package/kernel/mac80211/compile
and install one of the kmod-ath*.ipk ?
./bin/targets/ath79/generic/packages/kmod-ath9k-common_5.4.52+5.8-1-1_mips_24kc.ipk
./bin/targets/ath79/generic/packages/kmod-ath9k_5.4.52+5.8-1-1_mips_24kc.ipk
./bin/targets/ath79/generic/packages/kmod-ath_5.4.52+5.8-1-1_mips_24kc.ipk
Which one is the right?
kmod-ath9k_5.4.52+5.8-1-1_mips_24kc.ipk is working fine, but some channels on 5 ghz are only 14 dBm
44, 48, 52, 56, 60, 64
is there a way to fix that?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LEDE instruction:
Clone LEDE project
git clone https://github.com/lede-project/source.git
cd source
Build for your target
make menuconfig
(select your target)make package/kernel/mac80211/compile
Patch the driver with my diff
You have to edit
ar9003_hw_set_power_per_rate_table
function in this file:build_dir/target-[ARCH]/linux-ar71xx_generic/backports-[VER]/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
(Add lines with // [MOD] comment)
Build and flash the firmware
Build the firmware
make -j9
(Where 9 is your cpu's threads number + 1)
Then flash the router
On PC:
nc -l -p 1234 -q 0 < bin/targets/ar71xx/generic/lede-ar71xx-generic-[MODEL]-squashfs-sysupgrade.bin
On router:
nc 192.168.1.X 1234 > /tmp/fw.bin && sysupgrade /tmp/fw.bin
Set the power
After the router reboot:
iw phy phy0 set txpower fixed 3100
and then check the power:
iwinfo phy0 txpower
You should see
I tested this mod with an instrument, at ~50 cm of distance from the antennas: