diff options
author | Davide Garberi <dade.garberi@gmail.com> | 2019-03-01 21:37:44 +0100 |
---|---|---|
committer | Davide Garberi <dade.garberi@gmail.com> | 2019-03-02 13:56:05 +0100 |
commit | 56a0d4e8bca5cb53407e9d615ed5566e87f34c2b (patch) | |
tree | dc9cc58239868d0ad076105c719a448611878836 /readmac | |
parent | a1ccdf85388f8d3ab505d6c3761ea424cfb47bc0 (diff) |
msm8996-common: Remove readmac
* We don't need this anymore, no random mac because the real hardware wlan mac works now
Change-Id: I13f85f4eb438b2230408d5bad1c694b2cd39a25b
Diffstat (limited to 'readmac')
-rw-r--r-- | readmac/Android.mk | 12 | ||||
-rw-r--r-- | readmac/zuk_readmac.c | 73 |
2 files changed, 0 insertions, 85 deletions
diff --git a/readmac/Android.mk b/readmac/Android.mk deleted file mode 100644 index 64aee35..0000000 --- a/readmac/Android.mk +++ /dev/null @@ -1,12 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -ifeq ($(strip $(BOARD_HAS_QCOM_WLAN)),true) -include $(CLEAR_VARS) -LOCAL_MODULE := readmac -LOCAL_MODULE_TAGS := optional -LOCAL_PROPRIETARY_MODULE := true -LOCAL_SRC_FILES := zuk_readmac.c -LOCAL_CFLAGS += -Wall -Werror -LOCAL_SHARED_LIBRARIES := libc libcutils libutils liblog -include $(BUILD_EXECUTABLE) -endif diff --git a/readmac/zuk_readmac.c b/readmac/zuk_readmac.c deleted file mode 100644 index a41d6db..0000000 --- a/readmac/zuk_readmac.c +++ /dev/null @@ -1,73 +0,0 @@ -#define LOG_TAG "zuk_readmac" -#define LOG_NDEBUG 0 - -#include <log/log.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/stat.h> -#include <time.h> - -#define MAC_ADDR_SIZE 6 -#define WLAN_MAC_BIN "/persist/wlan_mac.bin" - -static int check_wlan_mac_bin_file() -{ - char content[1024]; - FILE *fp; - - fp = fopen(WLAN_MAC_BIN, "r"); - if (fp != NULL) { - memset(content, 0, sizeof(content)); - fread(content, 1, sizeof(content)-1, fp); - fclose(fp); - - if (strstr(content, "Intf0MacAddress") == NULL) { - ALOGV("%s is missing Intf0MacAddress entry value", WLAN_MAC_BIN); - return 1; - } - - if (strstr(content, "Intf1MacAddress") == NULL) { - ALOGV("%s is missing Intf1MacAddress entry value", WLAN_MAC_BIN); - return 1; - } - - return 0; - } - return 1; -} - -int main() -{ - int i, wlan_addr3, wlan_addr4, wlan_addr5; - - // First 6 hex number are fix - unsigned char wlan_addr[] = { 0xd8, 0x9a, 0x34 }; - - // Last 6 hex number are random - srand(time(NULL) + getpid()); - for (i = 0; i < 3; i++) { - wlan_addr3 = rand() % 256; - wlan_addr4 = rand() % 256; - wlan_addr5 = rand() % 256; - } - - FILE *fp; - - // Store WLAN MAC address in the persist file, if needed - if (check_wlan_mac_bin_file()) { - fp = fopen(WLAN_MAC_BIN, "w"); - fprintf(fp, "Intf0MacAddress=%02X%02X%02X%02X%02X%02X\n", - wlan_addr[0], wlan_addr[1], wlan_addr[2], wlan_addr3, wlan_addr4, wlan_addr5); - fprintf(fp, "Intf1MacAddress=%02X%02X%02X%02X%02X%02X\n", - wlan_addr[0], wlan_addr[1], wlan_addr[2], wlan_addr3, wlan_addr4, (wlan_addr5+1)); - fprintf(fp, "END\n"); - fclose(fp); - ALOGV("%s was successfully generated", WLAN_MAC_BIN); - } else { - ALOGV("%s already exists and is valid", WLAN_MAC_BIN); - } - - return 0; -} |