From c3738b09ef0df8f177c5e0a5e64318fd53293981 Mon Sep 17 00:00:00 2001 From: Kalle Lampila Date: Mon, 18 Mar 2013 16:48:30 +0200 Subject: [PATCH] use wifi_get_mac_address-function to get MAC address fixing TDIS-4799 Use wifi_get_mac_address function to get MAC address istead read it from file. Only some of kernel drivers writes MAC to file so is more generic solution ask it via function. Change-Id: I2694030acf7a12482d3a4d9e99afed607cbc344a Signed-off-by: Kalle Lampila --- setting-about/CMakeLists.txt | 2 +- setting-about/include/setting-about-main.h | 1 - setting-about/src/setting-about-main.c | 21 +++++++-------------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/setting-about/CMakeLists.txt b/setting-about/CMakeLists.txt index 4ea3e20..e8cc88d 100755 --- a/setting-about/CMakeLists.txt +++ b/setting-about/CMakeLists.txt @@ -8,7 +8,7 @@ pkg_check_modules(pkgs_about REQUIRED elementary appcore-common appcore-efl ui-gadget-1 capi-appfw-application capi-appfw-app-manager evas ecore - tapi bluetooth-api json-glib-1.0 capi-system-info capi-system-system-settings capi-network-bluetooth) + tapi bluetooth-api json-glib-1.0 capi-system-info capi-system-system-settings capi-network-bluetooth capi-network-wifi) FOREACH(flag ${pkgs_about_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/setting-about/include/setting-about-main.h b/setting-about/include/setting-about-main.h index becb777..5c15c0d 100755 --- a/setting-about/include/setting-about-main.h +++ b/setting-about/include/setting-about-main.h @@ -21,7 +21,6 @@ // #define SUPPORT_FOTA -#define SETTING_ABOUT_MACINFO_PATH "/opt/etc/.mac.info" #define SETTING_ABOUT_POWER_SUPPLY_PATH "/sys/class/power_supply" #define SETTING_ABOUT_BD_ADDR_PATH "/opt/etc/.bd_addr" #define SETTING_ABOUT_STAT_PATH "/proc/stat" diff --git a/setting-about/src/setting-about-main.c b/setting-about/src/setting-about-main.c index a2e5980..d71f8b0 100755 --- a/setting-about/src/setting-about-main.c +++ b/setting-about/src/setting-about-main.c @@ -23,6 +23,7 @@ //#include #include +#include #include #include @@ -288,25 +289,17 @@ void setting_about_main_get_wifi_mac_address_string(char *str, int size) setting_retm_if(str == NULL, "str parameter is NULL"); setting_retm_if(size < SETTING_ABOUT_WIFI_MAC_STR_LEN+1, "size parameter is wrong"); - FILE *p = fopen(SETTING_ABOUT_MACINFO_PATH, "r"); + char* mac_addr = NULL; + int status = wifi_get_mac_address(&mac_addr); - if (p) { - int size = fread(str, sizeof(char), SETTING_ABOUT_WIFI_MAC_STR_LEN, p); - if (size != SETTING_ABOUT_WIFI_MAC_STR_LEN) { - SETTING_TRACE_ERROR("fail to call fread"); - } - fclose(p); - p = NULL; - } else { - perror("open failed!"); + if (mac_addr) { + safeCopyStr(str, mac_addr, SETTING_ABOUT_WIFI_MAC_STR_LEN); + free(mac_addr); } SETTING_TRACE_DEBUG("get_wifi_mac_address : %s", str); - int wifi_state = VCONFKEY_WIFI_OFF; - vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state); - - if((safeStrLen(str) == 0) || (wifi_state == VCONFKEY_WIFI_OFF)) + if ((status != WIFI_ERROR_NONE) || (safeStrLen(str) == 0)) snprintf(str, size, "%s (%s)", _("IDS_ST_HEADER_UNAVAILABLE"), _(SETTING_ABOUT_NEVER_TURN_WIFI_ON_STR)); } -- 2.7.4