STM32MP1 WiFi连接
# D3 N; P6 w' A& x% A6 P* L: ]$ w- Documentation to activate manually wireless interface
- p9 Y3 U7 n; J, M, E - 1. generate the specific wpa_supplicant file
S9 l4 K g, @- y: B6 @7 C- \ - mkdir -p /etc/wpa_supplicant/
2 F7 h z: V8 c& M3 ~ - echo "ctrl_interface=/var/run/wpa_supplicant" > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
( h2 c0 S4 l! m- [& l - echo "eapol_version=1" >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf# p& x' x1 ^# d; P, d) c" z
- echo "ap_scan=1" >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf U/ G/ f" X4 H% X/ M1 \! ]; U
- echo "fast_reauth=1" >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf: t7 `) M. [' w5 m( b" {8 Z' r
- echo "" >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf/ R# t) k6 Z+ F
- wpa_passphrase SSID_OF_NETWORK PASSWORD_OF_NETWORK >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf$ h. d, Y' M# r
- or
5 c& `' W! U4 c3 O6 z7 S% D& W - wpa_passphrase ssid_of_network >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
; a4 }8 {, u9 s0 Q C1 j9 s - 2. put in place network configuration
" e: W: b8 R7 {' G# t - rename file 51-wireless.network.sample to 51-wireless.network on /usr/lib/systemd/network/ or /lib/systemd/network/0 \/ @) Z6 z0 }, s# R
- 3. restart/start service* T9 _& s2 t5 q2 ?# G
- systemctl enable systemd-networkd.service
6 z- Y/ d4 R( Q0 |3 L -
" d( T3 b: O: B: L5 v - systemctl restart systemd-networkd.service/ J+ m) ~& n+ A& [" o' z
-
) K! N) z, O2 I: E J( V - : c8 e, k( ~2 ^( ?( B
; f7 R8 W$ ]7 l8 P& y& @9 v% }- info:
. |- r1 d* G& L7 C9 ? R - How to list SSID available
& o$ f' u' n3 I7 F1 G5 x3 v1 c - ifconfig wlan0 up* O8 A' @- j' r3 f
- iw dev wlan0 scan | grep SSID
' b R5 D1 Y, H7 G5 G( _7 ?* F - or
! g b, B# c- N$ U% _ - iwlist wlan0 scanning | grep ESSID+ z {: ?8 d6 X6 c) m% G
, _7 P# W3 b# J0 M5 @& H/ y- e.g.- ^, U6 J+ U5 o$ S4 n w
- wpa_passphrase peszazurehear pass.w0rd, >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
复制代码
# n: ^7 o9 ^) o0 L2 T; [. j, F( s6 A7 f1 F
————————————————- l1 C! [. f) c ~' b x6 A
版权声明:zhoujiazhao) h4 {! H9 C. P5 Q
* ]6 H# D9 E) S( @
|
ifconfig wlan0 up% p, Z* D6 I6 ?& s& E, O
//关闭wifi
ifconfig wlan0 down+ _# I2 ?9 o" W" V
//搜索可以连接的wifi
iw dev wlan0 scan |grep SSID
# V0 E/ l, K, I# i2 [3 t
//wpa_passphrase 设置 wifi 名字和密码
wpa_passphrase name passward>> /etc/wpa_supplicant.conf& k4 J) w4 m4 K2 v% b' {
; r* f4 i% u& ?: j
//初始化 wpa_supplicant
wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant.conf( H3 D4 P+ t; F9 w
7 H2 h- U$ R& e' I
//连接wifi% }' n+ T; R, f6 x. T3 c
iw wlan0 link/ X- g, M4 ~% N, G
//获取 WiFi IP 地址
udhcpc -i wlan0
//wifi连接后ping外网测试
ping -I wlan0 www.baidu.com, k* S4 h9 p& d0 g
设置开机自启动WiFi, d2 I5 n4 g- i. I$ ?5 t
systemctl enable wpa_supplicant@wlan0.service
2 _/ B# I8 i( M0 N0 D0 W+ P# J
将 wpa_supplicant.conf 改成 wpa_supplicant-wlan0.conf 并拷贝到新建的目录下
/etc/wpa_supplican
) q4 v2 R; E' y' Z6 a B7 n
去除开机自启动连接WiFi& F3 v3 }! |) z7 |9 L
rm -rf /etc/systemd/system/multi-user.target.wants/wpa_supplicant@wlan0.service- W$ M" `6 l. i& y- _2 R
& e5 o, e$ v( I: } m
8 \' E8 u" R4 m2 u' y
这里也有官方的配置教程
https://wiki.stmicroelectronics.cn/stm32mpu/wiki/How_to_setup_a_WLAN_connection