Skip to content

KiMiGuel/ALFA-TXPower-Keeper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

 .--..--..--..--..--..--..--..--..--..--..--. 
/ .. \.. \.. \.. \.. \.. \.. \.. \.. \.. \.. \\n\ \ /\ `'\ `'\ `'\ `'\ `'\ `'\ `'\ `'\ `'\ \ / /
 \/ /`--'`--'`--'`--'`--'`--'`--'`--'`--'\/ / 
 / /\                                    / /\ 
/ /\ \  .d8b.  db      d88888b  .d8b.   / /\ \\n\ \/ / d8' `8b 88      88'     d8' `8b  \ \/ /
 \/ /  88ooo88 88      88ooo   88ooo88   \/ /   ATXPK v1.2.0
 / /\  88~~~88 88      88~~~   88~~~88   / /\ 
/ /\ \ 88   88 88booo. 88      88   88  / /\ \\n\ \/ / YP   YP Y88888P YP      YP   YP  \ \/ /
 \/ /                                    \/ / 
 / /\.--..--..--..--..--..--..--..--..--./ /\ 
/ /\ \.. \.. \.. \.. \.. \.. \.. \.. \.. \/\ \\n\ `'\ `'\ `'\ `'\ `'\ `'\ `'\ `'\ `'\ `'\ `' /
 `--'`--'`--'`--'`--'`--'`--'`--'`--'`--'`--' 

atxpk — Alfa ACHM TX Power Keeper

License: MIT Python 3.7+ Platform: Linux Version GitHub stars

A simple Python utility to help understand and manage TX power readings on the Alfa ACHM (MT7610U) WiFi adapter on Linux.

What This Script Does

atxpk helps you:

  • Check current TX power and adapter state for your Alfa ACHM.
  • Apply an EEPROM patch to keep the adapter at the target TX power.
  • Use an iw fallback loop when the EEPROM patch cannot be verified.
  • Install a systemd service so the fix applies automatically on plug-in.
  • Understand why iw dev TX power readings behave the way they do.

The "7 dBm Mystery" — Explained

If you've seen your Alfa show txpower 7.00 dBm and panicked, here's what we learned after testing across three platforms:

Tested Platforms

Platform Device Architecture
Kali 3 MacBook USB boot x86_64
Kali 2 Raspberry Pi 4 ARM64
Kali 1 Raspberry Pi 3B+ ARM

Key Finding

iw dev TX power is NOT a live measurement. It's a calibration value from the adapter's EEPROM, specific to each channel/frequency band. It does NOT change with regulatory domain settings.

What We Found

Channel Band TX Power (all platforms)
1, 6 2.4 GHz ~4 dBm
11 2.4 GHz ~5 dBm
36, 149 5 GHz ~17 dBm
165 5 GHz ~19 dBm

The 7 dBm "Bug"

7 dBm is just a placeholder. When the interface is in managed mode with no active channel set, iw dev shows 7 dBm as a default value. This is NOT your actual TX power.

To see real TX power values:

  1. Put interface in monitor mode
  2. Set a specific channel
  3. Check iw dev again
sudo airmon-ng check kill
sudo ip link set wlan0 down
sudo iw dev wlan0 set type monitor
sudo ip link set wlan0 up
sudo iw dev wlan0 set channel 149
sudo iw dev wlan0 info

Regulatory Domain

iw reg set may or may not apply to your adapter's PHY depending on your kernel/driver setup. But it does NOT affect the iw dev txpower reading — that comes from the adapter's own calibration table regardless of what iw reg get shows.

Why This Matters

  • Don't trust 7 dBm in managed mode — it's meaningless.
  • Don't panic if reg domain shows "99" or "UNSET" — the adapter still works at its calibrated power.
  • Monitor mode + locked channel = real numbers.
  • Your actual transmit power is determined by the adapter firmware, not what iw displays.

Installation

Clone the repository and install the systemd service:

git clone https://github.com/KiMiGuel/ALFA-TXPower-Keeper
cd ~/atxpk
sudo ./atxpk install

