Metadata-Version: 2.4
Name: ps5-vitals
Version: 0.1.0
Summary: Read/write PS5 system vitals (CPU/SoC temp, storage, fan control) from your PC over LAN. Requires a jailbroken PS5 with etaHEN + elfldr.
Author-email: Darkatek7 <darkatek7@example.com>
License: MIT
Project-URL: Homepage, https://github.com/Darkatek7/ps5-vitals
Project-URL: Repository, https://github.com/Darkatek7/ps5-vitals
Project-URL: Issues, https://github.com/Darkatek7/ps5-vitals/issues
Keywords: ps5,playstation,jailbreak,etaHEN,vitals,fan,thermal
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# ps5-vitals

Read and write PlayStation 5 system vitals from your PC over LAN.

```
$ ps5-vitals temp
CPU:   43 C  (rc=0)
SoC:   40 C  (rc=0)

$ ps5-vitals storage
storage:
  /user        529.1 GiB free / 627.5 GiB total ( 15.6% used)
  /data        529.1 GiB free / 627.5 GiB total ( 15.6% used)
  /mnt/usb0    405.7 GiB free / 465.6 GiB total ( 12.9% used)
  /mnt/usb1     14.3 GiB free /  14.3 GiB total (  0.2% used)

$ ps5-vitals fan set 70
fan threshold set to 70 C (ioctl rc=0)
```

## What it does

A zero-dependency Python CLI that ships with pre-built PS5 payload ELFs. It
pushes each op to the PS5 via `elfldr` (TCP 9021), lets the payload run, then
parses the resulting `[ps5-vitals-result] ...` line out of the kernel log
stream (TCP 9081, etaHEN's forwarder). End-to-end round-trip on a 5.50 console
is ~1 second.

| Subcommand | What it does | Mechanism |
|---|---|---|
| `temp` | CPU and SoC temperature in °C | `sceKernelGetCpuTemperature` + `sceKernelGetSocSensorTemperature(0)` |
| `storage` | Free / total for `/user`, `/data`, `/mnt/usb0`, `/mnt/usb1` | `statvfs()` |
| `fan get` | Best-effort fan duty (0..100) | `sceKernelGetCurrentFanDuty` (weak-linked) |
| `fan set N` | Set fan turbo threshold (30, 40, 50, 60, 70, 80, 90 °C) | `/dev/icc_fan` ioctl `0xC01C8F07` |
| `version` | Liveness ping | `sceKernelGetCpuTemperature` as a no-cost probe |

## Requirements

- A jailbroken PS5 with a **live** Y2JB → etaHEN → ps5debug-NG chain:
  - **etaHEN's klog forwarder on TCP 9081** (the default).
  - **elfldr / Poops on TCP 9021** (the default).
- The PS5 on the same LAN as your PC, default IP `10.0.0.108` (override
  with `--host` or `PS5_IP`).
- Python 3.8+ on the PC side. No third-party packages.

## Install

```bash
pip install ps5-vitals
```

The wheel bundles 11 pre-built payload ELFs (one per op, plus the seven
fan-set thresholds) so you don't need the PS5 payload SDK or a cross
compiler.

## PS5 SDK pin (for the source payload)

If you want to rebuild the bundled ELFs from source:

- `ps5-payload-dev/sdk` ≥ 0.37 (provides `prospero.mk`, `libSce.libkernel`
  with `sceKernelGetCpuTemperature` and `sceKernelGetSocSensorTemperature`).
- `clang` / `lld` matching the SDK release.
- Firmware-specific: this package targets **5.50** (the SDK's
  `PS5SDK_FW=0x550` is implicitly the safe default for dynamically
  linked payloads using only public NIDs).

To rebuild:

```bash
git clone https://github.com/ps5-payload-dev/sdk
PS5_PAYLOAD_SDK=$PWD/sdk make -C payload
```

The source lives in `payload/vitals.c`; the Makefile is at
`payload/Makefile`. Each `vitals-*.elf` is exactly one operation — the
operation is baked into the ELF at build time via `-DCOMMAND=...` (or
`-DCOMMAND_FAN_SET_N=N`). This makes each push cheap and stateless.

## On-ramp to a home-screen tile

This package is the **CLI path**. The same `vitals.c` is the foundation
for an on-screen SDL2 tile (`vitals-tile.elf`) that would render a
1080p vitals panel with a fan slider and storage bars. The build
target is gated on having a valid PS5 fPKG signing key — the underlying
issue is the `0x80F00101 SCE_NP_DRM_CONTENT_ERROR_HEADERSIGN` blocker
that affects every non-Sony-keyed fPKG on 5.50+. When a key is sourced,
the SDL2 frontend reuses these exact payload primitives and the CLI
remains the test harness for them.

## What works on 5.50 (verified 2026-07-25)

| Console feature | Source | ps5-vitals command |
|---|---|---|
| CPU temperature | `sceKernelGetCpuTemperature` | `temp` |
| SoC temperature | `sceKernelGetSocSensorTemperature(0)` | `temp` |
| Storage free/total | `statvfs()` | `storage` |
| Fan threshold | `/dev/icc_fan` ioctl `0xC01C8F07` | `fan set N` |
| Fan duty (best-effort) | `sceKernelGetCurrentFanDuty` | `fan get` |

What does **not** work today (because of the DRM blocker, not the code):
- Installing the on-screen tile as an fPKG (no working signing key).
- True fan RPM (the kernel reports duty, not RPM).
- Custom fan curve (only the threshold is exposed; the curve is what the
  firmware uses internally to translate threshold → duty).

## License

MIT. See `LICENSE`.
