2020-01-18 11:38:21 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
2021-09-11 12:20:47 +03:00
|
|
|
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
|
2020-01-18 11:38:21 +03:00
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2021-09-11 12:20:47 +03:00
|
|
|
#include <fcntl.h>
|
2019-07-19 14:08:26 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
2019-06-16 12:49:39 +03:00
|
|
|
|
2021-09-11 12:20:47 +03:00
|
|
|
int main(int, char**)
|
2019-06-16 12:49:39 +03:00
|
|
|
{
|
2021-09-11 12:20:47 +03:00
|
|
|
int power_state_switch_node = open("/sys/firmware/power_state", O_WRONLY);
|
|
|
|
if (power_state_switch_node < 0) {
|
|
|
|
perror("open");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
const char* value = "2";
|
|
|
|
if (write(power_state_switch_node, value, 1) < 0) {
|
|
|
|
perror("write");
|
2020-01-27 20:25:36 +03:00
|
|
|
return 1;
|
2019-06-16 12:49:39 +03:00
|
|
|
}
|
2021-09-11 12:20:47 +03:00
|
|
|
return 0;
|
2019-06-16 12:49:39 +03:00
|
|
|
}
|