Currently tested on numerous GL.iNet devices from MT7628 to IPQ5018. Results from other manufacturers/models and OpenWrt versions appreciated.
The script:
#!/bin/sh
# Copyright (C) BlueWave Projects and Services 2025
#
# This software is released under the GNU General Public License version 3 or any later version.
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# To obtain a copy of the GNU General Public License, see <https://www.gnu.org/licenses/>.
#
last_version="0.1.0~be7a"
version="1.0.0~be7a"
if [ -e "/tmp/wifi-chipset.debug" ]; then
rm "/tmp/wifi-chipset.debug"
fi
if [ ! -z "$1" ] && [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
echo "wifi-chipset-detect: version $version"
exit 0
fi
wifi_chipset_detect() {
# Attempt to get the label mac
ifaces="wan eth1 eth0"
for iface in $ifaces; do
labelmac=$(cat /sys/class/net/$iface/address 2>/dev/null)
if [ -z "$labelmac" ]; then
continue
else
labelmac="@$labelmac"
break
fi
done
. /etc/openwrt_release 2>/dev/null
echo "{" > /tmp/wifidetect
echo " \"System$labelmac\": {" >> /tmp/wifidetect
echo " \"Distribution\": \"${DISTRIB_ID:-unknown}\"," >> /tmp/wifidetect
echo " \"Release\": \"${DISTRIB_RELEASE:-unknown}\"," >> /tmp/wifidetect
echo " \"Revision\": \"${DISTRIB_REVISION:-unknown}\"," >> /tmp/wifidetect
echo " \"Target\": \"${DISTRIB_TARGET:-unknown}\"," >> /tmp/wifidetect
echo " \"Architecture\": \"${DISTRIB_ARCH:-unknown}\"," >> /tmp/wifidetect
echo " \"Description\": \"${DISTRIB_DESCRIPTION:-unknown}\"," >> /tmp/wifidetect
if [ -f /etc/board.json ]; then
device=$(grep -m1 '"name":' /etc/board.json | sed 's/.*"name": *"\([^"]*\)".*/\1/' 2>/dev/null)
if [ -n "$device" ] && ! echo "$device" | grep -Eqw "(WAN|LAN|ACT|LINK|DSL|WLAN|POWER|USB|WPS)"; then
echo " \"Device\": \"$device\"," >> /tmp/wifidetect
fi
elif [ -f /tmp/sysinfo/model ]; then
echo " \"Device\": \"$(cat /tmp/sysinfo/model)\"," >> /tmp/wifidetect
elif [ -f /tmp/sysinfo/board_name ]; then
echo " \"Device\": \"$(cat /tmp/sysinfo/board_name)\"," >> /tmp/wifidetect
else
echo " \"Device\": \"unknown\"," >> /tmp/wifidetect
fi
echo " \"phy\": {" >> /tmp/wifidetect
for dir in /sys/class/ieee80211/phy* /sys/class/ieee80211/wl*; do
[ -d "$dir" ] || continue
name="${dir##*/}"
driver=$(awk -F= '/^DRIVER=/ {print $2; exit}' "$dir/device/uevent" 2>/dev/null || echo "n/a")
chipset=""
# Band detection for multi-band capable PHYs (works even if radio is down)
phy_info=$(iw phy "$name" info 2>/dev/null)
bands=""
# Dynamically detect each band section and determine its type based on frequencies
for band_num in 1 2 3 4; do
if echo "$phy_info" | grep -q "Band ${band_num}:"; then
next_band=$((band_num + 1))
# Extract the band section up to the next band or EOF
band_info=$(echo "$phy_info" | sed -n "/Band ${band_num}:/,/Band ${next_band}:/p")
# If next band exists, remove the last line (which is "Band ${next_band}:")
if echo "$band_info" | grep -q "Band ${next_band}:"; then
band_info=$(echo "$band_info" | sed '$d')
fi
# Detect band type from frequencies in this section
if echo "$band_info" | grep -qE "[* ]+24[0-9]{2}(\.0)? MHz"; then
[ -n "$bands" ] && bands="$bands 2.4GHz" || bands="2.4GHz"
elif echo "$band_info" | grep -qE "[* ]+5[0-9]{3}(\.0)? MHz"; then
[ -n "$bands" ] && bands="$bands 5GHz" || bands="5GHz"
elif echo "$band_info" | grep -qE "[* ]+[6-7][0-9]{3}(\.0)? MHz"; then
[ -n "$bands" ] && bands="$bands 6GHz" || bands="6GHz"
fi
fi
done
# Fallback: if no Band sections found or no bands detected, try raw frequency matching
if [ -z "$bands" ]; then
if echo "$phy_info" | grep -qE "24[0-9]{2}(\.0)? MHz"; then
bands="2.4GHz"
fi
if echo "$phy_info" | grep -qE "5[0-9]{3}(\.0)? MHz"; then
[ -n "$bands" ] && bands="$bands 5GHz" || bands="5GHz"
fi
if echo "$phy_info" | grep -qE "[6-7][0-9]{3}(\.0)? MHz"; then
[ -n "$bands" ] && bands="$bands 6GHz" || bands="6GHz"
fi
fi
chipset=$(cat "$dir/device/label" "$dir/device/name" \
"$dir/mac80211/label" "$dir/mac80211/name" 2>/dev/null | head -n1 | xargs)
# Broadcom brcmfmac
if [ -z "$chipset" ] && echo "$driver" | grep -q brcmfmac; then
modalias=$(tr '\0' '\n' < "$dir/device/modalias" 2>/dev/null)
fw=$(ls "$dir"/device/firmware/*/brcmfmac* 2>/dev/null | head -n1 | xargs basename 2>/dev/null || true)
case "$modalias:$fw" in
*bcm4329*|*bcm4330*) chipset="Broadcom BCM4329/BCM4330 (Wi-Fi 4)" ;;
*bcm43430*) chipset="Broadcom BCM43430 (Wi-Fi 5)" ;;
*bcm43455*) chipset="Broadcom BCM43455 (Wi-Fi 5)" ;;
*bcm4356*) chipset="Broadcom BCM4356 (Wi-Fi 5)" ;;
*bcm4378*) chipset="Broadcom BCM4378 (Wi-Fi 6)" ;;
*) chipset="Broadcom brcmfmac (Wi-Fi)" ;;
esac
fi
# MediaTek Filogic / mt79xx family – now includes MT7996 Wi-Fi 7
if [ -z "$chipset" ] && [ -f "$dir/device/modalias" ]; then
modalias=$(tr '\0' '\n' < "$dir/device/modalias" 2>/dev/null)
if echo "$modalias" | grep -iq 'mt79'; then
if echo "$modalias" | grep -iq '7996'; then chipset="MediaTek MT7996 (Wi-Fi 7)"
elif echo "$modalias" | grep -iq '798'; then chipset="MediaTek Filogic 830/810/880 (MT798x integrated WiFi)"
elif echo "$modalias" | grep -iq '7916'; then chipset="MediaTek MT7916 (Wi-Fi 6E)"
elif echo "$modalias" | grep -iq '7915'; then chipset="MediaTek MT7915E (Wi-Fi 6)"
elif echo "$modalias" | grep -iq '792'; then chipset="MediaTek MT792x"
fi
fi
fi
# Older MediaTek PCIe + USB
if [ -z "$chipset" ] && echo "$driver" | grep -q -E 'mt7603e|mt76x2e|mt7915e|mt7615e|mt76x0u'; then
case "$driver" in
mt7915e) chipset="MediaTek MT7915E (Wi-Fi 6)" ;;
mt7615e) chipset="MediaTek MT7615E (Wi-Fi 5)" ;;
mt7603e) chipset="MediaTek MT7603E (2.4 GHz)" ;;
mt76x2e) chipset="MediaTek MT76x2E (5 GHz)" ;;
mt76x0u) chipset="MediaTek MT7610U (Wi-Fi 5 USB) (mt76x0u)" ;;
esac
fi
# Legacy MediaTek SoCs with mt76_wmac – all patterns quoted (hyphen-safe)
if [ -z "$chipset" ] && echo "$driver" | grep -q mt76_wmac; then
compat=$(grep -h '^OF_COMPATIBLE_' "$dir"/hwmon/hwmon*/uevent "$dir"/hwmon*/uevent 2>/dev/null | head -n1 | cut -d= -f2)
case "$compat" in
*"mt7628"*) chipset="MediaTek MT7628AN (integrated 2.4 GHz)" ;;
*"mt7621"*) chipset="MediaTek MT7621AN/AT (integrated 2.4 GHz)" ;;
*"mt7622"*) chipset="MediaTek MT7622 (integrated 2.4/5 GHz)" ;;
*"mt7620"*) chipset="MediaTek MT7620N (integrated 2.4 GHz)" ;;
*) chipset="Legacy MediaTek mt76_wmac SoC" ;;
esac
fi
# MediaTek Filogic 820/830 integrated (mt7622-wmac – E8450 etc.)
if [ -z "$chipset" ] && echo "$driver" | grep -q mt7622-wmac; then
chipset="MediaTek MT7622 (integrated 2.4 GHz)"
fi
# Ralink rt2800pci / rt2800usb
if [ -z "$chipset" ] && echo "$driver" | grep -q -E 'rt2800pci|rt2800usb'; then
chipset="Ralink RT5370/RT3070 (2.4 GHz, Wi-Fi 4)"
fi
# Realtek rtl8192cu
if [ -z "$chipset" ] && echo "$driver" | grep -q rtl8192cu; then
chipset="Realtek RTL8192CU (2.4/5 GHz, Wi-Fi 4)"
fi
# Marvell mwlwifi mwifiex_sdio
if [ -z "$chipset" ] && echo "$driver" | grep -q -E 'mwlwifi|mwifiex_sdio'; then
compat=$(grep -Eh 'PCI_ID|SDIO_ID' "$dir"/device/uevent 2>/dev/null | cut -d= -f2)
case "$compat" in
"11AB:2A55") chipset="Marvell 88W8864 (2.4/5 GHz, Wi-Fi 5)" ;;
"11AB:2B40") chipset="Marvell 88W8964 (2.4/5 GHz, Wi-Fi 5)" ;;
"11AB:2B38") chipset="Marvell 88W8897 (2.4/5 GHz, Wi-Fi 5)" ;;
"02DF:9135") chipset="Marvell 88W8887 (2.4/5 GHz, Wi-Fi 5)" ;;
*) chipset="unknown Marvell Wi-Fi" ;;
esac
fi
# Qualcomm Atheros – ath9k + ath10k + ath11k
if [ -z "$chipset" ] && echo "$driver" | grep -q -E 'ath9k|ath10k|ath11k'; then
compat=$(grep -h '^OF_COMPATIBLE_' "$dir"/hwmon/hwmon*/uevent "$dir"/hwmon*/uevent 2>/dev/null | head -n1 | cut -d= -f2)
if [ -z "$compat" ]; then
compat=$(grep -h '^OF_COMPATIBLE_' "$dir"/device/uevent 2>/dev/null | head -n1 | cut -d= -f2)
fi
case "$driver" in
ath9k)
case "$compat" in
*"qca,qca9530-wmac"*) chipset="Qualcomm Atheros AR953x series (2.4 GHz, Wi-Fi 4)" ;;
*) chipset="Qualcomm Atheros AR93xx/AR92xx/AR5416 series" ;;
esac
;;
ath10k_ahb) chipset="Qualcomm Atheros QCA9886 (Lantiq)" ;;
ath10k_pci) chipset="Qualcomm Atheros QCA9984/QCA988x/QCA986x series" ;;
ath11k)
case "$compat" in
*"ipq5018-wifi"*) chipset="Qualcomm IPQ5018 integrated 2.4 GHz" ;;
*"qcn6122"*) chipset="Qualcomm QCN6122 (Wi-Fi 6E)" ;;
*"qcn9074"*) chipset="Qualcomm QCN9074" ;;
*"ipq6018-wifi"*) chipset="Qualcomm QCN9074" ;;
*"ipq807"*) chipset="Qualcomm QCN9074/QCN5024" ;;
*) chipset="Qualcomm QCN9074/QCN5024" ;;
esac
;;
esac
fi
[ -z "$chipset" ] && chipset="unknown"
echo " \"$name\": {" >> /tmp/wifidetect
echo " \"Chipset\": \"$chipset\"," >> /tmp/wifidetect
echo " \"Bands\": [" >> /tmp/wifidetect
for band in $bands; do
echo " \"$band\"," >> /tmp/wifidetect
done
sed -i '$ s/.$//' /tmp/wifidetect
echo " ]," >> /tmp/wifidetect
echo " \"Driver\": \"$driver\"" >> /tmp/wifidetect
echo " }," >> /tmp/wifidetect
done
sed -i '$ s/.$//' /tmp/wifidetect
echo " }" >> /tmp/wifidetect
echo " }" >> /tmp/wifidetect
echo "}" >> /tmp/wifidetect
}
wifi_chipset_detect
cat /tmp/wifidetect