summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/device_manager_plugin_pinetrail.c2
-rw-r--r--src/test/slp_plugin_test.c13
2 files changed, 12 insertions, 3 deletions
diff --git a/src/device_manager_plugin_pinetrail.c b/src/device_manager_plugin_pinetrail.c
index 70214d8..9030981 100644
--- a/src/device_manager_plugin_pinetrail.c
+++ b/src/device_manager_plugin_pinetrail.c
@@ -704,7 +704,7 @@ int OEM_sys_get_battery_capacity(int *value)
if(charge_full == 0)
{
ret = sys_get_int(BATTERY_CHARGE_FULL_PATH, &charge_full);
- if(ret != 0)
+ if(ret != 0 || charge_full == 0)
{
devmgr_log("get battery charge full error!");
charge_full = 0;
diff --git a/src/test/slp_plugin_test.c b/src/test/slp_plugin_test.c
index 90eab44..c916e0b 100644
--- a/src/test/slp_plugin_test.c
+++ b/src/test/slp_plugin_test.c
@@ -77,6 +77,7 @@ int test_set_level()
case 0 ... 100:
TEST_SET(OEM_sys_set_haptic_motor_level, level);
printf("set level: %d\n", level);
+ break;
case -1:
return 0;
default:
@@ -148,6 +149,7 @@ void svi_test()
void vib_test()
{
char input,tmp;
+ int r;
while(1) {
printf("=======================1. vib_test==========================\n");
@@ -159,7 +161,10 @@ void vib_test()
printf("q : quit\n");
printf("============================================================\n");
- scanf("%c", &input);
+ r = scanf("%c", &input);
+ if (r < 1)
+ continue;
+
while((tmp = getchar()) != '\n');
switch(input) {
@@ -283,6 +288,7 @@ void backlight_test()
int main()
{
char input,tmp;
+ int r;
OEM_sys_get_devman_plugin_interface();
@@ -298,7 +304,10 @@ int main()
printf("q : quit\n");
printf("=====================================================================\n");
- scanf("%c", &input);
+ r = scanf("%c", &input);
+ if (r < 1)
+ continue;
+
while((tmp = getchar()) != '\n');
switch(input) {