feat: disconnect Bluetooth devices, flush disks on shutdown/reboot, display progress in login.elf window
This commit is contained in:
@@ -173,6 +173,21 @@ namespace Montauk {
|
||||
static constexpr uint64_t SYS_THREAD_JOIN = 132;
|
||||
static constexpr uint64_t SYS_THREAD_SELF = 133;
|
||||
|
||||
// Flush + unmount persistent volumes for power-off
|
||||
static constexpr uint64_t SYS_FS_SYNC = 134;
|
||||
|
||||
// Cross-process graceful power-off request channel
|
||||
static constexpr uint64_t SYS_POWER_REQUEST = 135;
|
||||
|
||||
// Graceful power-off request actions (SYS_POWER_REQUEST). The desktop posts
|
||||
// a pending action and exits; login.elf reads it, runs the shutdown stages,
|
||||
// then issues the matching SYS_SHUTDOWN / SYS_RESET.
|
||||
enum PowerRequestAction : int {
|
||||
POWER_REQ_QUERY = 0, // read-and-clear the pending action
|
||||
POWER_REQ_SHUTDOWN = 1,
|
||||
POWER_REQ_REBOOT = 2,
|
||||
};
|
||||
|
||||
static constexpr uint32_t CLIPBOARD_MAX_TEXT_BYTES = 256 * 1024;
|
||||
|
||||
static constexpr uint32_t IPC_SIGNAL_READABLE = 1u << 0;
|
||||
|
||||
@@ -369,6 +369,15 @@ namespace montauk {
|
||||
return (int)syscall0(Montauk::SYS_SUSPEND);
|
||||
}
|
||||
|
||||
// Graceful power-off request channel. The desktop posts a pending action
|
||||
// (Montauk::POWER_REQ_SHUTDOWN / POWER_REQ_REBOOT) then exits; login.elf
|
||||
// reads it with POWER_REQ_QUERY (read-and-clear), runs the shutdown stages,
|
||||
// and finally calls shutdown()/reset(). Returns the pending action for a
|
||||
// query, or 0 when posting one.
|
||||
inline int power_request(int action) {
|
||||
return (int)syscall1(Montauk::SYS_POWER_REQUEST, (uint64_t)(int64_t)action);
|
||||
}
|
||||
|
||||
// Mouse
|
||||
inline void mouse_state(Montauk::MouseState* out) { syscall1(Montauk::SYS_MOUSESTATE, (uint64_t)out); }
|
||||
inline void set_mouse_bounds(int32_t maxX, int32_t maxY) {
|
||||
@@ -436,6 +445,11 @@ namespace montauk {
|
||||
inline int fs_mount(int partIndex, int driveNum) {
|
||||
return (int)syscall2(Montauk::SYS_FSMOUNT, (uint64_t)partIndex, (uint64_t)driveNum);
|
||||
}
|
||||
// Flush all block-device write caches and cleanly unmount disk-backed
|
||||
// volumes ahead of power-off. Returns the number of volumes unmounted.
|
||||
inline int fs_sync() {
|
||||
return (int)syscall0(Montauk::SYS_FS_SYNC);
|
||||
}
|
||||
inline int fs_format(const Montauk::FsFormatParams* params) {
|
||||
return (int)syscall1(Montauk::SYS_FSFORMAT, (uint64_t)params);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user