Created
October 22, 2025 16:43
-
-
Save Lyceris-chan/17446e8de1f055a39fda8ad6d79ee5b4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/sh | |
| echo "=================================" | |
| echo "OpenWRT WiFi Radio1 Diagnostics" | |
| echo "=================================" | |
| echo "" | |
| # Check if running as root | |
| if [ "$(id -u)" -ne 0 ]; then | |
| echo "Warning: This script should be run as root for full diagnostics" | |
| echo "" | |
| fi | |
| echo "--- 1. Radio1 Configuration ---" | |
| uci show wireless | grep -E "radio1|wifi-iface.*radio1" | |
| echo "" | |
| echo "--- 2. Radio1 Status ---" | |
| wifi status radio1 2>/dev/null || echo "wifi status command failed or radio1 not found" | |
| echo "" | |
| echo "--- 3. Interface Status ---" | |
| iw dev | grep -A 10 "phy#1" || echo "No phy#1 device found" | |
| echo "" | |
| echo "--- 4. Hardware Detection ---" | |
| iw list | head -50 | |
| echo "" | |
| echo "--- 5. Kernel Module Status ---" | |
| lsmod | grep -E "mac80211|cfg80211|ath|mt76|rtl" | |
| echo "" | |
| echo "--- 6. dmesg WiFi Related Errors ---" | |
| dmesg | grep -iE "phy1|radio1|wifi|80211|firmware" | tail -50 | |
| echo "" | |
| echo "--- 7. Regulatory Domain ---" | |
| iw reg get | |
| echo "" | |
| echo "--- 8. RF Kill Status ---" | |
| rfkill list | |
| echo "" | |
| echo "--- 9. Network Interface List ---" | |
| ip link show | grep -E "wlan|phy" | |
| echo "" | |
| echo "--- 10. UCI Wireless Config Validation ---" | |
| uci show wireless.radio1 2>&1 | |
| echo "" | |
| echo "--- 11. hostapd Process Status ---" | |
| ps | grep hostapd | grep -v grep | |
| echo "" | |
| echo "--- 12. Check for Disabled State ---" | |
| DISABLED=$(uci get wireless.radio1.disabled 2>/dev/null) | |
| echo "Radio1 disabled setting: ${DISABLED:-not set}" | |
| if [ "$DISABLED" = "1" ]; then | |
| echo "WARNING: Radio1 is disabled in config!" | |
| fi | |
| echo "" | |
| echo "--- 13. Channel and Country Code ---" | |
| uci get wireless.radio1.channel 2>/dev/null || echo "No channel set" | |
| uci get wireless.radio1.country 2>/dev/null || echo "No country code set" | |
| echo "" | |
| echo "--- 14. Recent System Log (WiFi related) ---" | |
| logread | grep -iE "radio1|phy1|hostapd|wpa" | tail -30 | |
| echo "" | |
| echo "=================================" | |
| echo "Diagnostic Summary" | |
| echo "=================================" | |
| echo "" | |
| echo "Common issues to check:" | |
| echo "1. Is radio1 disabled? (see section 12)" | |
| echo "2. Are kernel modules loaded? (see section 5)" | |
| echo "3. Any firmware errors in dmesg? (see section 6)" | |
| echo "4. Is RF kill blocking WiFi? (see section 8)" | |
| echo "5. Is the country code set correctly? (see section 13)" | |
| echo "6. Is hostapd running? (see section 11)" | |
| echo "" | |
| echo "To enable radio1 if disabled:" | |
| echo " uci set wireless.radio1.disabled=0" | |
| echo " uci commit wireless" | |
| echo " wifi reload" | |
| echo "" | |
| echo "To restart WiFi completely:" | |
| echo " wifi down && wifi up" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment