wifi.c中函数分析: ::::int wifi_start_supplicant()

来源:互联网 发布:vmware mac dmg 编辑:程序博客网 时间:2024/06/05 03:34

  根据属性文件查看状态属性:

/* Check whether already running */
    if (property_get(SUPP_PROP_NAME, supp_status, NULL)
            && strcmp(supp_status, "running") == 0) {
        return 0;
    }

判断配置文件是否存在:

/* Before starting the daemon, make sure its config file exists */

    if (ensure_config_file_exists() < 0) {
        LOGE("Wi-Fi will not be enabled");
        return -1;
    }
清除所有先前创建的sockets文件:
    /* Clear out any stale socket files that might be left over. */

    wpa_ctrl_cleanup();

设置属性。调度开启:

    property_set("ctl.start", SUPPLICANT_NAME);
    sched_yield();

查看属性文件,是否开启:

      成功返回0

      失败返回-1

f (property_get(SUPP_PROP_NAME, supp_status, NULL)) {
            if (strcmp(supp_status, "running") == 0)
                return 0;
        }

return -1;



原创粉丝点击