From: taeyoung Date: Wed, 4 Jan 2017 08:24:47 +0000 (+0900) Subject: power: fix to deliver reboot parameter X-Git-Tag: accepted/tizen/3.0/common/20170109.195441^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F16%2F108416%2F1;p=platform%2Fcore%2Fapi%2Fdevice.git power: fix to deliver reboot parameter Previously, device_power_reboot() returns error if reboot parameter is NULL. Thus it is fixed by handling NULL input. Change-Id: Idcb6a5f4d0b41803cd6d60c4ec2be185675f0e83 Signed-off-by: taeyoung --- diff --git a/src/power.c b/src/power.c index 1502a99..7e7cc30 100644 --- a/src/power.c +++ b/src/power.c @@ -50,6 +50,10 @@ #define METHOD_UNLOCK_STATE "unlockstate" #define METHOD_CHANGE_STATE "changestate" #define METHOD_REBOOT "Reboot" +#define METHOD_REBOOT_WITH_OPTION "RebootWithOption" + +#define TYPE_REBOOT "reboot" +#define REBOOT_REASON_NONE "" #define STR_STAYCURSTATE "staycurstate" #define STR_GOTOSTATENOW "gotostatenow" @@ -466,17 +470,25 @@ int device_power_wakeup(bool dim) //LCOV_EXCL_START Not available to test(Reboot during TCT) int device_power_reboot(const char *reason) { - char *arr[1]; + char *arr[2]; + char *method, *sig; int ret; - if (!reason) - return DEVICE_ERROR_INVALID_PARAMETER; + if (reason) { + arr[0] = TYPE_REBOOT; + arr[1] = (char *)reason; + method = METHOD_REBOOT_WITH_OPTION; + sig = "ss"; + } else { + arr[0] = REBOOT_REASON_NONE; + method = METHOD_REBOOT; + sig = "s"; + } - arr[0] = (char *)reason; ret = dbus_method_sync(DEVICED_BUS_NAME, DEVICED_PATH_POWER, DEVICED_INTERFACE_POWER, - METHOD_REBOOT, "s", arr); + method, sig, arr); return errno_to_device_error(ret); } //LCOV_EXCL_STOP