Revision
14952
Author
gmaruzz
Date
2009-09-23 04:58:42 -0500 (Wed, 23 Sep 2009)

Log Message

celliax: when serial port goes away, try not to bomb :)

Modified Paths

Diff

Modified: freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c (14951 => 14952)


--- freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c	2009-09-23 08:34:29 UTC (rev 14951)
+++ freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c	2009-09-23 09:58:42 UTC (rev 14952)
@@ -449,7 +449,7 @@
 }
 int celliax_serial_read_AT(private_t * tech_pvt, int look_for_ack, int timeout_usec, int timeout_sec, const char *expected_string, int expect_crlf)
 {
-	int select_err;
+	int select_err=1;
 	int res;
 	fd_set read_fds;
 	struct timeval timeout;
@@ -475,7 +475,7 @@
 	PUSHA_UNLOCKA(tech_pvt->controldev_lock);
 	LOKKA(tech_pvt->controldev_lock);
 
-	while ((select_err = select(tech_pvt->controldevfd + 1, &read_fds, NULL, NULL, &timeout)) > 0) {
+	while ((!tech_pvt->controldev_dead) && ((select_err = select(tech_pvt->controldevfd + 1, &read_fds, NULL, NULL, &timeout)) > 0) ) {
 		timeout.tv_sec = timeout_sec;	//reset the timeout, linux modify it
 		timeout.tv_usec = timeout_usec;	//reset the timeout, linux modify it
 		read_count = read(tech_pvt->controldevfd, tmp_answer_ptr, AT_BUFSIZ - (tmp_answer_ptr - tmp_answer));

Modified: freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c (14951 => 14952)


--- freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c	2009-09-23 08:34:29 UTC (rev 14951)
+++ freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c	2009-09-23 09:58:42 UTC (rev 14952)
@@ -1171,7 +1171,7 @@
 			char *context = "default";
 			char *dialplan = "XML";
 			char *destination = "5000";
-			char *controldevice_name = "/dev/ttyACM1";
+			char *controldevice_name = "/dev/ttyACM0";
 			char *digit_timeout = NULL;
 			char *max_digits = NULL;
 			char *hotline = NULL;
@@ -2204,6 +2204,7 @@
 				tech_pvt->controldev_dead = 1;
 				close(tech_pvt->controldevfd);
 				ERRORA("celliax_serial_monitor failed, declaring %s dead\n", CELLIAX_P_LOG, tech_pvt->controldevice_name);
+				switch_sleep(1000000);
 			} else if (tech_pvt->controldevprotocol != PROTOCOL_NO_SERIAL && tech_pvt->interface_state == CELLIAX_STATE_RING && tech_pvt->phone_callflow != CALLFLOW_CALL_HANGUP_REQUESTED ) {
 				WARNINGA("INCOMING RING\n", CELLIAX_P_LOG);