Firefly开源社区

标题: 通过wpa_cli命令连接不上wifi [打印本页]

作者: 午夏时分    时间: 2023-3-7 11:03
标题: 通过wpa_cli命令连接不上wifi
本帖最后由 午夏时分 于 2023-3-7 11:15 编辑

无法通过wpa_cli命令连接上WiFi,看Log上好像连了一次又断开了。之后再输入wpa_cli -i wlan0 enable_network 0没反应了。我也测试过其他几家主控平台的,好像都无法连接。所以想问下这个是android有什么机制吗?
tchip_askquestions

wpa_cli.zip

580 Bytes, 下载次数: 2, 下载积分: 灯泡 -1 , 经验 -1


作者: 午夏时分    时间: 2023-3-7 11:10

作者: 午夏时分    时间: 2023-3-7 11:18
疑问2:我试了一种方式,开启飞行模式之后,手动把驱动和wlan0重新起来,然后再启动wpa_supplicant服务。发现这种情况下是可以通过wpc_cli来连接wifi的,请问下为什么正常工作模式不能通过wpa_cli来连接,必须要飞行模式再去连接呢?
作者: zhangzhenzhao    时间: 2023-3-7 11:23
午夏时分 发表于 2023-3-7 11:10

可以复现情况的时候抓log看看,内核和上层都抓~
作者: 午夏时分    时间: 2023-3-7 11:42
zhangzhenzhao 发表于 2023-3-7 11:23
可以复现情况的时候抓log看看,内核和上层都抓~

:/ # dmesg -C
:/ #
:/ #
:/ # logcat -c
:/ #
:/ #
:/ #
:/ #
:/ #
:/ #
:/ # logcat |grep wpa&
[1] 1428 1429
:/ #
:/ #
:/ #
:/ # wpa_cli
wpa_cli v2.8-devel-10
Copyright (c) 2004-2019, Jouni Malinen <j@w1.fi> and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.


Using interface 'wlan0'

Interactive mode

