Zvikomborero VIncent Zvikaramba | b2235ef | 2016-08-19 02:08:47 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015, The CyanogenMod Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | //#define LOG_NDEBUG 0 |
| 18 | |
| 19 | #define LOG_TAG "wcnss_qmi" |
| 20 | |
| 21 | #define SUCCESS 0 |
| 22 | #define FAILED -1 |
| 23 | |
| 24 | #define MAC_INFO_FILE "/efs/wifi/.mac.info" |
| 25 | |
| 26 | #include <cutils/log.h> |
| 27 | #include <stdio.h> |
| 28 | |
| 29 | int wcnss_init_qmi(void) |
| 30 | { |
| 31 | /* empty */ |
| 32 | return SUCCESS; |
| 33 | } |
| 34 | |
| 35 | int wcnss_qmi_get_wlan_address(unsigned char *mac) |
| 36 | { |
| 37 | int i; |
| 38 | int tmp[6]; |
| 39 | FILE *f; |
| 40 | |
| 41 | if ((f = fopen(MAC_INFO_FILE, "r")) == NULL) { |
| 42 | ALOGE("%s: failed to open %s", __func__, MAC_INFO_FILE); |
| 43 | return FAILED; |
| 44 | } |
| 45 | |
| 46 | if (fscanf(f, "%02X:%02X:%02X:%02X:%02X:%02X", &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) != 6) { |
| 47 | ALOGE("%s: %s: file contents are not valid", __func__, MAC_INFO_FILE); |
| 48 | fclose(f); |
| 49 | return FAILED; |
| 50 | } else { |
| 51 | for (i = 0; i < 6; i++) mac[i] = tmp[i]; |
| 52 | } |
| 53 | |
| 54 | fclose(f); |
| 55 | return SUCCESS; |
| 56 | } |
| 57 | |
| 58 | void wcnss_qmi_deinit(void) |
| 59 | { |
| 60 | /* empty */ |
| 61 | } |