简体   繁体   中英

Hostapd: How to know the frequency of AP mode

On Linux, I'm using hostapd in AP mode. In other words, the system is the hotspot.

I would like to know what is the frequency of the Wi-Fi via c code (or a bash script that I could translate to c code).

The following code which queries the kernel, only works in normal mode. It fails in AP mode.

ioctl(net_sock, SIOCGIWFREQ, &wrq);

In bash, I have tried:

iwconfig
iw dev

but it doesn't report the frequency of the Wi-Fi. Same problem: it only reports in normal mode when the system associates to a router but nothing in AP mode.

How can I query hostapd to know the frequency hostapd is using or is configured to use?

Maybe i do not get it.

I just use

iw dev info

iw wlan1 info

Interface wlan1
        ifindex 14
        wdev 0x100000003
        addr 10:16:88:bf:a3:ed
        ssid siwifi-a3ec
        type AP
        wiphy 1
        channel 161 (5805 MHz), width: 80 MHz, center1: 5775 MHz
        txpower 30.00 dBm

or

hostapd_cli -i <interface> status

freq=5805

to get the freq info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM