Home | History | Annotate | Download | only in conn_init
      1 /*
      2  * Copyright 2012 The Android Open Source 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 #include <stdio.h>
     17 #include <string.h>
     18 #include <unistd.h>
     19 
     20 extern int wfc_util_qcom_check_config(unsigned char *nv_mac_addr);
     21 extern void wfc_util_atoh(char *pAsciiString, int szAsciiString, unsigned char *pHexaBuff, int szHexaBuff);
     22 
     23 static int wifi_check_qcom_cfg_files()
     24 {
     25     char macAddress[13];
     26     char hex[7];
     27     memset(macAddress, 0, 13);
     28     memset(hex, 0, 7);
     29 
     30     // Read MAC String
     31     FILE *fp = NULL;
     32     int n = 0;
     33     fp = fopen("/persist/wifi/.macaddr", "r");
     34     if ( fp == NULL )
     35     {
     36         wfc_util_qcom_check_config((unsigned char *)macAddress);
     37         return 0;
     38     }
     39     else
     40     {
     41         n = fread(macAddress, 12, 1, fp);
     42         fclose(fp);
     43 
     44         // Write MAC String
     45         wfc_util_atoh( macAddress, 12, (unsigned char *)hex, 6);
     46         wfc_util_qcom_check_config((unsigned char *)hex);
     47     }
     48     return 1;
     49 }
     50 
     51 int main(void)
     52 {
     53     wifi_check_qcom_cfg_files();
     54 
     55     return 0;
     56 }
     57