According to org.freedesktop.login1:
> If "na" is returned, the operation is not available because
> hardware, kernel, or drivers do not support it. If "yes" is
> returned, the operation is supported and the user may execute
> the operation without further authentication. If "no" is returned,
> the operation is available but the user is not allowed to execute
> the operation.
Therefore, we should return "no" if sleep is explicitly disabled,
otherwise we return "na".
assert(a);
if (a->sleep_operation >= 0) {
- r = sleep_supported(a->sleep_operation);
+ SleepSupport support;
+
+ r = sleep_supported_full(a->sleep_operation, &support);
if (r < 0)
return r;
if (r == 0)
- return sd_bus_reply_method_return(message, "s", "na");
+ return sd_bus_reply_method_return(message, "s", support == SLEEP_DISABLED ? "no" : "na");
}
r = sd_bus_query_sender_creds(message, SD_BUS_CREDS_EUID, &creds);