Skip to content

armgit / PS5LM

Public Imported from GitHub
0

llama.cpp on a jailbroken PS5: run any GGUF model natively on the console, starting with Qwen 3.8

Keep the console out of rest mode while the app has work (#59)

Mert Cobanovf741bd070b28
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7bafd0b..1d502a5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -104,6 +104,12 @@ v0.1.x are the upstream payload releases by cobanov.
counts the window layers at their window, as llama.cpp keeps them. Spark-X2.6 4B (27 of 36 layers
keep 512 tokens) plans 256k with a q8_0 cache instead of 128k with q4_0. **Longest context** in
Settings goes to 192k and 256k, and the planner tries both.
+- A console serving a model went into rest mode an hour after the last button press: requests
+ from the network are not controller input. Rest mode ends the app, and on a jailbroken console the
+ controllers do not connect again until a restart. While a model is loaded, a download is queued
+ or running, or the app is a fleet worker, it now tells the system every 30 s that it is in use
+ (`sceSystemServicePowerTick`, as a video player does); with nothing to do, the console's own
+ rest-mode setting applies. `app.log` says when it starts doing so.
## [0.10.0] - 2026-11-01
diff --git a/ps5/app/main.cpp b/ps5/app/main.cpp
index 99bc890..03f5728 100644
--- a/ps5/app/main.cpp
+++ b/ps5/app/main.cpp
@@ -105,6 +105,7 @@ int sceSystemServiceHideSplashScreen(void);
int sceKernelSendNotificationRequest(uint32_t device, void * request, size_t size, int blocking);
int sceKernelUsleep(uint32_t microseconds);
int sceSystemServiceLoadExec(const char * path, const char * const * args);
+int sceSystemServicePowerTick(void);
}
namespace {
@@ -306,6 +307,23 @@ void log_memory(const char * when, bool devices = true) {
std::printf("\n");
}
+// Rest mode ends the title, and on a jailbroken console the controllers do not
+// connect again until a restart. Requests from the network are not controller
+// input, so the system put a serving console to rest an hour after the last
+// button press. While the app has work, it tells the system it is in use, as
+// a video player does; idle, the console's own rest-mode setting applies.
+void keep_awake(bool work) {
+ static int64_t last = 0;
+ const int64_t now = hui::sys::monotonic_us();
+ if (work && now - last >= 30'000'000) {
+ const int rc = sceSystemServicePowerTick();
+ if (last == 0) {
+ ps5lm::log_line("keeping the console out of rest mode while there is work (power tick: %d)\n", rc);
+ }
+ last = now;
+ }
+}
+
std::vector<std::string> read_lines(const std::string & path) {
std::vector<std::string> out;
std::ifstream in(path);
@@ -952,6 +970,7 @@ int main(int, char **) {
}
if (n % 60 == 0) {
quit_if_asked(); // Existing safe title-close path; not cancellation in a GPU call.
+ keep_awake(!failed);
}
}
}
@@ -1209,6 +1228,11 @@ int main(int, char **) {
}
if (n % 10 == 0) {
MarketView mv = market.snapshot();
+ keep_awake(!models.running.empty() ||
+ std::any_of(mv.downloads.begin(), mv.downloads.end(), [](const Download & d) {
+ return d.state == DownloadState::queued || d.state == DownloadState::running ||
+ d.state == DownloadState::retrying;
+ }));
// A finished download joins the library.
if (mv.saved != saved_seen) {
saved_seen = mv.saved;