D1哪吒开发板wifi连接出错,这是什么情况?
-
root@TinaLinux:/# wifi_connect_ap_test test test ================================== connect wpa_supplicant failed,please check wifi driver! wifi on failed
-
root@TinaLinux:/# wifi_connect_ap_test ssid_ubuntu 123456785 ================================== Connecting to the network(ssid_ubuntu)...... [ 49.066175] [STA_WRN] Freq 2412 (wsm ch: 1) prev: 3. [ 49.072027] wlan0: authenticate with e4:26:8b:89:a9:f8 (try 1) [ 49.083424] [STA_WRN] [HT40][xradio_join_work][bss_ht_info]: [ 49.083424] [primary_chan :0x00000001] [ 49.083424] [ht_param :0x00000000] [ 49.083424] [operation_mode:0x00000017] [ 49.083424] [stbc_param :0x00000000] [ 49.083424] [basic_set[0] :0x00000000] [ 49.111324] [STA_WRN] [HT40][xradio_join_work][PhyModeCfg:0x0007] [ 49.111324] [ModemFlags :0x00000007] [ 49.111324] [ChWidthCfg :0x00000000] [ 49.111324] [PriChCfg :0x00000000] [ 49.111324] [BandCfg :0x00000000] [ 49.111324] [STBC_Enable :0x00000000] [ 49.111324] [PreambleCfg :0x00000000] [ 49.111324] [SGI_Enable :0x00000000] [ 49.111324] GF_Enable :0x00000000] [ 49.173244] wlan0: authenticated [ 49.177518] wlan0: associate with e4:26:8b:89:a9:f8 (try 1) [ 49.192728] wlan0: RX AssocResp from e4:26:8b:89:a9:f8 (capab=0x1431 status=0 aid=78) [ 49.202004] wlan0: associated [ 49.212504] [AP_WRN] [STA] ASSOC HTCAP 11N 58 [ 49.217367] [AP_WRN] [HT40][xradio_bss_info_changed][ht_prot:0x0000000e][HtProtMode:0x0003][Green:0x0004] [ 49.217843] [AP_WRN] [HT40][xradio_bss_info_changed][PhyModeCfg:0x5007] [ 49.217843] [ModemFlags :0x00000007] [ 49.217843] [ChWidthCfg :0x00000000] [ 49.217843] [PriChCfg :0x00000000] [ 49.217843] [BandCfg :0x00000000] [ 49.217843] [STBC_Enable :0x00000000] [ 49.217843] [PreambleCfg :0x00000001] [ 49.217843] [SGI_Enable :0x00000001] [ 49.217843] [GF_Enable :0x00000000] [ 49.347203] [TXRX_WRN] [RX] IF=0, No key found. [ 49.652668] [TXRX_WRN] [RX] IF=0, No key found. [ 49.859090] [TXRX_WRN] [RX] IF=0, No key found. [ 51.700693] [TXRX_WRN] [RX] IF=0, No key found. [ 51.906338] [TXRX_WRN] [RX] IF=0, No key found. [ 53.646240] [TXRX_WRN] [RX] IF=0, No key found. [ 53.851963] [TXRX_WRN] [RX] IF=0, No key found. [ 55.694229] [TXRX_WRN] [RX] IF=0, No key found. [ 57.641342] [TXRX_WRN] [RX] IF=0, No key found. [ 59.288146] wlan0: deauthenticating from e4:26:8b:89:a9:f8 by local choice (reason=3) [ 59.297210] [WSM_WRN] Issue unjoin command(TX). [ 59.303604] [WSM_WRN] STA mode, send_deauth_to_self [ 59.309107] [TXRX_WRN] Issue unjoin command(TX) by self.
spi nand 自带的固件是这样的
-
重新下载一份出场固件试试效果
-
@ubuntu 这种通常都是 WIFI 驱动存在问题,如加载的不是对应芯片的驱动,又如驱动识别不到芯片(通讯异常)。具体要看机器启动时的内核打印信息。
-
-
@ubuntu 出场固件也连接不上吗
-
大概知道原因了,把 img 烧到 TF卡启动,然后执行 wifi_connect_ap_test 是连不上的。
然后我手动建立 /etc/wpa_supplicant.conf 提示只读,创建文件失败,
然后我再建立 /tmp/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=0 ap_scan=1 network={ ssid="ubuntu" scan_ssid=1 key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE pairwise=TKIP CCMP group=CCMP TKIP WEP104 WEP40 psk="13800138000" priority=5 }
root@TinaLinux:/# wpa_supplicant -B -d -i wlan0 -c /tmp/wpa_supplicant.conf Successfully initialized wpa_supplicant [ 565.756909] ieee80211_do_open: vif_type=2, p2p=0, ch=3, addr=70:f4:4d:76:31:86 [ 565.765681] [STA] !!!xradio_vif_setup: id=0, type=2, p2p=0, addr=70:f4:4d:76:31:86 [ 565.779627] [AP_WRN] BSS_CHANGED_ASSOC but driver is unjoined.
root@TinaLinux:/# udhcpc -i wlan0 udhcpc: started, v1.27.2 udhcpc: sending discover udhcpc: sending select for 192.168.151.222 udhcpc: lease of 192.168.151.222 obtained, lease time 3599 udhcpc: ifconfig wlan0 192.168.151.222 netmask 255.255.255.0 broadcast 192.168.151.255 udhcpc: setting default routers: 192.168.151.42 root@TinaLinux:/# root@TinaLinux:/# root@TinaLinux:/# ping www.163.com PING www.163.com (36.158.202.26): 56 data bytes 64 bytes from 36.158.202.26: seq=0 ttl=53 time=54.414 ms 64 bytes from 36.158.202.26: seq=1 ttl=53 time=60.232 ms 64 bytes from 36.158.202.26: seq=2 ttl=53 time=58.636 ms
也就是说wifi本身没什么问题,估计是那些 wifi tools 需要可读写文件系统的原因,我再观察观察。
-
看了一下源码,还真是要写 /etc/ 目录下面的文件:
ubuntu:/opt/D1/tina_d1_open$ grep /etc -r package/allwinner/wifimanager/ --include *.c package/allwinner/wifimanager/demo/wifi_longtime_test.c: wmg_printf(MSG_INFO,"DESCRIPTION:\n\tTest the stability of wifi module(see the test result in file:/etc/test_result).\n"); package/allwinner/wifimanager/demo/wifi_longtime_test.c: *see the test result in file:/etc/test_result package/allwinner/wifimanager/demo/wifi_longtime_test.c: wmg_debug_open_file("/etc/wifi_long_time_test.log"); package/allwinner/wifimanager/demo/wifi_longtime_test.c: sprintf(prt_buf,"echo \"Test Times:%d, Success Times:%d(including get IP timeout times:%d), Failed Times:%d\" > /etc/test_results",i,success_times,timeout_times,fail_times); package/allwinner/wifimanager/demo/wifi_longtime_test.c: sprintf(prt_buf,"echo \"Connecting mean time: %llu.%-llu seconds\" >> /etc/test_results",(total_con_microsec/1000000)/i,(total_con_microsec/i)%1000000); package/allwinner/wifimanager/demo/wifi_longtime_test.c: wmg_printf(MSG_INFO,prt_buf,"echo \"Disconnecting mean time: %llu.%-llu seconds\" >> /etc/test_results",(total_disc_microsec/1000000)/i,(total_disc_microsec/i)%1000000); package/allwinner/wifimanager/demo/wifi_longtime_test.c: sprintf(prt_buf,"echo Congratulations! >> /etc/test_results"); package/allwinner/wifimanager/src/core/wifi_udhcpc.c: system("/etc/wifi/udhcpc_wlan0 start >/dev/null"); package/allwinner/wifimanager/src/core/wifimanager.c: system("/etc/wifi/udhcpc_wlan0 stop >/dev/null"); package/allwinner/wifimanager/src/core/wifi.c:static const char IFACE_DIR[] = "/etc/wifi/sockets"; package/allwinner/wifimanager/src/core/wifi.c:static const char SUPP_CONFIG_TEMPLATE[]= "/etc/wifi/wpa_supplicant_src.conf"; package/allwinner/wifimanager/src/core/wifi.c:static const char SUPP_CONFIG_FILE[] = "/etc/wifi/wpa_supplicant.conf"; package/allwinner/wifimanager/src/core/wifi.c:static const char CONTROL_IFACE_PATH[] = "/etc/wifi/sockets"; package/allwinner/wifimanager/src/core/wifi.c: strncpy(cmd, "/etc/wifi/wifi start", 511); package/allwinner/wifimanager/src/core/wifi.c: system("/etc/wifi/wifi stop"); package/allwinner/wifimanager/src/daemon/wifid_cmd_handle.c: system("/etc/init.d/wifi_daemon start"); package/allwinner/wifimanager/src/daemon/wifid_cmd_handle.c: system("/etc/init.d/wifi_daemon stop"); ubuntu:/opt/D1/tina_d1_open$ ubuntu:/opt/D1/tina_d1_open$
-
如果是烧卡启动,系统是把 只读的squashfs挂到根文件系统 /
并没有可读写的 overlayfs ,所以出现了 /etc/ 目录不可写的问题
root@TinaLinux:/# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 17152 17152 0 100% / devtmpfs 503924 0 503924 0% /dev tmpfs 508116 52 508064 0% /tmp /dev/mmcblk0p1 8151 305 7846 4% /mnt/SDCARD root@TinaLinux:/# root@TinaLinux:/# root@TinaLinux:/# mount /dev/root on / type squashfs (ro,noatime) devtmpfs on /dev type devtmpfs (rw,relatime,size=503924k,nr_inodes=125981,mode=755) proc on /proc type proc (rw,nosuid,nodev,noexec,noatime) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000) debugfs on /sys/kernel/debug type debugfs (rw,noatime) none on /sys/kernel/config type configfs (rw,relatime) adb on /dev/usb-ffs/adb type functionfs (rw,relatime) /dev/mmcblk0p1 on /mnt/SDCARD type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro) root@TinaLinux:/#
-
成功破案
-
以下是SPI NAND FLASH版本启动后执行 mount目录的信息,由于加载overlayfs 文件系统,这样就可以写 /etc/ 目录了
root@TinaLinux:/# mount /dev/root on /rom type squashfs (ro,noatime) devtmpfs on /dev type devtmpfs (rw,relatime,size=504012k,nr_inodes=126003,mode=755) proc on /proc type proc (rw,nosuid,nodev,noexec,noatime) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime) /dev/by-name/UDISK on /overlay type ubifs (rw,relatime,assert=read-only,ubi=0,vol=8) overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000) debugfs on /sys/kernel/debug type debugfs (rw,noatime) none on /sys/kernel/config type configfs (rw,relatime) adb on /dev/usb-ffs/adb type functionfs (rw,relatime) root@TinaLinux:/#
root@TinaLinux:/# find / -name wpa_supplicant.conf /etc/wifi/wpa_supplicant.conf /overlay/upper/etc/wifi/wpa_supplicant.conf /rom/etc/wifi/wpa_supplicant.conf
读写 /etc/wifi/wpa_supplicant.conf
文件时, 如果发现 /overlay/upper/etc/wifi/wpa_supplicant.conf 存在,则不会访问 /rom/etc/wifi/wpa_supplicant.conf 文件。 -
@bedrock
这次真破案了, 把同一个 img 文件烧录到 spi flash,wifi连接正常,说明还是 /etc 目录无写入权限引起。 -
围观,这次又要充值捏脚吗?
-
这个问题我也遇到了,把根文件系统格式改成可读写的 ext4 解决了:
https://bbs.aw-ol.com/topic/297/固件发布-d1哪吒hdmi测试固件20210804-开机hdmi就有小企鹅启动logo/3
这里面有配置文件,跟着编译一次即可。
-
@whycan 顶一下 我也遇到了这个问题,请问如何具体操作呢?
-
哈哈,抱歉来晚了。
整理一下Wi-Fi的启动流程:
1.系统启动通过sunxi-rf驱动读取board.dts配置,解析供电,sdio,引脚,时钟等配置。完成上电动作。
2.驱动加载时完成扫卡,下载firmware,add wlan0 interface。
3.系统的自启动脚本在etc/init.d/wpa_supplicant中启动服务,启wlan0。
4.利用wpa_cli/wifimanager进行应用的操作。
上面的错误
建议排查思路:
1.系统起来执行lsmod 查看xradio_mac/xradio_core/xradio_wlan(也有可能是单ko的形式xr829)驱动是否加载成功。
顺便提一下驱动加载失败最常见的错误:1.供电不匹配。 2.扫卡时失败,sdio配置错误。 3.下载firmware失败。(注意路径:默认是/lib/firmware)
2.执行ps | grep wpa_supplicant查看服务是否启动。
也可以直接执行./etc/init.d/wpa_supplicant start //再次手动启动
服务启动失败的常见原因:
1.前面驱动加载已经失败了,导致没有wlan0 interface. 2.配置文件不存在比如:wpa_supplicant.conf。默认是在/etc/wifi、目录下 3.文件存在,但是文件系统只读,导致无法对配置文件写操作。
可以手动执行wpa_supplicant命令起服务就可以看到提示如下:
Successfully initialized wpa_supplicant [ 796.252780] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready mkdir[ctrl_interface=/etc/wifi/sockets]: **Read-only file system** Failed to initialize control interface '/etc/wifi/sockets'. You may have another wpa_supplicant process already running or the file was left by an unclean termination of wpa_supplicant in which case you will need to manually remove this file before starting wpa_supplicant again. nl80211: deinit ifname=wlan0 disabled_11b_rates=0
解决办法:
1.直接修改文件系统,换成可读写的,例如ext4.
2.可以自己临时创建配置文件到/tmp目录。 -
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号