>
>
> add_net
0
>
>
>
> set_network 0 ssid  "Xiaomi_68A5"
OK
>
>
> set_network 0 key_mgmt WPA-PSK
OK
>
>
>
> set_network 0 psk  "12345678"
OK
>
>
> enable_network 0
OK
<3>CTRL-EVENT-STATE-CHANGE id=-1 state=3 BSSID=00:00:00:00:00:00 SSID=
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-RESULTS
<3>WPS-AP-AVAILABLE
<3>Trying to associate with ec:41:18:e7:68:a6 (SSID='Xiaomi_68A5' freq=2417 MHz)
> 12-28 10:19:51.621   751   751 I wpa_supplicant: wlan0: Trying to associate with ec:41:18:e7:68:a6 (SSID='Xiaomi_68A5' freq=2417 MHz)
<3>CTRL-EVENT-STATE-CHANGE id=-1 state=5 BSSID=00:00:00:00:00:00 SSID=
<3>CTRL-EVENT-STATE-CHANGE id=0 state=6 BSSID=00:00:00:00:00:00 SSID=Xiaomi_68A5
<3>Associated with ec:41:18:e7:68:a6
> 12-28 10:19:51.705   751   751 I wpa_supplicant: wlan0: Associated with ec:41:18:e7:68:a6
<3>CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
> 12-28 10:19:51.706   751   751 I wpa_supplicant: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
<3>CTRL-EVENT-STATE-CHANGE id=0 state=7 BSSID=ec:41:18:e7:68:a6 SSID=Xiaomi_68A5
<3>WPA: RX message 1 of 4-Way Handshake from ec:41:18:e7:68:a6 (ver=2)
<3>WPA: Sending EAPOL-Key 2/4
12-28 10:19:51.808   751   751 I wpa_supplicant: wlan0: WPA: RX message 1 of 4-Way Handshake from ec:41:18:e7:68:a6 (ver=2)
> 12-28 10:19:51.808   751   751 I wpa_supplicant: wlan0: WPA: Sending EAPOL-Key 2/4
<3>WPA: RX message 3 of 4-Way Handshake from ec:41:18:e7:68:a6 (ver=2)
<3>WPA: Sending EAPOL-Key 4/4
> 12-28 10:19:51.834   751   751 I wpa_supplicant: wlan0: WPA: RX message 3 of 4-Way Handshake from ec:41:18:e7:68:a6 (ver=2)
12-28 10:19:51.834   751   751 I wpa_supplicant: wlan0: WPA: Sending EAPOL-Key 4/4
<3>CTRL-EVENT-STATE-CHANGE id=0 state=8 BSSID=ec:41:18:e7:68:a6 SSID=Xiaomi_68A5
<3>WPA: Key negotiation completed with ec:41:18:e7:68:a6 [PTK=CCMP GTK=TKIP]
<3>CTRL-EVENT-CONNECTED - Connection to ec:41:18:e7:68:a6 completed [id=0 id_str=]
12-28 10:19:51.838   751   751 I wpa_supplicant: wlan0: WPA: Key negotiation completed with ec:41:18:e7:68:a6 [PTK=CCMP GTK=TKIP]
<3>setprop vendor.wifi.state connected
<3>CTRL-EVENT-STATE-CHANGE id=0 state=9 BSSID=ec:41:18:e7:68:a6 SSID=Xiaomi_68A5
> 12-28 10:19:51.839   751   751 I wpa_supplicant: wlan0: CTRL-EVENT-CONNECTED - Connection to ec:41:18:e7:68:a6 completed [id=0 id_str=]
12-28 10:19:51.840   751   751 I wpa_supplicant: wlan0: setprop vendor.wifi.state connected
<3>CTRL-EVENT-DISCONNECTED bssid=ec:41:18:e7:68:a6 reason=3 locally_generated=1
<3>setprop vendor.wifi.state disconnected
> 12-28 10:19:51.856   751   751 I wpa_supplicant: wlan0: CTRL-EVENT-DISCONNECTED bssid=ec:41:18:e7:68:a6 reason=3 locally_generated=1
12-28 10:19:51.856   751   751 I wpa_supplicant: wlan0: setprop vendor.wifi.state disconnected
<3>CTRL-EVENT-STATE-CHANGE id=0 state=0 BSSID=ec:41:18:e7:68:a6 SSID=Xiaomi_68A5
>
>
>
>
>
>
>
>
>
>
>
> status
wpa_state=DISCONNECTED
p2p_device_address=24:b7:2a:df:3c:0f
address=24:b7:2a:df:3c:0e
uuid=2e365ec6-567b-5baa-9410-92697f52f34a
<3>CTRL-EVENT-STATE-CHANGE id=-1 state=0 BSSID=00:00:00:00:00:00 SSID=
>
>
>
>
> status
wpa_state=DISCONNECTED
p2p_device_address=24:b7:2a:df:3c:0f
address=24:b7:2a:df:3c:0e
uuid=2e365ec6-567b-5baa-9410-92697f52f34a
<3>CTRL-EVENT-STATE-CHANGE id=-1 state=0 BSSID=00:00:00:00:00:00 SSID=
>
>
>
>
>
> q
:/ #
:/ #
:/ #
:/ #
:/ #
:/ #
:/ #
:/ #
:/ #
:/ # dmesg
[  172.228997] logd: logdr: UID=0 GID=0 PID=1428 b tail=0 logMask=19 pid=0 start=0ns timeout=0ns
[  185.898589] healthd: battery none chg=a
[  217.824427] >>> rwnx_cfg80211_scan()
[  217.824462] >>> rwnx_send_scanu_req()
[  217.824488] rwnx_send_msg (4104)SCANU_VENDOR_IE_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
[  217.825245] rwnx_send_msg (4105)SCANU_START_CFM_ADDTIONAL reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
[  219.108919] >>> rwnx_rx_scanu_start_cfm()
[  219.124450] >>> rwnx_cfg80211_connect()
[  219.124485] >>> rwnx_send_sm_connect_req()
[  219.124511] rwnx_send_msg (6145)SM_CONNECT_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
[  219.199195] >>> rwnx_rx_sm_connect_ind()
[  219.305845] need cfm ethertype:    8e88,user_idx=1, skb=00000000738b0c47
[  219.308595] sdio_host_tx_cfm_handler:used_idx=0, 0x00000000b2223747, status=9\x0d
[  219.331095] need cfm ethertype:    8e88,user_idx=2, skb=00000000b5281073
[  219.331808] >>> rwnx_cfg80211_add_key()
[  219.331843] >>> rwnx_send_key_add()
[  219.331865] rwnx_send_key_add: sta_idx:0 key_idx:0 inst_nbr:0 cipher:2 key_len:16
[  219.331889] key: 00000000: 82 a3 d9 cb 1c 0f 53 26 03 07 6b d3 cb c1 f7 58  ......S&..k....X
[  219.331901] rwnx_send_msg (37)MM_KEY_ADD_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
[  219.332803] >>> rwnx_cfg80211_set_default_key()
[  219.334242] >>> rwnx_cfg80211_add_key()
[  219.334276] >>> rwnx_send_key_add()
[  219.334298] rwnx_send_key_add: sta_idx:255 key_idx:1 inst_nbr:0 cipher:1 key_len:32
[  219.334321] key: 00000000: b8 11 89 ee 88 be 7a a5 83 f2 90 99 48 f2 13 79  ......z.....H..y
[  219.334331] key: 00000010: 57 c4 bb 9d 0f 21 f2 c9 8b 3c 55 3b a7 e8 22 5d  W....!...<U;.."]
[  219.334343] rwnx_send_msg (37)MM_KEY_ADD_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
[  219.335406] sdio_host_tx_cfm_handler:used_idx=1, 0x00000000b2223747, status=9\x0d
[  219.338728] selinux: avc:  denied  { set } for property=vendor.wifi.state pid=751 uid=1010 gid=1010 scontext=u:r:hal_wifi_supplicant_default:s0 tcontext=u:object_r:vendor_hal_wifi_prop:s0 tclass=property_service permissive=1\x0a
[  219.340458] >>> rwnx_send_me_set_control_port_req()
[  219.340498] rwnx_send_msg (5125)ME_SET_CONTROL_PORT_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
[  219.347272] >>> rwnx_cfg80211_disconnect()
[  219.347306] >>> rwnx_send_sm_disconnect_req()
[  219.347330] rwnx_send_msg (6148)SM_DISCONNECT_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
[  219.352479] >>> rwnx_rx_sm_disconnect_ind()
[  219.352590] deinit:macaddr:24,b7,2a,df,3c,e\x0d
[  219.352656] >>> rwnx_cfg80211_del_key()
[  219.352680] >>> rwnx_send_key_del()
[  219.352704] rwnx_send_msg (39)MM_KEY_DEL_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
[  219.355242] >>> rwnx_cfg80211_del_key()
[  219.355273] >>> rwnx_send_key_del()
[  219.355296] rwnx_send_msg (39)MM_KEY_DEL_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
[  219.356421] >>> rwnx_cfg80211_del_key()
[  219.356453] >>> rwnx_send_key_del()
[  219.356477] rwnx_send_msg (39)MM_KEY_DEL_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
[  219.357048] >>> rwnx_cfg80211_del_key()
[  219.357073] >>> rwnx_send_key_del()
[  219.357170] rwnx_send_msg (39)MM_KEY_DEL_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
[  219.357568] >>> rwnx_cfg80211_del_key()
[  219.357585] >>> rwnx_send_key_del()
[  219.357605] rwnx_send_msg (39)MM_KEY_DEL_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
[  219.357935] >>> rwnx_cfg80211_del_key()
[  219.357951] >>> rwnx_send_key_del()
[  219.357971] rwnx_send_msg (39)MM_KEY_DEL_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0\x0d
:/ #
:/ #
:/ #
:/ #
:/ #
:/ #
:/ #
:/ #
:/ #
:/ # logcat
--------- beginning of system
12-28 10:19:00.001   393   474 V AlarmManager: setImplLocked type=3   ,when=227494
--------- beginning of main
12-28 10:19:00.006   542   542 D KeyguardClockSwitch: Updating clock: 10:19 AM
12-28 10:19:51.612   307   307 I wificond: Received external scan result notification from kernel.
12-28 10:19:51.613   393   667 D WificondControl: Scan result ready event
12-28 10:19:51.621   751   751 I wpa_supplicant: wlan0: Trying to associate with ec:41:18:e7:68:a6 (SSID='Xiaomi_68A5' freq=2417 MHz)
12-28 10:19:51.705   751   751 I wpa_supplicant: wlan0: Associated with ec:41:18:e7:68:a6
12-28 10:19:51.706   751   751 I wpa_supplicant: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
12-28 10:19:51.808   751   751 I wpa_supplicant: wlan0: WPA: RX message 1 of 4-Way Handshake from ec:41:18:e7:68:a6 (ver=2)
12-28 10:19:51.808   751   751 I wpa_supplicant: wlan0: WPA: Sending EAPOL-Key 2/4
12-28 10:19:51.834   751   751 I wpa_supplicant: wlan0: WPA: RX message 3 of 4-Way Handshake from ec:41:18:e7:68:a6 (ver=2)
12-28 10:19:51.834   751   751 I wpa_supplicant: wlan0: WPA: Sending EAPOL-Key 4/4
12-28 10:19:51.838   751   751 I wpa_supplicant: wlan0: WPA: Key negotiation completed with ec:41:18:e7:68:a6 [PTK=CCMP GTK=TKIP]
12-28 10:19:51.839   751   751 I wpa_supplicant: wlan0: CTRL-EVENT-CONNECTED - Connection to ec:41:18:e7:68:a6 completed [id=0 id_str=]
12-28 10:19:51.840   751   751 I wpa_supplicant: wlan0: setprop vendor.wifi.state connected
12-28 10:19:51.846   393   487 W WifiClientModeImpl: Connected to unknown networkId -1, disconnecting...
12-28 10:19:51.851   393   412 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: true
12-28 10:19:51.856   751   751 I wpa_supplicant: wlan0: CTRL-EVENT-DISCONNECTED bssid=ec:41:18:e7:68:a6 reason=3 locally_generated=1
12-28 10:19:51.856   751   751 I wpa_supplicant: wlan0: setprop vendor.wifi.state disconnected
12-28 10:19:51.864   393   412 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
12-28 10:19:51.872   213   575 I netd    : interfaceGetCfg("wlan0") <0.66ms>
12-28 10:19:51.875   213   575 I netd    : interfaceGetCfg("wlan0") <0.60ms>
12-28 10:20:00.001   393   474 V AlarmManager: setImplLocked type=3   ,when=287494
12-28 10:20:00.007   542   542 D KeyguardClockSwitch: Updating clock: 10:20 AM




^C
130|:/ #
130|:/ #
130|:/ #
作者: zhangzhenzhao    时间: 2023-3-7 14:30
1 是否更换了wifi模块?如果没有更换的话用官方固件试下
2 可以代码跟下这里看看

作者: 午夏时分    时间: 2023-3-7 14:36
zhangzhenzhao 发表于 2023-3-7 14:30
1 是否更换了wifi模块?如果没有更换的话用官方固件试下
2 可以代码跟下这里看看

1.更换了WiFi模块的,现在用的是全志的AW869A模块,不过感觉跟更换模块应该没关系,这里应该是android的一种机制之类的。2.我在找这部分的内容看看
作者: 午夏时分    时间: 2023-3-7 14:48
刚才试了下,如果自己到WiFi界面去手动连接上一次,让他记录下这个WiFi,再去操作wpa_cli的话倒是可以成功。




欢迎光临 Firefly开源社区 (https://dev.t-firefly.com/) Powered by Discuz! X3.1