diff options
author | saerome.kim <saerome.kim@samsung.com> | 2019-10-25 09:08:06 +0900 |
---|---|---|
committer | saerome.kim <saerome.kim@samsung.com> | 2019-10-25 13:45:02 +0900 |
commit | a9b24734f7291b0d01d9564f10f33077b0e2605e (patch) | |
tree | 8a90db2a9f53d8d47870ca4c6c8d37e64fd2f8ea | |
parent | 5fb8f461193da137b389f8ca2866008744f973b2 (diff) | |
download | user-awareness-a9b24734f7291b0d01d9564f10f33077b0e2605e.tar.gz user-awareness-a9b24734f7291b0d01d9564f10f33077b0e2605e.tar.bz2 user-awareness-a9b24734f7291b0d01d9564f10f33077b0e2605e.zip |
Add power lock/unlock functionality
Change-Id: Ie22d72368421d5f55136b3d384c244f8c1ab4303
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
-rw-r--r-- | test/uat-detections.c | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/test/uat-detections.c b/test/uat-detections.c index 711c2cf..371e636 100644 --- a/test/uat-detections.c +++ b/test/uat-detections.c @@ -621,11 +621,11 @@ static int run_ua_set_low_power_mode( if (strlen(g_lpm_onoff)) onoff = (unsigned char)strtol((g_lpm_onoff), NULL, 10); - msg("run_ua_set_low_power_mode bitmask [%x]", sensor); + msg("ua_set_low_power_mode bitmask [%x]", sensor); ret =ua_set_low_power_mode(sensor, onoff == 1 ? true : false); - msg(" - run_ua_set_low_power_mode() ret: [0x%X] [%s]", + msg(" - ua_set_low_power_mode() ret: [0x%X] [%s]", ret, uat_get_error_str(ret)); return RET_SUCCESS; @@ -638,7 +638,7 @@ static int run_device_power_request_poweroff( int ret = UA_ERROR_NONE; int off_reason = POWER_OFF_REASON_ART_APP_TO_SUSPEND | POWER_OFF_TO_SUSPEND; - msg("run_device_power_request_poweroff"); + msg("device_power_request_poweroff"); if (0 != device_power_request_poweroff(off_reason)) { msgr("Fail to request power off"); @@ -658,7 +658,43 @@ static int run_device_power_request_poweroff( return RET_SUCCESS; } - msg(" - run_device_power_request_poweroff() ret: [0x%X] [%s]", + msg(" - device_power_request_poweroff() ret: [0x%X] [%s]", + ret, uat_get_error_str(ret)); + + return RET_SUCCESS; +} + +static int run_device_power_lock_state( + MManager *mm, struct menu_data *menu) +{ + int ret = UA_ERROR_NONE; + + msg("device_power_lock_state"); + + /* Power unlock */ + ret = device_power_lock_state(POWER_STATE_STANDBY, 0); + if (POWER_ERROR_NONE != ret) + msgr("Fail to request lock power state"); + + msg(" - device_power_lock_state() ret: [0x%X] [%s]", + ret, uat_get_error_str(ret)); + + return RET_SUCCESS; +} + +static int run_device_power_unlock_state( + MManager *mm, struct menu_data *menu) +{ + int ret = UA_ERROR_NONE; + + msg("device_power_unlock_state"); + + /* Power unlock */ + ret = device_power_unlock_state(POWER_STATE_STANDBY); + if (POWER_ERROR_NONE != ret) + msgr("Fail to request unlock power state"); + + msg(" - device_power_unlock_state() ret: [0x%X] [%s]", ret, uat_get_error_str(ret)); return RET_SUCCESS; @@ -813,8 +849,12 @@ struct menu_data menu_ua_detections[] = { { "14", "ua_set_low_power_mode", menu_set_low_power_mode, NULL, NULL }, #ifdef SUSPEND_RESUME_TEST - { "15", "request_power_off", + { "97", "request_power_off", NULL, run_device_power_request_poweroff, NULL }, + { "98", "device_power_lock_state", + NULL, run_device_power_lock_state, NULL }, + { "99", "device_power_unlock_state", + NULL, run_device_power_unlock_state, NULL }, #endif { NULL, NULL, }, }; |