全志D1-H哪吒开发板Tina Linux 下WiFi的连接

2024-02-02 15:27:41 浏览数 (2)

16、查看wifi规格

支持2.4G wifi,支持13个工作信道(Channel1-13),提供wifi扫描命令,可搜索到附件的wifi list。

执行:

代码语言:javascript复制
wifi_scan_results_test

可以看到:

代码语言:javascript复制
root@TinaLinux:/# wifi_scan_results_test

*********************************
***Start scan!***
*********************************
bssid / frequency / signal level / flags / ssid
0e:e0:df:1e:6a:36       2472    -39     [WPA2-PSK-CCMP][ESS]    RANDOLPH
******************************
Wifi get_scan_results: Success!
******************************

17、station模式

开机时如检测到曾经连接过wifi,则自动连接上一此连接的wifi。

执行:

代码语言:javascript复制
wifi_connect_ap_test <ssid> <psk>

可见:

代码语言:javascript复制
root@TinaLinux:/# wifi_connect_ap_test  RANDOLPH xxxxxxxx
==================================
Connected to the AP(RANDOLPH)
Getting ip address(RANDOLPH)......
auto connected Successful  !!!!
==================================
Connecting to the network(RANDOLPH)......
sh: odhcp6c: not found
[   84.050715] wlan0: deauthenticating from 0e:e0:df:1e:6a:36 by local choice (reason=3)
[   84.085703] [WSM_WRN] Issue unjoin command(TX).
[   84.092916] [WSM_WRN] STA mode, send_deauth_to_self
[   84.098429] [TXRX_WRN] Issue unjoin command(TX) by self.
[   85.775478] wlan0: authenticate with 0e:e0:df:1e:6a:36 (try 1)
[   85.782532] [STA_WRN] [HT40][xradio_join_work][bss_ht_info]:
[   85.782532] [primary_chan  :0x0000000d]
[   85.782532] [ht_param      :0x00000000]
[   85.782532] [operation_mode:0x00000000]
[   85.782532] [stbc_param    :0x00000000]
[   85.782532] [basic_set[0]  :0x00000000]
[   85.810406] [STA_WRN] [HT40][xradio_join_work][PhyModeCfg:0x0007]
[   85.810406] [ModemFlags    :0x00000007]
[   85.810406] [ChWidthCfg    :0x00000000]
[   85.810406] [PriChCfg      :0x00000000]
[   85.810406] [BandCfg       :0x00000000]
[   85.810406] [STBC_Enable   :0x00000000]
[   85.810406] [PreambleCfg   :0x00000000]
[   85.810406] [SGI_Enable    :0x00000000]
[   85.810406] GF_Enable      :0x00000000]
[   85.867864] wlan0: authenticated
[   85.872260] wlan0: associate with 0e:e0:df:1e:6a:36 (try 1)
[   85.886562] wlan0: RX AssocResp from 0e:e0:df:1e:6a:36 (capab=0x411 status=0 aid=1)
[   85.895310] wlan0: associated
[   85.904359] [AP_WRN] arp_addr_cnt not clear at disconnecting,filter abnormal enable!!!
[   85.914312] [AP_WRN] [STA] ASSOC HTCAP 11N 58
[   85.919277] [AP_WRN] [HT40][xradio_bss_info_changed][ht_prot:0x00000000][HtProtMode:0x0000][Green:0x0000]
[   85.919673] [AP_WRN] [HT40][xradio_bss_info_changed][PhyModeCfg:0xd007]
[   85.919673] [ModemFlags    :0x00000007]
[   85.919673] [ChWidthCfg    :0x00000000]
[   85.919673] [PriChCfg      :0x00000000]
[   85.919673] [BandCfg       :0x00000000]
[   85.919673] [STBC_Enable   :0x00000000]
[   85.919673] [PreambleCfg   :0x00000001]
[   85.919673] [SGI_Enable    :0x00000001]
[   85.919673] [GF_Enable     :0x00000001]
Connected to the AP(RANDOLPH)
Getting ip address(RANDOLPH)......
Wifi connect ap : Success!
==================================

可以ping百度验证:

代码语言:javascript复制
root@TinaLinux:/# ping baidu.com
PING baidu.com (220.181.38.148): 56 data bytes
64 bytes from 220.181.38.148: seq=0 ttl=50 time=84.309 ms
64 bytes from 220.181.38.148: seq=1 ttl=50 time=75.818 ms
64 bytes from 220.181.38.148: seq=2 ttl=50 time=69.916 ms
64 bytes from 220.181.38.148: seq=3 ttl=50 time=71.139 ms
64 bytes from 220.181.38.148: seq=4 ttl=50 time=102.807 ms
^C
--- baidu.com ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 69.916/80.797/102.807 ms

18、Softap模式

支持softap模式,提供softap模式demo,开启后可被其他设备连入。

执行:

代码语言:javascript复制
softap_up <ssid> <pwd> <broadcast/hidden>
softap_down

可见

代码语言:javascript复制
root@TinaLinux:/# softap_up nezha 12345678 broadcast
***************************
Start hostapd test!
***************************
wpa2-psk!
Start to set softap!
Message is: OK
Set softap finished!
[  433.525126] [TXRX_WRN] drop=1771, fctl=0x00d0.
[  433.552706] wlan0: deauthenticating from 0e:e0:df:1e:6a:36 by local choice (reason=3)
[  433.589037] [WSM_WRN] Issue unjoin command(TX).
[  433.599152] [WSM_WRN] STA mode, send_deauth_to_self
[  433.604623] [TXRX_WRN] Issue unjoin command(TX) by self.
[  433.678548] [STA_WRN] !!! xradio_remove_interface: vif_id=0
[  435.741366] ieee80211_do_open: vif_type=2, p2p=0, ch=3, addr=40:3f:ea:5e:f0:32
[  435.758671] [STA] !!!xradio_vif_setup: id=0, type=2, p2p=0, addr=40:3f:ea:5e:f0:32
[  435.784698] [AP_WRN] BSS_CHANGED_ASSOC but driver is unjoined.
Start to start softap!
SoftAP started successfullyHaving catch sig_chld!
Message is: OK
Start softap finished!

打开手机wifi可见:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-bmsmUuhl-1645595979863)(material/image-20211223100707167.png)]

关闭则执行:

代码语言:javascript复制
softap_down

注意:是无法访问网络的。

19、自动搜索

已连接ap后,会自动搜索保存的列表,重启后自动连接。

20、信号强度获取

同16条,结果中可见。

原贴链接:https://bbs.aw-ol.com/topic/841/

0 人点赞