Fix auto data call for ril v2
Change-Id: I753b1c8ac7bcbeabd316734b54b4e79224537dea
diff --git a/mbtk/mbtk_rild_v2/src/atchannel.c b/mbtk/mbtk_rild_v2/src/atchannel.c
index 8a19159..f959a59 100755
--- a/mbtk/mbtk_rild_v2/src/atchannel.c
+++ b/mbtk/mbtk_rild_v2/src/atchannel.c
@@ -478,11 +478,11 @@
/* read error encountered or EOF reached */
if(count == 0)
{
- LOGD("atchannel: EOF reached");
+ LOGD("atchannel[Port-%d]: EOF reached", port);
}
else
{
- LOGD("atchannel: read error %s", strerror(errno));
+ LOGD("atchannel[Port-%d]: read error %s", port, strerror(errno));
}
return NULL;
}
@@ -495,11 +495,11 @@
s_ATBufferCur[port] = p_eol + 1; /* this will always be <= p_read, */
/* and there will be a \0 at *p_read */
- LOGD("AT< %s", ret);
+ LOGD("[Port-%d]AT< %s", port, ret);
return ret;
}
-static const char *readlineUrc()
+static const char *readlineUrc(ATPortType_enum port)
{
ssize_t count;
@@ -597,7 +597,7 @@
s_UartBufferCur = p_eol + 1; /* this will always be <= p_read, */
/* and there will be a \0 at *p_read */
- LOGD("URC< %s", ret);
+ LOGD("[Port-%d]URC< %s", port, ret);
return ret;
}
@@ -641,6 +641,8 @@
if (line == NULL)
{
+ //usleep(50000);
+ //continue;
break;
}
@@ -697,7 +699,7 @@
{
const char *line;
- line = readlineUrc();
+ line = readlineUrc(*port);
if (line == NULL)
{
@@ -733,7 +735,7 @@
return AT_ERROR_CHANNEL_CLOSED;
}
- LOGD("AT> %s", s);
+ LOGD("[Port-%d]AT> %s", port, s);
AT_DUMP( ">> ", s, strlen(s) );
@@ -865,12 +867,14 @@
return -1;
}
- pthread_t uart_tid_reader;
- ret = pthread_create(&uart_tid_reader, &attr, readerUrcLoop, urc_port_ptr);
- if (ret < 0)
- {
- LOGE("Uart thread create fail.");
- return -1;
+ if(port == ATPORTTYPE_0) { // URC only for ATPORTTYPE_0
+ pthread_t uart_tid_reader;
+ ret = pthread_create(&uart_tid_reader, &attr, readerUrcLoop, urc_port_ptr);
+ if (ret < 0)
+ {
+ LOGE("Uart thread create fail.");
+ return -1;
+ }
}
return 0;