diff --git a/class/ec20/at_device_ec20.c b/class/ec20/at_device_ec20.c index e566f4e..197c16c 100644 --- a/class/ec20/at_device_ec20.c +++ b/class/ec20/at_device_ec20.c @@ -436,11 +436,14 @@ static int ec20_netdev_check_link_status(struct netdev *netdev) #define EC20_LINK_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX - 2) rt_thread_t tid; + char tname[RT_NAME_MAX] = {0}; RT_ASSERT(netdev); + rt_snprintf(tname, RT_NAME_MAX, "%s", netdev->name); + /* create ec20 link status polling thread */ - tid = rt_thread_create("ec20_link", ec20_check_link_status_entry, (void *)netdev, + tid = rt_thread_create(tname, ec20_check_link_status_entry, (void *)netdev, EC20_LINK_THREAD_STACK_SIZE, EC20_LINK_THREAD_PRIORITY, EC20_LINK_THREAD_TICK); if (tid != RT_NULL) { @@ -886,7 +889,11 @@ static void ec20_init_thread_entry(void *parameter) { /* set network interface device status and address information */ ec20_netdev_set_info(device->netdev); - ec20_netdev_check_link_status(device->netdev); + /* check and create link staus sync thread */ + if (rt_thread_find(device->netdev->name) == RT_NULL) + { + ec20_netdev_check_link_status(device->netdev); + } LOG_I("%s device network initialize success.", device->name); } diff --git a/class/m26/at_device_m26.c b/class/m26/at_device_m26.c index 6a4cf45..fb489cf 100644 --- a/class/m26/at_device_m26.c +++ b/class/m26/at_device_m26.c @@ -294,7 +294,7 @@ static int m26_netdev_check_link_status(struct netdev *netdev) RT_ASSERT(netdev); - rt_snprintf(tname, RT_NAME_MAX, "%s_link", netdev->name); + rt_snprintf(tname, RT_NAME_MAX, "%s", netdev->name); tid = rt_thread_create(tname, check_link_status_entry, (void *)netdev, M26_LINK_THREAD_STACK_SIZE, M26_LINK_THREAD_PRIORITY, M26_LINK_THREAD_TICK); @@ -707,7 +707,11 @@ static void m26_init_thread_entry(void *parameter) if (result == RT_EOK) { m26_netdev_set_info(device->netdev); - m26_netdev_check_link_status(device->netdev); + /* check and create link staus sync thread */ + if (rt_thread_find(device->netdev->name) == RT_NULL) + { + m26_netdev_check_link_status(device->netdev); + } LOG_I("%s device network initialize success.", device->name); } diff --git a/class/sim76xx/at_device_sim76xx.c b/class/sim76xx/at_device_sim76xx.c index 547d1ea..f5fc271 100644 --- a/class/sim76xx/at_device_sim76xx.c +++ b/class/sim76xx/at_device_sim76xx.c @@ -277,7 +277,7 @@ static int sim76xx_netdev_check_link_status(struct netdev *netdev) RT_ASSERT(netdev); - rt_snprintf(tname, RT_NAME_MAX, "%s_link", netdev->name); + rt_snprintf(tname, RT_NAME_MAX, "%s", netdev->name); tid = rt_thread_create(tname, check_link_status_entry, (void *)netdev, SIM76XX_LINK_THREAD_STACK_SIZE, SIM76XX_LINK_THREAD_PRIORITY, SIM76XX_LINK_THREAD_TICK); @@ -704,7 +704,11 @@ static void sim76xx_init_thread_entry(void *parameter) { /* set network interface device status and address information */ sim76xx_netdev_set_info(device->netdev); - sim76xx_netdev_check_link_status(device->netdev); + /* check and create link staus sync thread */ + if (rt_thread_find(device->netdev->name) == RT_NULL) + { + sim76xx_netdev_check_link_status(device->netdev); + } LOG_I("%s device network initialize success!", device->name); } diff --git a/class/sim800c/at_device_sim800c.c b/class/sim800c/at_device_sim800c.c index d03a11f..25d913f 100644 --- a/class/sim800c/at_device_sim800c.c +++ b/class/sim800c/at_device_sim800c.c @@ -298,7 +298,7 @@ static int sim800c_netdev_check_link_status(struct netdev *netdev) RT_ASSERT(netdev); - rt_snprintf(tname, RT_NAME_MAX, "%s_link", netdev->name); + rt_snprintf(tname, RT_NAME_MAX, "%s", netdev->name); tid = rt_thread_create(tname, check_link_status_entry, (void *) netdev, SIM800C_LINK_THREAD_STACK_SIZE, SIM800C_LINK_THREAD_PRIORITY, SIM800C_LINK_THREAD_TICK); @@ -796,7 +796,11 @@ static void sim800c_init_thread_entry(void *parameter) { /* set network interface device status and address information */ sim800c_netdev_set_info(device->netdev); - sim800c_netdev_check_link_status(device->netdev); + /* check and create link staus sync thread */ + if (rt_thread_find(device->netdev->name) == RT_NULL) + { + sim800c_netdev_check_link_status(device->netdev); + } LOG_I("%s device network initialize success!", device->name);