[Feature][T106][task-view-415]Optimize qser_adc_show interface cpu occupancy

Only Configure: Yes
Affected branch: master
Affected module: adc
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: yes
Doc Update: No

Change-Id: I52d18f67a8daff9f9e237d5373172633ba9f35e9
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-adc/lynq-adc.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-adc/lynq-adc.cpp
index b392fca..a465ae3 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-adc/lynq-adc.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-adc/lynq-adc.cpp
@@ -25,52 +25,76 @@
 int qser_adc_show(ADC_CHANNEL_E qadc)
 {
     int adc_value;
-    char cmd[1024];
-    char cmd_ret[1024];
-    FILE *fp;
+    char cmd_ret[1024]={0};
+    FILE *fd;
     switch(qadc)
     {
-    case QADC_NONE:
-    {
-        LYERRLOG("function %s line %d\n", __FUNCTION__, __LINE__);
-        return 0;
+        case QADC_NONE:
+        {
+            LYERRLOG("function %s line %d\n", __FUNCTION__, __LINE__);
+            return 0;
+        }
+        case ADC0:
+        {
+            LYDBGLOG("function %s line %d\n", __FUNCTION__, __LINE__);
+            fd = fopen(ADC0_NODES, "r");
+            if(fd == NULL)
+            {
+                LYERRLOG("fopen error: %s", strerror(errno));
+                return -1;
+            }
+            if(fgets(cmd_ret, sizeof(cmd_ret), fd) == NULL)
+            {
+                LYERRLOG("fgets error!!!\n");
+                fclose(fd);
+                return -1;
+            }
+            fclose(fd);
+            break;
+        }
+        case ADC1:
+        {
+            LYDBGLOG("function %s line %d\n", __FUNCTION__, __LINE__);
+            fd = fopen(ADC1_NODES, "r");
+            if(fd == NULL)
+            {
+                LYERRLOG("fopen error: %s", strerror(errno));
+                return -1;
+            }
+            if(fgets(cmd_ret, sizeof(cmd_ret), fd) == NULL)
+            {
+                LYERRLOG("fgets error!!!\n");
+                fclose(fd);
+                return -1;
+            }
+            fclose(fd);
+            break;
+        }
+        case ADC2:
+        {
+            LYDBGLOG("function %s line %d\n", __FUNCTION__, __LINE__);
+            fd = fopen(ADC2_NODES, "r");
+            if(fd == NULL)
+            {
+                LYERRLOG("fopen error: %s", strerror(errno));
+                return -1;
+            }
+            if(fgets(cmd_ret, sizeof(cmd_ret), fd) == NULL)
+            {
+                LYERRLOG("fgets error!!!\n");
+                fclose(fd);
+                return -1;
+            }
+            fclose(fd);
+            break;
+        }
+        default:
+        {
+            LYERRLOG("input error\n");
+            return -1;
+        }
     }
-    case ADC0:
-    {
-        LYDBGLOG("function %s line %d\n", __FUNCTION__, __LINE__);
-        sprintf(cmd, "cat %s", ADC0_NODES);
-        break;
-    }
-    case ADC1:
-    {
-        LYDBGLOG("function %s line %d\n", __FUNCTION__, __LINE__);
-        sprintf(cmd, "cat %s", ADC1_NODES);
-        break;
-    }
-    case ADC2:
-    {
-        LYDBGLOG("function %s line %d\n", __FUNCTION__, __LINE__);
-        sprintf(cmd, "cat %s", ADC2_NODES);
-        break;
-    }
-    default:
-    {
-        LYERRLOG("input error\n");
-        return -1;
-    }
-    }
-    if((fp = popen(cmd,"r")) == NULL)
-    {
-        LYERRLOG("popen error: %s", strerror(errno));
-        return -1;
-    }
-    if((fread(cmd_ret,sizeof(cmd_ret),1,fp))<0)
-    {
-        LYERRLOG("fread fail: %s", strerror(errno));
-        fclose(fp);
-        return -1;
-    }
-    fclose(fp);
+
     adc_value = atoi(cmd_ret);
     if (adc_value < 0 || adc_value > 12000)
     {