diff --git a/services/wifi_standard/wifi_framework/wifi_manage/BUILD.gn b/services/wifi_standard/wifi_framework/wifi_manage/BUILD.gn index cdf0f18c66aef863d1f25a334631fd976be48fe7..5783000122dc50e17f423eaaae039f38404b2d8c 100755 --- a/services/wifi_standard/wifi_framework/wifi_manage/BUILD.gn +++ b/services/wifi_standard/wifi_framework/wifi_manage/BUILD.gn @@ -65,6 +65,10 @@ config("wifi_manager_service_config") { if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } + + if (product_name == "rk3568") { + defines = [ "PRODUCT_RK" ] + } } ohos_source_set("wifi_scan_service_impl") { diff --git a/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/BUILD.gn b/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/BUILD.gn old mode 100644 new mode 100755 index 1f316fac2b6ba9d20a3db83436de0d62a01465d5..e38538f3a254383d19e594c3b534e166296fd29f --- a/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/BUILD.gn +++ b/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/BUILD.gn @@ -94,6 +94,9 @@ ohos_shared_library("wifi_p2p_service") { ] defines = [ "AP_NOT_DIRECT_USE_DHCP" ] + if (product_name == "rk3568") { + defines += [ "PRODUCT_RK" ] + } external_deps = [ "hiviewdfx_hilog_native:libhilog" ] diff --git a/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/p2p_define.h b/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/p2p_define.h index e56b8a70dd3d84607daed6eb991c41ab9e45b380..52116c7647f40f3c61303d9642ad65d12c9d0fa7 100644 --- a/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/p2p_define.h +++ b/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/p2p_define.h @@ -22,7 +22,11 @@ namespace OHOS { namespace Wifi { +#ifdef PRODUCT_RK +const std::string P2P_INTERFACE("wlan0"); +#else const std::string P2P_INTERFACE("p2p0"); +#endif /* The timeout interval of enable p2p */ constexpr long ENABLE_P2P_TIMED_OUT__INTERVAL = 5000; /* The time of clears service requests processed in records. */ @@ -152,4 +156,4 @@ using HandlerMethod = void(P2P_STATE_MACHINE_CMD, int, int, const std::any &); } // namespace Wifi } // namespace OHOS -#endif \ No newline at end of file +#endif diff --git a/services/wifi_standard/wifi_hal/BUILD.gn b/services/wifi_standard/wifi_hal/BUILD.gn index 9e78ec5e3524488f15d905f9472c6d2e7f7b04e8..1785fc4d8a3a65f88e578402d7fc7cb579089832 100755 --- a/services/wifi_standard/wifi_hal/BUILD.gn +++ b/services/wifi_standard/wifi_hal/BUILD.gn @@ -66,8 +66,10 @@ ohos_executable("wifi_hal_service") { ] cflags_cc = [ "-fno-rtti" ] - defines = [] + if (product_name == "rk3568") { + defines += [ "PRODUCT_RK" ] + } part_name = "wifi_standard" subsystem_name = "communication" diff --git a/services/wifi_standard/wifi_hal/wifi_hal_module/wpa_supplicant_hal/wpa_p2p_hal/wifi_p2p_hal.c b/services/wifi_standard/wifi_hal/wifi_hal_module/wpa_supplicant_hal/wpa_p2p_hal/wifi_p2p_hal.c index 730ba4d64d1328a08003b91be4036425801d6105..4caec3fe68c6fbde782c85c5d70dc3de7f64da3d 100644 --- a/services/wifi_standard/wifi_hal/wifi_hal_module/wpa_supplicant_hal/wpa_p2p_hal/wifi_p2p_hal.c +++ b/services/wifi_standard/wifi_hal/wifi_hal_module/wpa_supplicant_hal/wpa_p2p_hal/wifi_p2p_hal.c @@ -1305,7 +1305,11 @@ WifiWpaP2pInterface *GetWifiWapP2pInterface() LOGE("alloc memory for p2p interface failed!"); return NULL; } +#ifdef PRODUCT_RK + StrSafeCopy(g_wpaP2pInterface->ifName, sizeof(g_wpaP2pInterface->ifName), "wlan0"); +#else StrSafeCopy(g_wpaP2pInterface->ifName, sizeof(g_wpaP2pInterface->ifName), "p2p0"); +#endif InitGlobalWpaP2pFunc(); return g_wpaP2pInterface; } diff --git a/services/wifi_standard/wifi_hal/wifi_hal_p2p_interface.c b/services/wifi_standard/wifi_hal/wifi_hal_p2p_interface.c index 8c4d08bf0266a1de8994b06fafe82349254e4dcb..88cf63a2db74ddb29fd9995493f2ae4a7783ba36 100644 --- a/services/wifi_standard/wifi_hal/wifi_hal_p2p_interface.c +++ b/services/wifi_standard/wifi_hal/wifi_hal_p2p_interface.c @@ -97,7 +97,11 @@ static WifiErrorNo StopP2pWpaAndWpaHal(void) } WifiWpaInterface *pWpaInterface = GetWifiWapGlobalInterface(); if (pWpaInterface != NULL) { +#ifdef PRODUCT_RK + pWpaInterface->wpaCliRemoveIface(pWpaInterface, "p2p-wlan0-0"); +#else pWpaInterface->wpaCliRemoveIface(pWpaInterface, "p2p0"); +#endif } if (P2pStopSupplicant() != WIFI_HAL_SUCCESS) { LOGE("p2p_wpa_supplicant stop failed!"); @@ -120,7 +124,11 @@ static WifiErrorNo AddP2pIface(void) return WIFI_HAL_FAILED; } AddInterfaceArgv argv; +#ifdef PRODUCT_RK + if (strcpy_s(argv.name, sizeof(argv.name), "wlan0") != EOK || +#else if (strcpy_s(argv.name, sizeof(argv.name), "p2p0") != EOK || +#endif strcpy_s(argv.confName, sizeof(argv.confName), "/data/misc/wifi/wpa_supplicant/p2p_supplicant.conf") != EOK) { return WIFI_HAL_FAILED; } @@ -1028,4 +1036,4 @@ WifiErrorNo P2pHid2dConnect(Hid2dConnectInfo *info) return ConvertP2pErrCode(ret); } return WIFI_HAL_SUCCESS; -} \ No newline at end of file +}