diff --git a/core/embed/rust/Cargo.toml b/core/embed/rust/Cargo.toml index 3deab49cf7..a887e6c474 100644 --- a/core/embed/rust/Cargo.toml +++ b/core/embed/rust/Cargo.toml @@ -43,6 +43,7 @@ backlight = [] usb = [] optiga = [] ble = [] +powerctl = [] translations = ["crypto"] test = [ "backlight", diff --git a/core/embed/sys/powerctl/unix/powerctl.c b/core/embed/sys/powerctl/unix/powerctl.c new file mode 100644 index 0000000000..d5c6732a3d --- /dev/null +++ b/core/embed/sys/powerctl/unix/powerctl.c @@ -0,0 +1,30 @@ +/* +* This file is part of the Trezor project, https://trezor.io/ + * + * Copyright (c) SatoshiLabs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + + +#include + +bool powerctl_hibernate(void) { + + exit(1); + return true; +} + diff --git a/core/site_scons/models/T3W1/emulator.py b/core/site_scons/models/T3W1/emulator.py index 56483240ad..f7580b5c0b 100644 --- a/core/site_scons/models/T3W1/emulator.py +++ b/core/site_scons/models/T3W1/emulator.py @@ -58,6 +58,13 @@ def configure( features_available.append("touch") defines += [("USE_TOUCH", "1")] + sources += [ + "embed/sys/powerctl/unix/powerctl.c", + ] + defines += [("USE_POWERCTL", "1")] + paths += ["embed/sys/powerctl/inc"] + features_available.append("powerctl") + features_available.append("backlight") defines += [("USE_BACKLIGHT", "1")] diff --git a/core/site_scons/models/T3W1/trezor_t3w1_revA.py b/core/site_scons/models/T3W1/trezor_t3w1_revA.py index 8f94eca4bb..2f266c1759 100644 --- a/core/site_scons/models/T3W1/trezor_t3w1_revA.py +++ b/core/site_scons/models/T3W1/trezor_t3w1_revA.py @@ -235,6 +235,7 @@ def configure( ] paths += ["embed/sys/powerctl/inc"] defines += [("USE_POWERCTL", "1")] + features_available.append("powerctl") env.get("ENV")["LINKER_SCRIPT"] = linker_script diff --git a/core/site_scons/models/T3W1/trezor_t3w1_revB.py b/core/site_scons/models/T3W1/trezor_t3w1_revB.py index 6d81b310fd..73995af447 100644 --- a/core/site_scons/models/T3W1/trezor_t3w1_revB.py +++ b/core/site_scons/models/T3W1/trezor_t3w1_revB.py @@ -240,6 +240,7 @@ def configure( ] paths += ["embed/sys/powerctl/inc"] defines += [("USE_POWERCTL", "1")] + features_available.append("powerctl") env.get("ENV")["LINKER_SCRIPT"] = linker_script