diff --git a/src/netmgr_service.c b/src/netmgr_service.c index d4f651f3d0d120f6f9acdf390635915dec27ba5e..29e87d4df9279c4ac3c7561baf63eec57cdbd28d 100644 --- a/src/netmgr_service.c +++ b/src/netmgr_service.c @@ -243,6 +243,16 @@ int netmgr_get_ifconfig(netmgr_hdl_t hdl, netmgr_ifconfig_info_t* info) void netmgr_set_auto_reconnect(netmgr_hdl_t hdl, bool enable) { + if(get_hdl_type(hdl) == NETMGR_TYPE_UNKNOWN) + { + hdl = netmgr_get_dev(DEV_WIFI_NAME); + if(hdl == -1) + { + printf("get dev %s handler failed!\n\r", DEV_WIFI_NAME); + return; + } + } + if(get_hdl_type(hdl) == NETMGR_TYPE_WIFI) { netmgr_wifi_auto_reconnect(enable); } diff --git a/src/netmgr_wifi.c b/src/netmgr_wifi.c index a047bc082da645107de8b8444d9ad18d36291166..d9b6c9308b8a70aec027c245aa7130497aafa530 100644 --- a/src/netmgr_wifi.c +++ b/src/netmgr_wifi.c @@ -605,7 +605,7 @@ static void reconnect_task_handle(void* arg) memset(¶ms, 0, sizeof(params)); NETMGR_WIFI_LOGI("%s:%d\n", __func__, __LINE__); //netmgr_stat_chg_event(m, NOTIFY_CONN_RECONNECT, NULL); - if(0 != netmgr_wifi_connect(0, ¶ms)) { + if(0 != netmgr_wifi_connect(conn->hdl, ¶ms)) { if(ioctl(conn->hdl, WIFI_DEV_CMD_CANCEL_CONNECT, NULL) != 0) { NETMGR_WIFI_LOGE("WIFI_DEV_CMD_CANCEL_CONNECT failed\n"); }