从logcat分析显示“Setup P2P interface”失败:
04-16 19:35:11.431 1481 1481 I wpa_supplicant: Use /vendor/etc/wifi/p2p_supplicant_overlay.conf, read ok.
04-16 19:35:11.432 1481 1481 E wpa_supplicant: Could not read interface p2p0 flags: No such device
04-16 19:35:11.432 1481 1481 I wpa_supplicant: nl80211: Driver does not support authentication/association or connect commands
04-16 19:35:11.432 1481 1481 I wpa_supplicant: nl80211: deinit ifname=p2p0 disabled_11b_rates=0
04-16 19:35:11.432 1481 1481 E wpa_supplicant: Setup P2P interface: No such device
04-16 19:35:11.432 1481 1481 E wpa_supplicant: p2p0: Failed to initialize driver interface
04-16 19:35:11.435 407 499 E SupplicantP2pIfaceHal: Failed to get ISupplicantIface 1
04-16 19:35:11.435 407 499 E SupplicantP2pIfaceHal: initSupplicantP2pIface got null iface
04-16 19:35:11.435 407 499 E WifiP2pNative: Failed to setup P2p iface in supplicant
追踪代码发现SupplicantP2pIface失败,ifconfig -a 检测 p2p0 interface确实没有。
使用CONFIG_USE_P2P0=y打开p2p0接口后wlan0不能使用,厂商对此也没有回复。只能自己默默排查。最终发现HAL使用P2P接口错误。正确修改如下:
--- a/hardware/broadcom/wlan/bcmdhd/wifi_hal/common.h
+++ b/hardware/broadcom/wlan/bcmdhd/wifi_hal/common.h
@@ -242,6 +242,7 @@ enum {
BROADCOM_WIFI,
SSV_WIFI,
RK912_WIFI,
+ AIC_WIFI,
};
wifi_error wifi_register_handler(wifi_handle handle, int cmd, nl_recvmsg_msg_cb_t func, void *arg);
diff --git a/hardware/interfaces/wifi/1.4/default/wifi_chip.cpp b/hardware/interfaces/wifi/1.4/default/wifi_chip.cpp
index 44cc907608..cbbb4254b0 100755
--- a/hardware/interfaces/wifi/1.4/default/wifi_chip.cpp
+++ b/hardware/interfaces/wifi/1.4/default/wifi_chip.cpp
@@ -119,7 +119,7 @@ std::string getP2pIfaceName() {
if (wifi_type[0] == 0) {
check_wifi_chip_type_string(wifi_type);
}
- if (0 == strncmp(wifi_type, "AP", 2)) {
+ if (0 == strncmp(wifi_type, "AP", 2) || 0 == strncmp(wifi_type, "AIC", 3)) {
property_set("vendor.wifi.direct.interface", "p2p-dev-wlan0");
property_get("wifi.direct.interface", buffer.data(), "p2p-dev-wlan0");
} else {