Files

187 lines
9.1 KiB
Markdown

# Samsung Tizen button remap
Netflix → Jellyfin; Rakuten → Plex. Tested on a **GQ75Q70TGTXZG (Q70T, 2020),
Tizen 5.5, T-NKMDEUC-2743.0**. Both launches and a restart by holding the power
button were confirmed on 2026-11-07. An unplug/replug cold-power test was not
performed. This is an extracted working setup, not a universal Samsung installer.
## Files and attribution
`remap.js`, `worker.sh`, and `boot.sh` are the small application/boot glue.
`physical-input.js` is adapted from Vetro (MIT), with `new Buffer(...)` calls and
a byte-comparison fallback for Samsung's Node 4.4.3. `compat.js` is retained from
the installed setup; the runtime fixes are in the bridge itself.
The C# helper and Tizen 5.5 DLL come from
[Vetro's Q74T work](https://github.com/andrearicci93/vetro/tree/082559ee7f5240dd71135f7de831d5cdd26257ec).
The helper is public domain/Unlicense; its license, source, runtime configuration,
and upstream build manifest are in `helper/`. Vetro's MIT notice is
`LICENSE-VETRO`. The manifest's `hardwareVerified:false` is upstream build metadata;
the hardware test of this integration is described above, not a change to that manifest.
No firmware assemblies or Samsung certificates are included.
`profile-carrier-patch.bin` is the exact 776-byte profile patch used on this TV,
based on [tiz0wn](https://github.com/sebastianspicker/tiz0wn/tree/main/exploits/tiz0wn-root).
It is **not** a portable firmware patch. It preserves a compacted interactive
prompt function and adds the guarded boot call. Never apply it based on model
name alone. This repository supplies no root exploit and no maintenance listener.
## 1. Establish the prerequisites
Read [the root proof](https://brunner.ninja/2026/11/07/rooting-samsung-tv-through-a-password-field/).
An SDB connection alone is not a root shell. The password-field proof only
establishes command execution; use that existing root channel to run the root
commands below, under `uid=0` and `System::Privileged`.
Have Jellyfin, Plex, and **Free My TV** installed. The helper is placed inside
Free My TV's installed application directory because this firmware's Samsung
`.NET` launcher rejects our assembly in `/tmp`. This does not make Free My TV the
default launcher. Removing/reinstalling that app can remove the helper.
Keep developer-mode SDB access available during installation. Stage from your PC
(replace TV_IP with the TV's current address):
```sh
git clone https://code.brunner.ninja/feedc0de/samsung-tizen-button-remap.git
sdb connect TV_IP:26101
sdb push samsung-tizen-button-remap /home/owner/share/tmp/sdk_tools/q70t-remap
```
Verify the pushed directory layout: it must contain `remap.js`, `boot.sh`, and
`helper/` directly. SDB implementations can differ in directory-copy semantics.
## 2. Identify the physical input node
From the TV's root command channel:
```sh
cat /proc/bus/input/devices
```
Our events came from **Smart Control 2016 at `/dev/input/event5`**, not the other
same-named device at `event256`. Do not select by name alone. Listen briefly to
each plausible physical remote device while pressing the buttons:
```sh
dd if=/dev/input/event5 bs=16 count=8 2>/tmp/button-read.log | od -An -tx2 -w16
```
Use a bounded root job or stop the reader if no events arrive. This example is
for this 32-bit TV: a Linux `input_event` is 16 bytes here, not the 24-byte layout
used on a typical 64-bit desktop. In our capture `0001 00e2 0001 0000` after the
timestamp meant EV_KEY, code 226, value 1. `01f4` is 500. Value 0 is release;
the all-zero type/code record is synchronization. Netflix=226, Rakuten=500.
Edit `remap.js` if your node, key codes, package IDs or helper path differ.
The tested IDs are `AprZAARz4r.Jellyfin` and `kIciSQlYEM.plex`; query your own
installed apps rather than assuming these are universal.
## 3. Install the runtime
Through the TV's existing privileged root channel (not ordinary `sdb shell`):
```sh
sh -c "$(cat /home/owner/share/tmp/sdk_tools/q70t-remap/install-runtime.sh)"
```
The content invocation matters: root does not bypass this firmware's unsigned
executable enforcement. The helper itself uses the TV's signed
`dotnet-launcher --standalone` and .NET Core 3.0 runtime. The bridge authenticates
the helper over a loopback socket and requests a filter for codes 226 and 500.
EVIOCGRAB gives it the physical device; uinput forwards the other key events.
Closing the bridge releases the grab, restoring the physical input path.
## 4. Boot integration: exact firmware and backup gates
`/etc` is a read-only VDFS image on our firmware. Ordinary copying into
`/etc/profile.d` does not work, even as root. Our live installation used tiz0wn's
guarded raw-block installer, which backed up, wrote, and read back the carrier.
The following is the equivalent explicit procedure for **this exact original
window only**; it has not been separately installed on a second TV. Stop at any
mismatch, including a pre-existing patch. Do not adapt an offset by guessing.
On the TV, through the existing root channel:
```sh
set -eu
src=/home/owner/share/tmp/sdk_tools/q70t-remap
d=/opt/usr/share/tvroot
dev=/dev/mmcblk0p19
[ "$(id -u)" = 0 ]
[ "$(cat /sys/block/mmcblk0/mmcblk0p19/size)" = 3502080 ]
[ "$(sha256sum /etc/profile.d/bash_prompt_custom.sh | cut -d' ' -f1)" = effe97f8ec948a15962fc8a1b85a4e1e446352b8c5caae703e1ed0684425e33c ]
[ "$(sha256sum "$src/profile-carrier-patch.bin" | cut -d' ' -f1)" = 6f20fe91f56c355ec0035fb46c02076a16398f5e9286be6832691bfbb3efe2cf ]
mkdir -p "$d"
[ -f "$d/boot" ]
[ ! -e "$d/original-window.bin" ]
dd if="$dev" of="$d/original-window.bin" bs=512 skip=1469808 count=2
[ "$(wc -c <"$d/original-window.bin")" = 1024 ]
[ "$(sha256sum "$d/original-window.bin" | cut -d' ' -f1)" = 7d0f116e201ba20692cab9e34d52231fb0dbceddcf51aa2ceb2c8b2a2346b98f ]
cp "$d/original-window.bin" "$d/new-window.bin"
dd if="$src/profile-carrier-patch.bin" of="$d/new-window.bin" bs=776 count=1 conv=notrunc
[ "$(wc -c <"$d/new-window.bin")" = 1024 ]
# Copy original-window.bin off the TV before continuing. Keep this root session.
```
The byte offset is **752541696**, block **1469808**, on our active root partition.
We located it read-only and verified the complete 776-byte vendor file and the
1024-byte surrounding window. The remaining 248 bytes of the window are preserved.
Copy the backup to your computer through your established root output channel;
ordinary SDB pull may refuse these paths. The live work used a verified base64
transfer over the temporary command callback.
Only after the external backup is verified, write and check:
```sh
dd if="$d/new-window.bin" of="$dev" bs=512 seek=1469808 count=2 conv=notrunc
sync
dd if="$dev" of="$d/readback-window.bin" bs=512 skip=1469808 count=2
cmp "$d/new-window.bin" "$d/readback-window.bin"
touch "$d/enable"
```
Run these commands as a single fail-fast root script, or preserve `src`, `d`,
and `dev` between invocations. A failed check must stop the sequence before
`touch enable`. Do not reboot after a failed flash readback: retain root access
and restore the original window, then verify it.
The profile entry sources the boot script by content:
```sh
[ -f /opt/usr/share/tvroot/enable ]&&[ -z "$TIZ0WN_R" ]&&{ TIZ0WN_R=1;sh -c "$(cat /opt/usr/share/tvroot/boot)";};
```
`boot.sh` checks UID 0, uses an atomic `/tmp` directory as a once-per-boot guard,
detaches, waits for persistent files, starts the worker, and waits another 25
seconds before starting the bridge. A failed bridge is retried after 10 seconds.
It assumes the remote remains at event5; this is intentionally model-specific.
The boot wait explains why the first button press after a restart can be early.
## 5. Test and disable
Restart by holding the remote's power button until the TV boots again. Wait about
a minute. Test Netflix→Jellyfin, Rakuten→Plex, then navigation, volume and Back.
Inspect `/opt/usr/share/q70t-remap/boot.log` and `remap.log` if needed.
The observed restart test succeeded; this is not evidence of a power-unplug test.
To disable subsequent starts, remove `/opt/usr/share/tvroot/enable`. The running
bridge remains until stopped/restarted; terminate only the matching Node process
whose command and PID you have verified. Closing that process releases the helper
connection and the exclusive input grab. A reboot with the enable file absent
leaves Samsung's physical key handling in charge. If Rakuten has independently
been disabled, it stays disabled; enable its package separately if wanted.
To restore the raw carrier, use your own verified `original-window.bin`, write the
same two blocks back, `sync`, re-read them, and verify the original hash above.
Keep the external backup. Do not restore this model's block onto another build.
## Rebuilding the DLL
The checked-in DLL is the exact upstream Tizen 5.5 build used in the test. For a
rebuild, use the linked Vetro commit's `rooting/tools/build-input-tizen55.py`, an
installed Roslyn compiler, and .NET Core 3.0 references. The script documents
`--dotnet`, `--compiler`, `--references`, and `--out`; Samsung firmware reference
assemblies are deliberately not redistributed here. See the upstream manifest
for the source and binary provenance. A rebuild is not automatically a tested
replacement for the included artifact.