[Bugfix][T108-GSW][bug-view-1671] gsw get signal, no sinr
Only Configure: No
Affected branch: unknown
Affected module: network
Is it affected on both ZXIC and ASR: only ASR
Self-test: yes
Doc Update: no
Change-Id: Ic2abd478a26300d86b648adef8c922c7da94e3d2
diff --git a/mbtk/mbtk_rild/src/main.c b/mbtk/mbtk_rild/src/main.c
index a0f0afb..f109c54 100755
--- a/mbtk/mbtk_rild/src/main.c
+++ b/mbtk/mbtk_rild/src/main.c
@@ -1446,23 +1446,12 @@
goto EEMGINFOSVC_EXIT;
}
// mnc
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
{
goto EEMGINFOSVC_EXIT;
}
cell_info.cell[cell_info.cell_num].value6 = (uint32)tmp_int;
-
- /*
- // Jump 3 integer.
- i = 0;
- while(i < 3) {
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMGINFOSVC_EXIT;
- }
- i++;
- }
- */
+
// lac
if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
{
@@ -1477,9 +1466,9 @@
}
cell_info.cell[cell_info.cell_num].value2 = (uint32)tmp_int;
- // Jump 2 integer.
+ // Jump 2 integer, get 3rd number
i = 0;
- while(i < 2) {
+ while(i < 3) {
if (at_tok_nextint(&line, &tmp_int) < 0)
{
goto EEMGINFOSVC_EXIT;
@@ -1488,15 +1477,27 @@
}
// bsic
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ if ( tmp_int < 0 || tmp_int >= 65536)
{
goto EEMGINFOSVC_EXIT;
}
cell_info.cell[cell_info.cell_num].value4 = (uint32)tmp_int;
- // Jump 15 integer.
+ // Jump 4 integer, get 5rd number
i = 0;
- while(i < 15) {
+ while(i < 5) {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMGINFOSVC_EXIT;
+ }
+ i++;
+ }
+
+ cell_info.cell[cell_info.cell_num].value7=tmp_int; //rxlev
+
+ // Jump 10 integer, get 11rd number
+ i = 0;
+ while(i < 11) {
if (at_tok_nextint(&line, &tmp_int) < 0)
{
goto EEMGINFOSVC_EXIT;
@@ -1505,7 +1506,7 @@
}
// arfcn
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ if (tmp_int < 0 || tmp_int >= 65536)
{
goto EEMGINFOSVC_EXIT;
}
@@ -1913,87 +1914,87 @@
*/
static int asrFlagPathGet(char *asr_flag_path)
{
- char buf[128];
- unsigned char find = 0;
+ char buf[128];
+ unsigned char find = 0;
FILE *fd = fopen("/proc/mtd", "r");
- if (fd == NULL) {
+ if (fd == NULL) {
LOGE("Open MTD failed!");
return -1;
- }
+ }
- memset(buf, '\0', 128);
- while (fgets(buf, 128, fd) != NULL) {
- if(strstr(buf, "asr_flag")) {
- char *p = strstr(buf, "mtd");
- if(p)
- {
- int bln;
- sscanf(p, "mtd%d", &bln);
- sprintf(asr_flag_path, "/dev/mtdblock%d", bln);
- find = 1;
- break;
- }
- }
- memset(buf, '\0', 128);
- }
+ memset(buf, '\0', 128);
+ while (fgets(buf, 128, fd) != NULL) {
+ if(strstr(buf, "asr_flag")) {
+ char *p = strstr(buf, "mtd");
+ if(p)
+ {
+ int bln;
+ sscanf(p, "mtd%d", &bln);
+ sprintf(asr_flag_path, "/dev/mtdblock%d", bln);
+ find = 1;
+ break;
+ }
+ }
+ memset(buf, '\0', 128);
+ }
- fclose(fd);
+ fclose(fd);
return ((find == 1) ? 0 : -1);
}
static int readFromMTD(const char *path, unsigned int offset, void *buf, int size)
{
- int ret, fd;
- if (!path)
- return -1;
+ int ret, fd;
+ if (!path)
+ return -1;
- fd = open(path, O_RDONLY);
- if (fd < 0) {
+ fd = open(path, O_RDONLY);
+ if (fd < 0) {
LOGE("readFromMTD open error,%d", errno);
- return -1;
- }
+ return -1;
+ }
- ret = lseek(fd, offset, SEEK_SET);
- if (ret < 0) {
- close(fd);
+ ret = lseek(fd, offset, SEEK_SET);
+ if (ret < 0) {
+ close(fd);
LOGE("readFromMTD lseek error,%d", errno);
- return -1;
- }
- ret = read(fd, buf, size);
- if (ret < 0) {
- close(fd);
+ return -1;
+ }
+ ret = read(fd, buf, size);
+ if (ret < 0) {
+ close(fd);
LOGE("readFromMTD read error,%d", errno);
- return -1;
- }
- close(fd);
- return 0;
+ return -1;
+ }
+ close(fd);
+ return 0;
}
static int writeToMTD(const char *path, unsigned int offset, void *buf, int size)
{
- int ret, fd;
+ int ret, fd;
- if (!path)
- return -1;
+ if (!path)
+ return -1;
- fd = open(path, O_RDWR | O_SYNC);
- if (fd < 0)
- return -1;
+ fd = open(path, O_RDWR | O_SYNC);
+ if (fd < 0)
+ return -1;
- ret = lseek(fd, offset, SEEK_SET);
- if (ret < 0) {
- close(fd);
- return -1;
- }
- ret = write(fd, buf, size);
- if (ret < 0) {
+ ret = lseek(fd, offset, SEEK_SET);
+ if (ret < 0) {
+ close(fd);
+ return -1;
+ }
+ ret = write(fd, buf, size);
+ if (ret < 0) {
LOGE("writetomtd:write error:%d", errno);
- close(fd);
- return -1;
- }
+ close(fd);
+ return -1;
+ }
- close(fd);
- return 0;
+ close(fd);
+ return 0;
}
#endif
static void fota_result_check()