Skip to content
Snippets Groups Projects
Commit 77fa5ede authored by rswindell's avatar rswindell
Browse files

Log errors with comGetModemStatus.

parent 408d2c7d
No related branches found
No related tags found
No related merge requests found
......@@ -675,7 +675,8 @@ BOOL modem_command(COM_HANDLE com_handle, const char* cmd)
char resp[128];
if(!modem_send(com_handle, cmd)) {
lprintf(LOG_ERR,"ERROR %u sending modem command", COM_ERROR_VALUE);
lprintf(LOG_ERR,"ERROR %u sending modem command (%s)"
,COM_ERROR_VALUE, cmd);
return FALSE;
}
......@@ -742,6 +743,7 @@ BOOL wait_for_call(COM_HANDLE com_handle)
char* p;
BOOL result=TRUE;
DWORD events=0;
int mdm_status;
ZERO_VAR(cid_name);
ZERO_VAR(cid_number);
......@@ -806,7 +808,10 @@ BOOL wait_for_call(COM_HANDLE com_handle)
}
continue; /* don't check DCD until we've received all the modem msgs */
}
if(comGetModemStatus(com_handle)&COM_DCD)
if((mdm_status=comGetModemStatus(com_handle)) == COM_ERROR)
lprintf(LOG_ERR,"Error %u getting modem status (line %u)"
,COM_ERROR_VALUE, __LINE__);
else if(mdm_status&COM_DCD)
break;
}
......@@ -1179,6 +1184,7 @@ BOOL handle_call(void)
int result;
int rd;
int wr;
int mdm_status;
fd_set socket_set;
struct timeval tv = {0, 0};
......@@ -1199,9 +1205,16 @@ BOOL handle_call(void)
while(!terminated) {
if(!dcd_ignore && (comGetModemStatus(com_handle)&COM_DCD) == 0) {
lprintf(LOG_WARNING,"Loss of Carrier Detect (DCD) detected");
break;
if(!dcd_ignore) {
if((mdm_status = comGetModemStatus(com_handle)) == COM_ERROR) {
lprintf(LOG_ERR,"Error %u getting modem status (line %u)"
,COM_ERROR_VALUE, __LINE__);
break;
}
if((mdm_status&COM_DCD) == 0) {
lprintf(LOG_WARNING,"Loss of Carrier Detect (DCD) detected");
break;
}
}
#if 0
if(comReadByte(com_handle, &ch)) {
......@@ -1256,10 +1269,16 @@ BOOL handle_call(void)
/****************************************************************************/
BOOL hangup_call(COM_HANDLE com_handle)
{
time_t start;
time_t start;
int attempt;
int mdm_status;
if((comGetModemStatus(com_handle)&COM_DCD)==0) /* DCD already low */
if((mdm_status=comGetModemStatus(com_handle)) == COM_ERROR) {
lprintf(LOG_ERR,"Error %u getting modem status (line %u)"
,COM_ERROR_VALUE, __LINE__);
return TRUE;
}
if((mdm_status&COM_DCD)==0) /* DCD already low */
return TRUE;
lprintf(LOG_DEBUG,"Waiting for transmit buffer to empty");
......@@ -1270,10 +1289,15 @@ BOOL hangup_call(COM_HANDLE com_handle)
lprintf(LOG_ERR,"ERROR %u lowering DTR", COM_ERROR);
continue;
}
lprintf(LOG_INFO,"Waiting for loss of Carrier Detect (DCD)");
lprintf(LOG_DEBUG,"Waiting for loss of Carrier Detect (DCD)");
start=time(NULL);
while(time(NULL)-start <= dcd_timeout) {
if((comGetModemStatus(com_handle)&COM_DCD)==0)
if((mdm_status=comGetModemStatus(com_handle)) == COM_ERROR) {
lprintf(LOG_ERR,"Error %u getting modem status (line %u)"
,COM_ERROR_VALUE, __LINE__);
return TRUE;
}
if((mdm_status&COM_DCD)==0)
return TRUE;
SLEEP(1000);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment