OpenWRT and Tracking Down Firmeware Drivers and KMOD Stuff
Wanna track down Firmware / Driver and / or KMOD Module for some obscure USB Wireless Device?
Command: hwinfo
(maybe, but not likley)
How about searching some forums? Result: Hair ripping out pain reading through all the drivel. Just no.
OK, how about identifying the actual Chip or Chipset that is in the device
- Look at the microscopic printing on the Chip. Might need to use a microscope or super zoom on a phone camera.
- Maybe the seller has the information in the listing. Sure, right.
- What about plugging it into a Windows computer and using something like USB Tree View or AIDA to figure it out? Sure, that can work.
But... Even then, it sometimes doesn't help.
Take little journey here
Golly Whopper In, Story Begin!
Here's a live example for a very inexpensive (sometimes under $10 on Amazon.com) USB WiFi Device with DUAL 2.4 and 5.0 GHz Radios and a detachable RP-SMA Antenna. There is no question about it, this device has a RealTEK 8811CU Chip / Chipset. It was identified visually, by the vendor selling it, and using Windows tools to verify it. It is a RealTEK 8811CU Chip / Chipset.
Will it work with OpenWRT? Let's check and see if anything matches it.
So we're out of luck? Not so fast. Try the below 'process';
First and Foremost
...you'll need a NanoPi running the FriendlyWRT OS / Firmware
Why? Because these guys have done a great job on creating a great device that will come with fairly recent Firmware (case in point, purchased a device 08.2024 that was running OpenWRT 23.05.02 (OK, FriendlyWRT, but it's based on OpenWRT of course). That, plus they've included every Driver / Firmware File and KMOD Modules that OpenWRT seems to have, right into the Kernel (or so it seems). And that is very, very helpful.
Check them out;
- R5C (no Wireless card or Antennas, yup, wouldn't know it by the Title and Description)
- R5C (with Wireless Card and Antennas)
- Wiki for Friendly Elec: https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R5C
- Repositories: https://mirrors.cloud.tencent.com/openwrt/releases/23.05.2
The Commands to Figure Out What Driver to Use (or is being used)
Remember, all the below works because the "FriendlyWRT" people have compiled so much stuff directly into the Kernel Image (as opposed to opkg install WhatEver). Otherwise one would need to install just about every RealTEK or MediaTEK, Railink, etc. KMOD Module and Firmware / Driver File.
Plug in the device and odds are it will be recognized by OpenWRT, err, FriendlyWRT and work right away. Erase the contents of the /etc/config/wireless File, then type: wifi config
A script will run and populate the /etc/config/wireless File.
Then type the below command;
lsusb
(orlspci -nn
if using a PCI based device)
Result: Bus 007 Device 002: ID 0bda:c811 Realtek 802.11ac NIC
The important part is the Vendor ID: 0bda:c811
Now type this command: grep -i "0bda.*c811" /lib/modules/$(uname -r)/modules.alias
(this assumes the modules.alias file exists, which it doesn't always exist)
alias usb:v0BDApC811d*dc*dsc*dp*icFFiscFFipFFin* rtl8821CU
...review logs with this command too: dmesg
Ah Ha! That shows the actual Firmware / Driver / KMOD module being used! But guess what? If a search is done using opkg or the LuCI GUI, will there be a result for rtl8821CU? Nope. The closest packages are: kmod-rtl8821ae and rtl8821ae-firmware.
For more detailed information: modinfo rtl8821CU
displays the below information;
filename: /lib/modules/6.1.25/rtl8821CU.ko
import_ns: VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver
version: v5.4.1_28754.20180921_COEX20180712-3232
author: Realtek Semiconductor Corp.
description: Realtek Wireless Lan Driver
license: GPL
srcversion: FCEA94BFD2918CC097B1D1E
alias: usb:v2001p331Dd*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0BDAp2006d*dc*dsc*dp*icFFiscFFipFFin*
alias: usb:v0BDAp8811d*dc*dsc*dp*icFFiscFFipFFin*
alias: usb:v0BDApC811d*dc*dsc*dp*icFFiscFFipFFin*
alias: usb:v0BDApC82Bd*dc*dsc*dp*icFFiscFFipFFin*
alias: usb:v0BDApC82Ad*dc*dsc*dp*icFFiscFFipFFin*
alias: usb:v0BDApC820d*dc*dsc*dp*icFFiscFFipFFin*
alias: usb:v0BDApC821d*dc*dsc*dp*icFFiscFFipFFin*
alias: usb:v0BDApB820d*dc*dsc*dp*icFFiscFFipFFin*
alias: usb:v0BDApB82Bd*dc*dsc*dp*icFFiscFFipFFin*
depends: cfg80211
name: rtl8821CU
vermagic: 6.1.25 SMP mod_unload modversions aarch64
parm: rtw_wireless_mode:int
parm: rtw_ips_mode:The default IPS mode (int)
parm: rtw_lps_level:The default LPS level (int)
parm: rtw_max_bss_cnt:int
parm: rtw_usb_rxagg_mode:int
parm: rtw_dynamic_agg_enable:int
parm: rtw_drv_log_level:set log level when insert driver module, default log level is _DRV_INFO_ = 4 (uint)
parm: rtw_tx_bw_mode:The max tx bw for 2.4G and 5G. format is the same as rtw_bw_mode (uint)
parm: rtw_rx_ampdu_sz_limit_1ss:RX AMPDU size limit for 1SS link of each BW, 0xFF: no limitation (array of uint)
parm: rtw_rx_ampdu_sz_limit_2ss:RX AMPDU size limit for 2SS link of each BW, 0xFF: no limitation (array of uint)
parm: rtw_rx_ampdu_sz_limit_3ss:RX AMPDU size limit for 3SS link of each BW, 0xFF: no limitation (array of uint)
parm: rtw_rx_ampdu_sz_limit_4ss:RX AMPDU size limit for 4SS link of each BW, 0xFF: no limitation (array of uint)
parm: rtw_vht_enable:int
parm: rtw_vht_rx_mcs_map:VHT RX MCS map (uint)
parm: rtw_rf_config:int
parm: rtw_country_code:The default country code (in alpha2) (charp)
parm: rtw_channel_plan:The default chplan ID when rtw_alpha2 is not specified or valid (int)
parm: rtw_excl_chs:exclusive channel array (array of uint)
parm: rtw_btcoex_enable:BT co-existence on/off, 0:off, 1:on, 2:by efuse (int)
parm: rtw_ant_num:Antenna number setting, 0:by efuse (int)
parm: rtw_qos_opt_enable:int
parm: ifname:The default name to allocate for first interface (charp)
parm: if2name:The default name to allocate for second interface (charp)
parm: rtw_pwrtrim_enable:int
parm: rtw_initmac:charp
parm: rtw_special_rf_path:int
parm: rtw_chip_version:int
parm: rtw_rfintfs:int
parm: rtw_lbkmode:int
parm: rtw_network_mode:int
parm: rtw_channel:int
parm: rtw_mp_mode:int
parm: rtw_wmm_enable:int
parm: rtw_vrtl_carrier_sense:int
parm: rtw_vcs_type:int
parm: rtw_busy_thresh:int
parm: rtw_ht_enable:int
parm: rtw_bw_mode:int
parm: rtw_ampdu_enable:int
parm: rtw_rx_stbc:int
parm: rtw_rx_ampdu_amsdu:int
parm: rtw_tx_ampdu_amsdu:int
parm: rtw_lowrate_two_xmit:int
parm: rtw_power_mgnt:int
parm: rtw_smart_ps:int
parm: rtw_low_power:int
parm: rtw_wifi_spec:int
parm: rtw_full_ch_in_p2p_handshake:int
parm: rtw_antdiv_cfg:int
parm: rtw_antdiv_type:int
parm: rtw_drv_ant_band_switch:int
parm: rtw_single_ant_path:int
parm: rtw_switch_usb_mode:int
parm: rtw_enusbss:int
parm: rtw_hwpdn_mode:int
parm: rtw_hwpwrp_detect:int
parm: rtw_hw_wps_pbc:int
parm: rtw_check_hw_status:int
parm: rtw_max_roaming_times:The max roaming times to try (uint)
parm: rtw_mc2u_disable:int
parm: rtw_notch_filter:0:Disable, 1:Enable, 2:Enable only for P2P (uint)
parm: rtw_hiq_filter:0:allow all, 1:allow special, 2:deny all (uint)
parm: rtw_adaptivity_en:0:disable, 1:enable (uint)
parm: rtw_adaptivity_mode:0:normal, 1:carrier sense (uint)
parm: rtw_adaptivity_th_l2h_ini:th_l2h_ini for Adaptivity (int)
parm: rtw_adaptivity_th_edcca_hl_diff:th_edcca_hl_diff for Adaptivity (int)
parm: rtw_amplifier_type_2g:BIT3:2G ext-PA, BIT4:2G ext-LNA (uint)
parm: rtw_amplifier_type_5g:BIT6:5G ext-PA, BIT7:5G ext-LNA (uint)
parm: rtw_RFE_type:default init value:64 (uint)
parm: rtw_powertracking_type:default init value:64 (uint)
parm: rtw_GLNA_type:default init value:0 (uint)
parm: rtw_TxBBSwing_2G:default init value:0xFF (uint)
parm: rtw_TxBBSwing_5G:default init value:0xFF (uint)
parm: rtw_OffEfuseMask:default open Efuse Mask value:0 (uint)
parm: rtw_FileMaskEfuse:default drv Mask Efuse value:0 (uint)
parm: rtw_rxgain_offset_2g:default RF Gain 2G Offset value:0 (uint)
parm: rtw_rxgain_offset_5gl:default RF Gain 5GL Offset value:0 (uint)
parm: rtw_rxgain_offset_5gh:uint
parm: rtw_rxgain_offset_5gm:default RF Gain 5GM Offset value:0 (uint)
parm: rtw_pll_ref_clk_sel:force pll_ref_clk_sel, 0xF:use autoload value (uint)
parm: rtw_tx_pwr_by_rate:0:Disable, 1:Enable, 2: Depend on efuse (int)
parm: rtw_target_tx_pwr_2g_a:2.4G target tx power (unit:dBm) of RF path A for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm: rtw_target_tx_pwr_2g_b:2.4G target tx power (unit:dBm) of RF path B for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm: rtw_target_tx_pwr_2g_c:2.4G target tx power (unit:dBm) of RF path C for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm: rtw_target_tx_pwr_2g_d:2.4G target tx power (unit:dBm) of RF path D for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm: rtw_target_tx_pwr_5g_a:5G target tx power (unit:dBm) of RF path A for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm: rtw_target_tx_pwr_5g_b:5G target tx power (unit:dBm) of RF path B for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm: rtw_target_tx_pwr_5g_c:5G target tx power (unit:dBm) of RF path C for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm: rtw_target_tx_pwr_5g_d:5G target tx power (unit:dBm) of RF path D for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm: rtw_tsf_update_pause_factor:num of bcn intervals to stay TSF update pause status (int)
parm: rtw_tsf_update_restore_factor:num of bcn intervals to stay TSF update restore status (int)
parm: rtw_phy_file_path:The path of phy parameter (charp)
parm: rtw_load_phy_file:PHY File Bit Map (int)
parm: rtw_decrypt_phy_file:Enable Decrypt PHY File (int)
parm: rtw_en_napi:int
parm: rtw_en_gro:int
parm: rtw_iqk_fw_offload:int
parm: rtw_ch_switch_offload:int
Take a look at all the stuff in the kernel image: lsmod
Module Size Used by
sch_sfq 20480 0
sch_pie 20480 0
sch_codel 20480 0
sch_fq_codel 20480 0
br_netfilter 28672 0
wireguard 81920 0
pppoe 28672 0
nft_reject_bridge 16384 0
nft_fib_inet 16384 0
nf_flow_table_inet 16384 0
libchacha20poly1305 16384 1 wireguard
l2tp_ppp 28672 0
iptable_nat 16384 0
ipt_REJECT 16384 0
cdc_mbim 20480 0
bridge 241664 2 nft_reject_bridge,br_netfilter
brcmfmac 282624 0
xt_u32 16384 0
xt_time 16384 0
xt_tcpmss 16384 0
xt_string 16384 0
xt_statistic 16384 0
xt_state 16384 0
xt_recent 24576 0
xt_quota 16384 0
xt_policy 16384 0
xt_pkttype 16384 0
xt_physdev 16384 0
xt_owner 16384 0
xt_nat 16384 0
xt_multiport 20480 0
xt_mark 16384 0
xt_mac 16384 0
xt_limit 20480 0
xt_length 16384 0
xt_iprange 20480 0
xt_hl 16384 0
xt_helper 16384 0
xt_hashlimit 24576 0
xt_esp 20480 0
xt_ecn 16384 0
xt_dscp 16384 0
xt_conntrack 16384 0
xt_connmark 16384 0
xt_connlimit 16384 0
xt_connlabel 16384 0
xt_connbytes 16384 0
xt_comment 16384 0
xt_cluster 16384 0
xt_cgroup 16384 0
xt_bpf 20480 0
xt_addrtype 16384 0
xt_TRACE 16384 0
xt_TPROXY 16384 0
xt_TEE 16384 0
xt_TCPMSS 16384 0
xt_REDIRECT 20480 0
xt_NFQUEUE 16384 0
xt_NFLOG 16384 0
xt_NETMAP 20480 0
xt_MASQUERADE 20480 0
xt_LOG 20480 0
xt_LED 16384 0
xt_HL 16384 0
xt_DSCP 16384 0
xt_CT 16384 0
xt_CLASSIFY 16384 0
xt_CHECKSUM 16384 0
ts_fsm 16384 0
ts_bm 16384 0
stp 16384 1 bridge
sch_cake 36864 0
pptp 32768 0
pppox 20480 3 pppoe,l2tp_ppp,pptp
ppp_mppe 16384 0
ppp_async 24576 0
poly1305_neon 20480 1 libchacha20poly1305
nft_reject_ipv6 16384 0
nft_reject_ipv4 16384 0
nft_reject_inet 16384 2
nft_reject 16384 4 nft_reject_ipv6,nft_reject_bridge,nft_reject_ipv4,nft_reject_inet
nft_redir 16384 0
nft_quota 16384 0
nft_objref 16384 9
nft_numgen 16384 0
nft_nat 16384 0
nft_masq 16384 1
nft_log 16384 0
nft_limit 16384 5
nft_hash 16384 0
nft_fwd_netdev 16384 0
nft_fullcone 65536 0
nft_flow_offload 16384 0
nft_fib_ipv6 16384 1 nft_fib_inet
nft_fib_ipv4 16384 1 nft_fib_inet
nft_fib 16384 3 nft_fib_ipv6,nft_fib_ipv4,nft_fib_inet
nft_dup_netdev 16384 0
nft_ct 20480 13
nft_compat 20480 0
nft_chain_nat 16384 2
nfnetlink_queue 28672 0
nfnetlink_log 24576 0
nf_tproxy_ipv6 20480 1 xt_TPROXY
nf_tproxy_ipv4 20480 1 xt_TPROXY
nf_tables 208896 263 nft_reject_ipv6,nft_hash,nft_reject_bridge,nft_reject_ipv4,nft_flow_offload,nft_ct,nft_compat,nft_dup_netdev,nft_log,nft_nat,nft_quota,nft_fullcone,nft_reject_inet,nft_fib_ipv6,nft_objref,nft_redir,nft_fib_ipv4,nft_fwd_netdev,nft_numgen,nft_masq,nft_chain_nat,nft_limit,nf_flow_table_inet,nft_reject,nft_fib,nft_fib_inet
nf_reject_ipv4 16384 4 nft_reject_bridge,nft_reject_ipv4,nft_reject_inet,ipt_REJECT
nf_nat_tftp 16384 0
nf_nat_snmp_basic 20480 0
nf_nat_sip 20480 0
nf_nat_pptp 20480 0
nf_nat_irc 20480 0
nf_nat_h323 24576 0
nf_nat_ftp 20480 0
nf_nat_amanda 16384 0
nf_nat 61440 17 nf_nat_irc,nf_nat_ftp,nft_nat,nft_fullcone,xt_nat,nf_nat_tftp,nf_nat_amanda,nf_nat_pptp,xt_NETMAP,nft_redir,nft_masq,nf_nat_h323,nft_chain_nat,iptable_nat,xt_MASQUERADE,nf_nat_sip,xt_REDIRECT
nf_log_syslog 20480 0
nf_flow_table 36864 2 nft_flow_offload,nf_flow_table_inet
nf_dup_netdev 16384 2 nft_dup_netdev,nft_fwd_netdev
nf_dup_ipv6 16384 1 xt_TEE
nf_dup_ipv4 16384 1 xt_TEE
nf_conntrack_tftp 20480 3 nf_nat_tftp
nf_conntrack_snmp 16384 2 nf_nat_snmp_basic
nf_conntrack_sip 36864 3 nf_nat_sip
nf_conntrack_pptp 24576 2 nf_nat_pptp
nf_conntrack_netlink 45056 0
nf_conntrack_irc 20480 2 nf_nat_irc
nf_conntrack_h323 61440 5 nf_nat_h323
nf_conntrack_ftp 24576 3 nf_nat_ftp
nf_conntrack_broadcast 16384 1 nf_conntrack_snmp
ts_kmp 16384 6
nf_conntrack_amanda 16384 3 nf_nat_amanda
nf_conncount 28672 1 xt_connlimit
macvlan 28672 0
llc 16384 2 bridge,stp
libcurve25519_generic 40960 1 wireguard
iptable_raw 16384 0
iptable_mangle 16384 0
iptable_filter 16384 0
ipt_rpfilter 16384 0
ipt_ah 20480 0
ipt_ECN 16384 0
ipt_CLUSTERIP 24576 0
ip6table_raw 16384 0
ip6t_rpfilter 16384 0
ip_tables 32768 4 iptable_filter,iptable_raw,iptable_nat,iptable_mangle
cdc_ncm 36864 1 cdc_mbim
brcmutil 16384 1 brcmfmac
act_connmark 16384 0
nf_conntrack 147456 42 xt_conntrack,nf_nat_irc,xt_connlabel,ipt_CLUSTERIP,nf_nat,nft_flow_offload,nf_conntrack_tftp,nft_ct,act_connmark,nf_nat_ftp,xt_state,nf_conntrack_pptp,nft_nat,xt_cluster,nft_fullcone,xt_nat,nf_nat_tftp,nf_nat_amanda,nf_conntrack_sip,xt_helper,nf_conntrack_h323,nf_nat_pptp,xt_NETMAP,nft_redir,nf_conntrack_broadcast,nf_conntrack_irc,nf_conntrack_amanda,nf_conntrack_netlink,xt_connmark,nf_conntrack_ftp,xt_CT,nft_masq,nf_nat_h323,nf_conncount,nf_conntrack_snmp,nf_nat_snmp_basic,xt_MASQUERADE,nf_flow_table,xt_connlimit,nf_nat_sip,xt_REDIRECT,xt_connbytes
nf_defrag_ipv6 24576 2 nf_conntrack,xt_TPROXY
nf_defrag_ipv4 16384 2 nf_conntrack,xt_TPROXY
sch_tbf 20480 0
sch_ingress 16384 0
sch_htb 32768 0
sch_hfsc 24576 0
em_u32 16384 0
cls_u32 24576 0
cls_route 20480 0
cls_matchall 20480 0
cls_fw 20480 0
cls_flow 20480 0
cls_basic 20480 0
act_skbedit 20480 0
act_mirred 20480 0
act_gact 16384 0
configs 65536 0
cryptodev 53248 0
xt_set 20480 0
ip_set_list_set 20480 0
ip_set_hash_netportnet 49152 0
ip_set_hash_netport 49152 0
ip_set_hash_netnet 49152 0
ip_set_hash_netiface 49152 0
ip_set_hash_net 45056 0
ip_set_hash_mac 28672 0
ip_set_hash_ipportnet 49152 0
ip_set_hash_ipportip 45056 0
ip_set_hash_ipport 45056 0
ip_set_hash_ipmark 45056 0
ip_set_hash_ipmac 40960 0
ip_set_hash_ip 40960 0
ip_set_bitmap_port 20480 0
ip_set_bitmap_ipmac 20480 0
ip_set_bitmap_ip 24576 0
ip_set 45056 17 ip_set_hash_ipportnet,ip_set_hash_mac,ip_set_hash_netiface,ip_set_bitmap_port,ip_set_bitmap_ipmac,ip_set_bitmap_ip,ip_set_hash_ip,ip_set_list_set,xt_set,ip_set_hash_net,ip_set_hash_ipport,ip_set_hash_ipmark,ip_set_hash_netportnet,ip_set_hash_ipmac,ip_set_hash_netport,ip_set_hash_ipportip,ip_set_hash_netnet
nfnetlink 20480 7 nfnetlink_queue,nft_compat,nf_conntrack_netlink,nf_tables,ip_set,nfnetlink_log
ip6table_mangle 16384 0
ip6table_filter 16384 0
ip6t_REJECT 16384 0
nf_reject_ipv6 24576 4 nft_reject_ipv6,nft_reject_bridge,nft_reject_inet,ip6t_REJECT
ip_gre 28672 0
gre 16384 2 ip_gre,pptp
ifb 16384 0
dummy 16384 0
l2tp_netlink 24576 1 l2tp_ppp
l2tp_core 40960 2 l2tp_ppp,l2tp_netlink
udp_tunnel 24576 2 l2tp_core,wireguard
ip6_udp_tunnel 16384 2 l2tp_core,wireguard
xfrm4_tunnel 16384 0
ipcomp 16384 0
esp4 28672 0
ah4 20480 0
tunnel4 16384 1 xfrm4_tunnel
ip_tunnel 32768 1 ip_gre
veth 32768 0
tun 53248 0
xfrm_ipcomp 16384 1 ipcomp
af_key 36864 0
ntfs3 225280 0
br2684 24576 0
atm 69632 1 br2684
rtw_8822ce 16384 0
rtw_8822c 466944 1 rtw_8822ce
rtw_pci 28672 1 rtw_8822ce
rtw_core 204800 2 rtw_8822c,rtw_pci
rtl8822cs 2240512 0
rtl8822bu 2240512 0
rtl8821CU 1781760 0
rtl8812au 2306048 0
r8152 106496 0
r8125 163840 0
mt7921u 24576 0
mt7921e 28672 0
mt7921_common 73728 2 mt7921e,mt7921u
mt76_connac_lib 49152 3 mt7921e,mt7921_common,mt7921u
mt76x2u 28672 0
mt76x2_common 24576 1 mt76x2u
mt76x02_usb 24576 1 mt76x2u
mt76x02_lib 61440 3 mt76x02_usb,mt76x2u,mt76x2_common
mt76_usb 32768 3 mt76x02_usb,mt76x2u,mt7921u
mt76 77824 9 mt7921e,mt76_usb,mt76x02_lib,mt76x02_usb,mt7921_common,mt76x2u,mt76x2_common,mt76_connac_lib,mt7921u
mac80211 802816 8 mt76,rtw_core,mt76x02_lib,mt76x02_usb,mt7921_common,mt76x2u,mt76_connac_lib,rtw_pci
ledtrig_netdev 16384 0
iwlwifi 348160 0
bcmdhd 1654784 0
cfg80211 745472 15 rtl8812au,mt76,rtw_core,bcmdhd,mt76x02_lib,brcmfmac,rtl8822bu,iwlwifi,rtl8821CU,mac80211,rtl8822cs,mt76x02_usb,mt7921_common,mt76x2_common,mt76_connac_lib
crypto_user 16384 0
algif_skcipher 16384 0
algif_rng 16384 0
algif_hash 16384 0
algif_aead 16384 0
af_alg 28672 4 algif_hash,algif_skcipher,algif_aead,algif_rng
seqiv 16384 0
echainiv 16384 0
authencesn 16384 0
authenc 16384 1 authencesn
btrfs 1363968 0
xor 16384 1 btrfs
zstd_compress 241664 1 btrfs
xor_neon 20480 1 xor
raid6_pq 102400 1 btrfs
dm_mirror 24576 0
dm_region_hash 20480 1 dm_mirror
dm_log 20480 2 dm_region_hash,dm_mirror
dm_crypt 49152 0
tpm 69632 0
encrypted_keys 20480 1 dm_crypt
The following command:
iw phy phy1 info
(useiw dev
if multiple adapters are connected to determine which device to display information for) ...will display the below information;Wiphy phy1 wiphy index: 1 max # scan SSIDs: 9 max scan IEs length: 2304 bytes max # sched scan SSIDs: 0 max # match sets: 0 Retry short limit: 7 Retry long limit: 4 Coverage class: 0 (up to 0m) Available Antennas: TX 0 RX 0 Supported interface modes: * IBSS * managed * AP * monitor * P2P-client * P2P-GO Band 1: Frequencies: * 2412 MHz [1] (20.0 dBm) * 2417 MHz [2] (20.0 dBm) * 2422 MHz [3] (20.0 dBm) * 2427 MHz [4] (20.0 dBm) * 2432 MHz [5] (20.0 dBm) * 2437 MHz [6] (20.0 dBm) * 2442 MHz [7] (20.0 dBm) * 2447 MHz [8] (20.0 dBm) * 2452 MHz [9] (20.0 dBm) * 2457 MHz [10] (20.0 dBm) * 2462 MHz [11] (20.0 dBm) * 2467 MHz [12] (20.0 dBm) (no IR) * 2472 MHz [13] (20.0 dBm) (no IR) * 2484 MHz [14] (disabled) Band 2: Frequencies: * 5180 MHz [36] (23.0 dBm) * 5200 MHz [40] (23.0 dBm) * 5220 MHz [44] (23.0 dBm) * 5240 MHz [48] (23.0 dBm) * 5260 MHz [52] (23.0 dBm) (no IR, radar detection) * 5280 MHz [56] (23.0 dBm) (no IR, radar detection) * 5300 MHz [60] (23.0 dBm) (no IR, radar detection) * 5320 MHz [64] (23.0 dBm) (no IR, radar detection) * 5500 MHz [100] (30.0 dBm) (no IR, radar detection) * 5520 MHz [104] (30.0 dBm) (no IR, radar detection) * 5540 MHz [108] (30.0 dBm) (no IR, radar detection) * 5560 MHz [112] (30.0 dBm) (no IR, radar detection) * 5580 MHz [116] (30.0 dBm) (no IR, radar detection) * 5600 MHz [120] (30.0 dBm) (no IR, radar detection) * 5620 MHz [124] (30.0 dBm) (no IR, radar detection) * 5640 MHz [128] (30.0 dBm) (no IR, radar detection) * 5660 MHz [132] (30.0 dBm) (no IR, radar detection) * 5680 MHz [136] (30.0 dBm) (no IR, radar detection) * 5700 MHz [140] (30.0 dBm) (no IR, radar detection) * 5720 MHz [144] (disabled) * 5745 MHz [149] (30.0 dBm) * 5765 MHz [153] (30.0 dBm) * 5785 MHz [157] (30.0 dBm) * 5805 MHz [161] (30.0 dBm) * 5825 MHz [165] (30.0 dBm) * 5845 MHz [169] (disabled) * 5865 MHz [173] (disabled) * 5885 MHz [177] (disabled) interface combinations are not supported max # scan plans: 1 max scan plan interval: -1 max scan plan iterations: 0 Supported extended features:
So what the heck package is rtl8821CU.ko in? Turns out, probably none. Evidence suggests that it was compiled from a GitHub project.
...ChatGPT Notes;
On Linux and OpenWRT, most of the driver and device mapping information is indeed compiled into binary files, such as kernel modules and system binaries. However, there are still some plain text files on the device that you can inspect to gather information about supported devices and drivers. Here are the key locations and files you might find useful:
### 1. **`/lib/modules/$(uname -r)/modules.alias`**
- This is a plain text file generated by the kernel build process that maps device IDs to the modules that support them. It’s one of the most useful files for determining which driver supports a particular device.
Example command to search for your device:
```sh
grep "7922" /lib/modules/$(uname -r)/modules.alias
```
### 2. **`/lib/modules/$(uname -r)/modules.dep`**
- This file lists dependencies between kernel modules. While it doesn't directly show device IDs, it can be useful for understanding the relationships between different modules.
To search for a particular module:
```sh
grep "mt7921e" /lib/modules/$(uname -r)/modules.dep
```
### 3. **`/lib/modules/$(uname -r)/modules.builtin`**
- This file lists all the modules that are built into the kernel. If a driver is built into the kernel rather than as a loadable module, it would be listed here.
Example command to check for a built-in module:
```sh
grep "mt7921e" /lib/modules/$(uname -r)/modules.builtin
```
### 4. **`/sys/class/net/<interface>/device/modalias`**
- This is a small text file that contains the alias for the device, which is used to match it with the appropriate module.
Example command:
```sh
cat /sys/class/net/wlan0/device/modalias
```
This will output a string that you can then search for in `modules.alias` or `modinfo`.
### 5. **`/proc/bus/pci/devices`**
- This file contains information about PCI devices detected by the system, including vendor and device IDs, though it doesn’t directly map them to drivers.
To inspect it:
```sh
cat /proc/bus/pci/devices
```
### 6. **`/usr/share/misc/pci.ids`**
- As mentioned earlier, this file is a database of known PCI IDs. It’s a plain text file and can confirm that a device is recognized, though it won’t tell you which driver supports it.
To search for your device:
```sh
grep "7922" /usr/share/misc/pci.ids
```
### 7. **Device Tree Files (`/proc/device-tree` or `/sys/firmware/devicetree/base`)**
- These files (if applicable on your device) describe the hardware layout to the kernel, including information about devices and their compatible drivers. They are often used on ARM-based systems like the RK3568.
To explore these:
```sh
ls /proc/device-tree/
```
These files can provide a lot of useful information, even though much of the driver-device mapping is handled within compiled binaries. If you’re looking for a text file that explicitly lists every supported device, similar to a Windows `.ini` file, the closest equivalent is the `modules.alias` file on the device.
OR
In Linux, the equivalent of Windows' .ini files for driver support information is typically found in a combination of kernel source code, module source files, and device ID mappings that the driver uses to determine hardware compatibility.
### Methods to Find Supported Devices in Linux:
1. **Kernel Source Code and Module Files**:
- The kernel source code for a particular driver often contains a list of supported devices by PCI IDs (like the 7922 you mentioned).
- If you have the source code for the driver, you can search for the PCI ID in the driver files.
For example, you might search in the driver directory (assuming you have access to the source code):
```sh
grep -r "0x7922" /path/to/kernel/source/drivers/net/wireless/mediatek/mt7921/
```
This command searches for the string 0x7922 in the driver files, indicating that the driver supports the device.
2. **PCI ID Database (`/usr/share/misc/pci.ids`)**:
- This file contains a list of known PCI IDs and their associated vendors and devices. It's useful to confirm that the device is recognized but doesn't show which drivers support it.
You can search for the device ID in the pci.ids file:
```sh
grep "7922" /usr/share/misc/pci.ids
```
However, this only tells you about the device itself, not the driver support.
3. **Module Information (`modinfo`)**:
- The `modinfo` command shows detailed information about a kernel module, including the list of supported device IDs (if available).
For example:
```sh
modinfo mt7921e | grep -i "alias"
```
This command will show all the PCI aliases (device IDs) that the `mt7921e` module supports. If `7922` appears, it confirms that the driver supports your device.
4. **Device ID Lists in `/lib/modules/$(uname -r)/modules.alias`**:
- The `modules.alias` file contains mappings of device IDs to the modules that support them. This file is generated automatically when modules are built.
You can search this file to see if your device is supported by any module:
```sh
grep "7922" /lib/modules/$(uname -r)/modules.alias
```
This will show you which module(s) claim to support the `7922` device ID.
### Example Workflow:
To find out which driver supports the `7922` device:
1. **Search `modules.alias`**:
```sh
grep "7922" /lib/modules/$(uname -r)/modules.alias
```
Output might look something like:
```
alias pci:v000014C3d00007922sv*sd*bc*sc*i* mt7921e
```
This line means that the `mt7921e` module supports the PCI device with vendor ID `0x14C3` and device ID `0x7922`.
2. **Use `modinfo` to Verify**:
```sh
modinfo mt7921e | grep "7922"
```
This should confirm that the driver includes support for the device.
By following these steps, you can verify whether a driver supports a particular device in Linux, similar to how you would examine a `.ini` file in Windows.