This will:

  • Copy the keeper to /opt/atxpk/
  • Create /usr/local/sbin/atxpk
  • Install the systemd service atxpk.service
  • Install the udev rule 99-atxpk.rules
  • Start and enable the service

Check status:

sudo systemctl status atxpk
sudo journalctl -u atxpk -f

Usage

Run without arguments to open the interactive menu:

sudo ./atxpk

Menu options:

  1. Fix Now — detect the Alfa and apply the EEPROM patch/iw fallback.
  2. Monitor & Patch — switch to monitor mode on channel 149, then apply the fix (most reliable TX-power reading).
  3. Fix iw reg — set the regulatory domain to BO and verify it.
  4. Install Service — install the systemd service and udev rules.
  5. Uninstall Service — remove the systemd service and udev rules.
  6. Check Status — show adapter presence, phy, interface, permanent MAC, and TX power.
  7. Exit

Manual commands

# Show adapter state
sudo ./atxpk status

# Run a single patch/verify cycle
sudo ./atxpk oneshot

# Run continuously in the foreground
sudo ./atxpk daemon

# Interactive fix mode (connect USB)
sudo ./atxpk fix

# Verbose output
sudo ./atxpk -v daemon
sudo ./atxpk oneshot -v

Command-line options

Option Default Description
-i, --interface auto-discover Optional interface name for iw fallback
-t, --target-dbm 20 Target TX power in dBm
--interval 3 Daemon check interval in seconds
--eeprom-offset 0x52 EEPROM offset to patch
--eeprom-value 0x1e EEPROM value to write
--max-retries 30 Retries when waiting for adapter/phy

Uninstallation

sudo ./atxpk uninstall

This stops the service, removes the systemd/udev integration, and deletes /opt/atxpk and /usr/local/sbin/atxpk.

How it works

  1. On startup (or when the daemon wakes), enumerate USB devices for idVendor=0e8d, idProduct=7610.
  2. For each phy* in /sys/class/ieee80211/, resolve the device symlink and check whether it belongs to the matched USB device.
  3. Mount debugfs if necessary.
  4. Attempt to write 0x1e to offset 0x52 of the discovered EEPROM node.
  5. Read back the byte. If it equals 0x1e, the patch is verified.
  6. For interactive modes, switch the interface to monitor mode, lock channel 149, and read the real TX power.
  7. If the target TX power is not reached, enter the iw fallback loop.
  8. If the adapter disappears, reset state and wait for re-insertion.

Important notes

  • The debugfs EEPROM node may appear as mode 0400 (read-only). The tool attempts the write directly, because many kernels still allow root to write to it via dd.
  • The iw set txpower fallback is a best-effort workaround. The mt76x0u driver binds TX power to EEPROM values, so iw may be ignored depending on kernel version and driver state.
  • A complete fix requires patching the kernel driver itself; this tool is a user-space workaround.

Troubleshooting

Service fails to start:

sudo journalctl -u atxpk -n 50

Adapter not detected:

  • Confirm the adapter is plugged in.
  • Check lsusb | grep 0e8d:7610.

EEPROM patch fails:

  • Some kernels hard-lock the debugfs EEPROM node. The tool will automatically fall back to the iw loop.

Wrong or missing interface name:

  • The tool auto-discovers the interface from the matched phyX. If that fails, pass -i <interface> or set it in the systemd service ExecStart line.
  • If no interface is found, EEPROM patching still runs, but iw fallback and TX power verification are skipped.

Dependencies

  • iw (wireless tools)
  • airmon-ng (aircrack-ng suite) — for monitor-mode diagnostics
  • Python 3.7+
  • systemd — for service/udev integration

Credits

Testing and validation done across MacBook USB boot, Raspberry Pi 4, and Raspberry Pi 3B+ running Kali Linux. Thanks to the morrownr/8812au-8821au-linux-wireless-drivers community for the diagnostic guidance.


Note: This script is for educational and diagnostic purposes. Always comply with local RF regulations.

About

A Python Script tool to bypass TXPower of 7 dBm of the ALFA AWUS036ACHM and have it at 20 dBm

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages