|
@@ -181,7 +181,7 @@ typedef struct {
|
|
|
typedef struct {
|
|
typedef struct {
|
|
|
int fd;
|
|
int fd;
|
|
|
CellInfo_t *pcell;
|
|
CellInfo_t *pcell;
|
|
|
- lock_t lck;
|
|
|
|
|
|
|
+ //lock_t lck;
|
|
|
char prod_id[32];
|
|
char prod_id[32];
|
|
|
|
|
|
|
|
int stat;
|
|
int stat;
|
|
@@ -477,7 +477,7 @@ static void reset_var( cell_handle_t *h)
|
|
|
h->all.stat.utctime = 0;
|
|
h->all.stat.utctime = 0;
|
|
|
h->all.stat.linked = 0;
|
|
h->all.stat.linked = 0;
|
|
|
sprintf(h->all.stat.ipv4, "-");
|
|
sprintf(h->all.stat.ipv4, "-");
|
|
|
- sprintf(h->all.stat.ipv4, "-");
|
|
|
|
|
|
|
+ sprintf(h->all.stat.ipv6, "-");
|
|
|
|
|
|
|
|
sprintf(h->all.info.apn, "-");
|
|
sprintf(h->all.info.apn, "-");
|
|
|
sprintf(h->all.info.cnum, "-");
|
|
sprintf(h->all.info.cnum, "-");
|
|
@@ -1579,6 +1579,8 @@ static void* cellular_thread(void *arg)
|
|
|
UpdateCellularManager(&h->all);
|
|
UpdateCellularManager(&h->all);
|
|
|
sleep(1);
|
|
sleep(1);
|
|
|
}
|
|
}
|
|
|
|
|
+ reset_var(h);
|
|
|
|
|
+ UpdateCellularManager(&h->all);
|
|
|
cell_deinit(h);
|
|
cell_deinit(h);
|
|
|
port_deinit(h);
|
|
port_deinit(h);
|
|
|
|
|
|
|
@@ -1601,20 +1603,21 @@ int cellular_init(void)
|
|
|
int r;
|
|
int r;
|
|
|
cell_handle_t *h=&ceHandle;
|
|
cell_handle_t *h=&ceHandle;
|
|
|
|
|
|
|
|
- if (__globalDeviceManage._globalDevInfo.cell.Cellular_enable)
|
|
|
|
|
|
|
+ if (__globalDeviceManage._globalDevInfo.cell.Cellular_enable && __globalDeviceManage._globalDevInfo.cell.mode && !thread_is_running(THREAD_ID_CELLULAR))
|
|
|
{
|
|
{
|
|
|
memset(h, 0, sizeof(cell_handle_t));
|
|
memset(h, 0, sizeof(cell_handle_t));
|
|
|
|
|
|
|
|
h->dm = &__globalDeviceManage;
|
|
h->dm = &__globalDeviceManage;
|
|
|
h->pcell = &h->dm->_globalDevInfo.cell;
|
|
h->pcell = &h->dm->_globalDevInfo.cell;
|
|
|
strcpy( h->prod_id,h->dm->_globalDevInfo.product.number);
|
|
strcpy( h->prod_id,h->dm->_globalDevInfo.product.number);
|
|
|
- h->lck = lock_d_init();
|
|
|
|
|
|
|
+ // h->lck = lock_d_init();
|
|
|
nic_set(NIC_USB, 1);
|
|
nic_set(NIC_USB, 1);
|
|
|
|
|
|
|
|
dev_SMS_get(h->dm->db, h->pcell);
|
|
dev_SMS_get(h->dm->db, h->pcell);
|
|
|
|
|
|
|
|
thread_start(THREAD_ID_CELLULAR, cellular_thread, h);
|
|
thread_start(THREAD_ID_CELLULAR, cellular_thread, h);
|
|
|
}
|
|
}
|
|
|
|
|
+ else return -1;
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
@@ -1623,10 +1626,10 @@ int cellular_deinit(void)
|
|
|
{
|
|
{
|
|
|
cell_handle_t *h=&ceHandle;
|
|
cell_handle_t *h=&ceHandle;
|
|
|
|
|
|
|
|
- if (__globalDeviceManage._globalDevInfo.cell.Cellular_enable)
|
|
|
|
|
|
|
+ if (__globalDeviceManage._globalDevInfo.cell.Cellular_enable && !__globalDeviceManage._globalDevInfo.cell.mode)
|
|
|
{
|
|
{
|
|
|
- lock_d_deinit(h->lck);
|
|
|
|
|
thread_stop(THREAD_ID_CELLULAR);
|
|
thread_stop(THREAD_ID_CELLULAR);
|
|
|
|
|
+ nic_set(NIC_USB, 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|