WiFi chipset + driver detection script – works with radios enabled or disabled. Please show your test outputs! (Nov 2025)”

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

1 Like
root@OpenWrt:/tmp# ./a.sh
phy0: MediaTek Filogic 880 (MT7986 integrated WiFi)  (mt798x-wmac)
phy1: MediaTek Filogic 880 (MT7986 integrated WiFi)  (mt798x-wmac)

T-56 / EX5601

root@OpenWrt:/tmp# ./a.sh
phy0: Qualcomm QCN9074/QCN5024 (ath11k)  (ath11k)
phy1: Qualcomm QCN9074/QCN5024 (ath11k)  (ath11k)

SAX1V1K

1 Like
phy0: MediaTek Filogic 810/880 (MT7981/MT7986 integrated WiFi)  (mt798x-wmac)
phy1: MediaTek Filogic 810/880 (MT7981/MT7986 integrated WiFi)  (mt798x-wmac)
root@lince:/tmp/tmp.HnBOAo# cat /tmp/sysinfo/model
Xiaomi Mi Router AX3000T (OpenWrt U-Boot layout)
1 Like

That's Xiaomi AX3000T I guess?

1 Like

I've updated the script,, try it again.

not sure if useful, but it might be a good idea if script prints what version of OpenWRT it's executed on ?

Good idea, script updated. Give it a try now.

1 Like

@frollic @brada4
I've added manufacturer/model as well as OpenWrt version, give it a try again.

Fixed the board name bit and updated the script.
Try it now @frollic @brada4 @misterb and anyone else please.

OpenWrt: 24.10.4 OpenWrt 24.10.4 r28959-29397011cc
Device: Zyxel EX5601-T0 ubootmod
LAN
WAN
WIFI-2.4G
WIFI-5G
phy0: MediaTek Filogic 810/880 (MT7981/MT7986 integrated WiFi)  (mt798x-wmac)
phy1: MediaTek Filogic 810/880 (MT7981/MT7986 integrated WiFi)  (mt798x-wmac)
OpenWrt: 24.10.0 OpenWrt 24.10.0 r28427-6df0e3d02a
Device: Cudy TR3000 v1
phy0: MediaTek Filogic 810/880 (MT7981/MT7986 integrated WiFi)  (mt798x-wmac)
phy1: MediaTek Filogic 810/880 (MT7981/MT7986 integrated WiFi)  (mt798x-wmac)
OpenWrt: SNAPSHOT OpenWrt SNAPSHOT r22036-1a145ccb0a
Device: Dynalink DL-WRX36
phy0: Qualcomm ath11k Wi-Fi 6  (ath11k)
phy1: Qualcomm ath11k Wi-Fi 6  (ath11k)

(yes, I know it's an ancient snapshot, but these are APs, and they're rock steady)

1 Like

My original post has, for some reason, been flagged by the community - I have no idea why.

Anyway, until two days ago the apu2 has happily been running pfSense and it does have a WiFi card fitted - a Compex WLE200NX - but I haven’t yet got around to configuring it on OpenWrt.

The latest incarnation of the script prints this:

OpenWrt: 24.10.4 OpenWrt 24.10.4 r28959-29397011cc
Device: PC Engines apu2
WAN
LAN
DIAG

Looks normal to me....

It will be interesting to see if it appears in the script output once you install the drivers/configure.

OpenWrt: 24.10.4 OpenWrt 24.10.4 r28959-29397011cc
Device: Xiaomi Redmi Router AX6S
WAN
OpenWrt: 24.10.4 OpenWrt 24.10.4 r28959-29397011cc
Device: OpenWrt One
WANACT
WANLINK
LANACT
LANLINK

phy0: MediaTek Filogic 810/880 (MT7981/MT7986 integrated WiFi) (mt798x-wmac)
phy1: MediaTek Filogic 810/880 (MT7981/MT7986 integrated WiFi) (mt798x-wmac)
OpenWrt: 7.2.3 TurrisOS 7.2.3 4e1d1b7df0ce6fa96d7462dc883917682f428046
Device: Turris Omnia
phy0: unknown  (ath10k_pci)
phy1: unknown  (ath9k)

I know, not OpenWrt and long in the tooth, but the failure to report the phys might still be diagnostic for something in the script.

1 Like
OpenWrt: 24.10.2 OpenWrt 24.10.2 r28739-d9340319c6
Device: Belkin RT1800
wan
phy0: unknown  (mt7915e)
phy1: unknown  (mt7915e)
OpenWrt: 24.10.3 OpenWrt 24.10.3 r28872-daca7c049b
Device: Zbtlink ZBT-WE1326
phy0: unknown  (mt7603e)
phy1: unknown  (mt76x2e)
OpenWrt: SNAPSHOT OpenWrt SNAPSHOT r22256-14334c222e
Device: AVM FRITZ!Box 7530
DSL
WLAN

phy0: unknown (ath10k_ahb)
phy1: unknown (ath10k_ahb)
OpenWrt: 24.10.4 OpenWrt 24.10.4 r28959-29397011cc
Device: Netgear WNDR3700 v2
phy0: unknown  (ath9k)
phy1: unknown  (ath9k)

Script updated to get rid of any "name" duplicates giving superfluous output lines.