一个简单的wifi热点启动流程追踪

本文记录了在启用ACS(Automatic Channel Selection)功能时遇到的问题,涉及ACS初始化、驱动函数调用和硬件模式选择。开发者在尝试打开ACS逻辑开关后,遇到硬件不支持配置频道导致的初始化失败,重点在于`hostapd_select_hw_mode`和`acs_request_scan`函数中的错误排查。


最近在调试wifi的热点相关的东西,做下笔记。代码根据log进行调用追踪。
之前说过,我在关闭CONFIG_ACS的开关后,可以实现热点的打开。但我尝试去打开ACS的逻辑开关过后,发现了新的问题,为了方便自己记录流程,所以做了这个笔记。

一、ACS初始化函数

log

2-23 09:29:48.979  2251  2251 I hostapd : ACS: Automatic channel selection started, this may take a bit start !!!!
02-23 09:29:48.979  2251  2251 E hostapd :acs_request_scan funcation start !!! 
02-23 09:29:48.979  2251  2251 E hostapd : ACS: Scanning 1 / 5
02-23 09:29:48.979  2251  2251 E hostapd : hostapd_driver_scan 111
02-23 09:29:50.708  2251  2251 E hostapd : acs_request_scan Failed to request initial scan
02-23 09:29:50.708  2251  2251 I hostapd : wlan0: IEEE 802.11 Configured channel (0) or frequency (0) not found from the channel list of the current mode (1) IEEE 802.11g
02-23 09:29:50.708  2251  2251 W hostapd : wlan0: IEEE 802.11 Configured channel (0) or frequency (0) not found from the channel list of the current mode (1) IEEE 802.11g
02-23 09:29:50.709  2251  2251 I hostapd : wlan0: IEEE 802.11 Hardware does not support configured channel
02-23 09:29:50.709  2251  2251 W hostapd : wlan0: IEEE 802.11 Hardware does not support configured channel
02-23 09:29:50.709  2251  2251 E hostapd : Could not select hw_mode and channel. (-3)
02-23 09:29:50.709  2251  2251 I hostapd : wlan0: interface state UNINITIALIZED->DISABLED
02-23 09:29:50.709  2251  2251 I hostapd : wlan0: AP-DISABLED 
02-23 09:29:50.709  2251  2251 E hostapd : wlan0: Unable to setup interface.
02-23 09:29:50.709  2251  2251 I hostapd : nl80211: deinit ifname=wlan0 disabled_11b_rates=0
external/wpa_supplicant_8/wpa_supplicant/src/ap/acs.c

/*首先进入初始化函数*/
enum hostapd_chan_status acs_init(struct hostapd_iface *iface)
{
   
   
    wpa_printf(MSG_INFO, "ACS: Automatic channel selection started, this may take a bit");

    if (iface->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) {
   
   
        wpa_printf(MSG_INFO, "ACS: Offloading to driver");
        if (hostapd_drv_do_acs(iface->bss[0]))
            return HOSTAPD_CHAN_INVALID;
        return HOSTAPD_CHAN_ACS;
    }

    if (!iface->current_mode &&
        iface->conf->hw_mode != HOSTAPD_MODE_IEEE80211ANY)
        return HOSTAPD_CHAN_INVALID;

    acs_cleanup(iface);//清除之前的数据防止干扰
	/*调用acs_request_scan函数进行扫描*/
    if (acs_request_scan(iface) < 0)
        return HOSTAPD_CHAN_INVALID;
	/*设置接口状态*/
    hostapd_set_state(iface, HAPD_IFACE_ACS);
    wpa_msg(iface->bss[0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

永不秃头的程序员

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值