From 036cc6105794e076b4f7f9c0341f80cbf6a18e8c Mon Sep 17 00:00:00 2001 From: Jiung Date: Wed, 22 Nov 2017 17:51:03 +0900 Subject: [PATCH] Use p2p interface name from configuration file Change-Id: I3b611f46621eb3c2a6df7b76a9bc61cabf612f37 Signed-off-by: Yu jiung --- packaging/wifi-direct-manager.spec | 2 +- .../wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packaging/wifi-direct-manager.spec b/packaging/wifi-direct-manager.spec index 63fc052..3d3e357 100644 --- a/packaging/wifi-direct-manager.spec +++ b/packaging/wifi-direct-manager.spec @@ -6,7 +6,7 @@ Name: wifi-direct-manager Summary: Wi-Fi Direct manger -Version: 1.2.254 +Version: 1.2.255 Release: 1 Group: Network & Connectivity/Wireless License: Apache-2.0 diff --git a/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c b/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c index dff4228..446a1e4 100644 --- a/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c +++ b/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c @@ -66,10 +66,7 @@ #define NETCONFIG_DBUS_REPLY_TIMEOUT (10 * 1000) #define CONF_FILE_PATH tzplatform_mkpath(TZ_SYS_ETC, "wpa_supplicant/wpa_supplicant.conf") - -#ifndef DEFAULT_MAC_FILE_PATH -#define DEFAULT_MAC_FILE_PATH "/sys/class/net/p2p0/address" -#endif +#define MAX_FILE_PATH_LEN 256 static wfd_oem_ops_s supplicant_ops = { .configure = ws_configure, @@ -580,13 +577,16 @@ static int _ws_get_local_dev_mac(unsigned char *dev_mac) { __WDP_LOG_FUNC_ENTER__; FILE *fd = NULL; - const char *file_path = DEFAULT_MAC_FILE_PATH; + char file_path[MAX_FILE_PATH_LEN] = {0, }; char local_mac[OEM_MACSTR_LEN] = {0, }; char *ptr = NULL; int res = 0; char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, }; errno = 0; + g_snprintf(file_path, sizeof(file_path), + "/sys/class/net/%s/address", config->p2p_ifname); + fd = fopen(file_path, "r"); if (!fd) { strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); -- 2.7.4