2020-01-18 08:38:21 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
2021-09-11 09:20:47 +00:00
|
|
|
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
|
2020-01-18 08:38:21 +00:00
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 08:38:21 +00:00
|
|
|
*/
|
|
|
|
|
2023-12-16 14:19:34 +00:00
|
|
|
#include <AK/ByteString.h>
|
2023-02-09 02:02:46 +00:00
|
|
|
#include <LibCore/File.h>
|
2022-03-03 22:51:39 +00:00
|
|
|
#include <LibMain/Main.h>
|
2019-07-19 07:58:12 +00:00
|
|
|
|
2022-03-03 22:51:39 +00:00
|
|
|
ErrorOr<int> serenity_main(Main::Arguments)
|
2019-07-19 07:58:12 +00:00
|
|
|
{
|
2023-02-09 02:02:46 +00:00
|
|
|
auto file = TRY(Core::File::open("/sys/kernel/power_state"sv, Core::File::OpenMode::Write));
|
2022-03-03 22:51:39 +00:00
|
|
|
|
2023-12-16 14:19:34 +00:00
|
|
|
const ByteString file_contents = "1";
|
2023-03-01 16:24:50 +00:00
|
|
|
TRY(file->write_until_depleted(file_contents.bytes()));
|
2022-03-03 22:51:39 +00:00
|
|
|
file->close();
|
|
|
|
|
2019-07-19 07:58:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|