MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / systemctl_power

Method systemctl_power

OpenHD/ohd_common/src/openhd_reboot_util.cpp:47–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45static void command_shutdown() { OHDUtil::run_command("shutdown", {}, true); }
46
47void openhd::reboot::systemctl_power(bool shutdownOnly) {
48 if (shutdownOnly) {
49 // Some Images don't allow soft restarts or reboots when a netork is
50 // connected
51 if ((OHDPlatform::instance().platform_type ==
52 X_PLATFORM_TYPE_ROCKCHIP_RK3566_RADXA_ZERO3W) ||
53 (OHDPlatform::instance().platform_type ==
54 X_PLATFORM_TYPE_ROCKCHIP_RK3566_RADXA_CM3)) {
55 command_shutdown();
56 } else {
57 systemctl_shutdown();
58 }
59 } else {
60 if ((OHDPlatform::instance().platform_type ==
61 X_PLATFORM_TYPE_ROCKCHIP_RK3566_RADXA_ZERO3W) ||
62 (OHDPlatform::instance().platform_type ==
63 X_PLATFORM_TYPE_ROCKCHIP_RK3566_RADXA_CM3)) {
64 command_reboot();
65 } else {
66 systemctl_reboot();
67 }
68 }
69}
70
71void openhd::reboot::handle_power_command_async(std::chrono::milliseconds delay,
72 bool shutdownOnly) {

Callers

nothing calls this directly

Calls 2

command_shutdownFunction · 0.85
command_rebootFunction · 0.85

Tested by

no test coverage detected