From 625a40ad9d43306700d1cb7f22ab0bcdb46ad35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rcio=20Fernandes?= Date: Sun, 26 Oct 2025 09:38:46 +0000 Subject: [PATCH] first commit :) --- README.md | 333 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 332 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 15e5d9b..9bdbd6e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,333 @@ -# virtual-smart-tv +# Virtual Smart TV +- [Apps](#apps) + - [Steam](#steam) + - [Greenlight](#greenlight) + - [youtube tv](#youtube-tv) + - [gamepass](#gamepass) +- [System](#system) + - [Kde Plasma](#kde-plasma) + - [Flatkpak](#flatkpak) + - [pixp](#pixp) +- [G20S PRO - Remote Control](#g20s-pro---remote-control) + - [keys remaps](#keys-remaps) + - [Setup](#setup) + - [evtest](#evtest) + - [evdevremapkeys](#evdevremapkeys) + - [HID definition - Patch and Rebind](#hid-definition---patch-and-rebind) + +## Apps + +### Steam + +**Requirements:** + +- Flatkpak + +**Install:** + +``` bash +flatpak install flathub com.valvesoftware.Steam +``` + +**Run:** + +```bash +flatpak run com.valvesoftware.Steam +``` + +**Desktop app:** + +- **~/.local/share/applications/steam.desktop** + +``` bash +[Desktop Entry] +Type=Application +Name=Steam +Exec=flatpak run --command=steam com.valvesoftware.Steam --steamos +Icon=steam +Type=Application +Categories=Game;virtual-smart-tv; +``` + +### Greenlight + +**Requirements:** + +- Flatkpak + +**Install:** + +```bash +flatpak install flathub io.github.unknownskl.greenlight +``` + +**Run:** + +```bash +flatpak run io.github.unknownskl.greenlight +``` + +**Desktop app:** + +- **~/.local/share/applications/greenlight.desktop** + +``` bash +[Desktop Entry] +Type=Application +Name=GreenLight +Exec=flatpak run io.github.unknownskl.greenlight & +Icon=/home/mf/.local/share/waydroid/data/icons/com.android.vending.png +``` + +### youtube tv + +- **~/scripts/start-youtube.sh** + +``` bash +# +#!/bin/bash +chromium --kiosk "https://www.youtube.com/tv?disable_polymer=true&vq=hd1080&persist_quality=true" \ + --user-agent="Mozilla/5.0 (Linux; Android 10; SHIELD Android TV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36" \ + --noerrdialogs --disable-infobars --disable-session-crashed-bubble \ + --autoplay-policy=no-user-gesture-required --start-fullscreen & +``` + + + +- **/.local/share/applications/youtube.desktop** + +``` bash +[Desktop Entry] +Type=Application +Name=YouTube +Exec=/home/mf/scripts/start-youtube.sh & +Icon=/home/mf/.local/share/waydroid/data/icons/com.android.vending.png +``` + +### gamepass + +- **~/scripts/start-gamepass.sh** + +``` bash +#!/bin/bash +edge start msedge --profile-directory="GamePass" --app=https://www.xbox.com/play --start-fullscreen +``` + +- **/.local/share/applications/gamepass.desktop** + +``` bash +[Desktop Entry] +Type=Application +Name=YouTube +Exec=/home/mf/scripts/start-gamepass.sh & +Icon=/home/mf/.local/share/waydroid/data/icons/com.android.vending.png +``` + +## System + +**OS:** proxmox pve (Debian Based) + +### Kde Plasma + +**Install:** + +``` bash +sudo sudo apt install kde-plasma +``` + +### Flatkpak + +**Install:** + +``` bash +sudo apt install flatpak +sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo +``` + +### pixp + +**Install:** + +``` bash +sudo apt install pipx pip +sudo mkdir -p /opt/virtual-smart-tv/pipx +sudo mkdir -p /opt/virtual-smart-tv/pipx/venvs +sudo mkdir -p /opt/virtual-smart-tv/pipx/bin +sudo chmod -R 755 /opt/pipx +``` + +```bash +# /etc/environment +PIPX_HOME="/opt/virtual-smart-tv/pipx/venvs" +PIPX_BIN_DIR="/opt/virtual-smart-tv/pipx/bin" +``` + +```bash +# /etc/profile.d/pipx.sh +export PIPX_HOME="/opt/virtual-smart-tv/pipx/venvs" +export PIPX_BIN_DIR="/opt/virtual-smart-tv/pipx/bin" +export PATH="$PIPX_BIN_DIR:$PATH" +``` + +``` bash +sudo chmod +x /etc/profile.d/pipx.sh +``` + +## G20S PRO - Remote Control + +### keys remaps + +- button - home - KEY_HOME - Present Windows (Current Desktop) +- button - light - KEY_COMPOSE -> KEY_LEFTMETA -> Andromeda launcher +- button - back - KEY_BACK -> KEY_ESC : So navigation on youtube and other apps is possible + +On kde settings-> keyboard -> shortcuts KWin -> Present Windows (Current Desktop) - set remote control key - Home + +### Setup + +#### evtest + +``` bash +sudo apt instal evtest +#check remote control events +sudo evtest +``` + +#### evdevremapkeys + +**Install:** + +``` bash +sudo env PIPX_HOME=/opt/virtual-smart-tv/pipx/venvs \ + PIPX_BIN_DIR=/opt/virtual-smart-tv/pipx/bin \ + pipx install evdevremapkeys +sudo /opt/virtual-smart-tv/pipx/bin/evdevremapkeys --list-devices | grep G20S +``` + +**/opt/virtual-smart-tv/evdevremapkeys.config:** + +``` bash +devices: + - input_phys: "b4:8c:9d:4f:e8:98" # set value from sudo $(which evdevremapkeys) --list-devices | grep G20S + output_name: "G20S PRO Remapped" + remappings: + KEY_BACK: + - KEY_ESC + KEY_COMPOSE: + - KEY_LEFTMETA +``` + +**Test Configuration:** + +``` bash +sudo /opt/virtual-smart-tv/pipx/bin/evdevremapkeys --config /opt/virtual-smart-tv/evdevremapkeys.config +``` + +**Register as service:** + +``` bash +# /etc/systemd/system/g20s-bluetooth-keys-remap.service +[Unit] +Description=Remap G20S buttons + +[Service] +Environment="PIPX_HOME=/opt/virtual-smart-tv/pipx/venvs" +Environment="PIPX_BIN_DIR=/opt/virtual-smart-tv/pipx/bin" +ExecStart=/opt/virtual-smart-tv/pipx/bin/evdevremapkeys --config /opt/virtual-smart-tv/evdevremapkeys.config + +[Install] +WantedBy=multi-user.target +``` + +``` bash +sudo systemctl daemon-reload +sudo systemctl enable g20s-bluetooth-keys-remap +sudo systemctl start g20s-bluetooth-keys-remap +sudo systemctl status g20s-bluetooth-keys-remap +``` + +#### HID definition - Patch and Rebind + +Thanks for: , for the real solution. + +``` bash +sudo apt install dkms +sudo apt install evtest +#sudo apt install dkms linux-headers-$(uname -r) +sudo apt install proxmox-headers-$(uname -r) +git clone https://github.com/stanford-scs/hid-g20s.git +cd hid-g20s +sudo ./install.sh +# should show the device and basic remote functions should be working + +cat /proc/bus/input/devices | grep G20S +#N: Name="G20S PRO" +sudo lsmod | grep g20s +# hid_g20s 12288 0 +# hid 253952 5 usbhid,hid_apple,hid_g20s,hid_generic,uhid +sudo dmesg | grep g20s +sudo lsmod | grep g20s +sudo evtest | grep G20S +sudo dkms status +# hid-g20s/1.0, 6.14.11-4-pve, x86_64: installed (Original modules exist) + +``` + +*Module loads on boot:** + +```bash +echo "hid-g20s" | sudo tee /etc/modules-load.d/hid-g20s.conf +``` + +``` bash +sudo systemctl restart bluetooth +``` + +Problem requires restart bluetooth after first connection to control for work (for example after reboot). Even service on boot not working correctly. +For now create desktop shortcut so i can run after reboot. + +- **/usr/local/bin/g20s-bluetooth-rebind.sh** + +``` bash +#!/bin/bash + +REMOTE_MAC="00:00:00:00:00:00" # Replace with your remote's MAC + +echo "starting..." + +# Wait until the remote is connected +until bluetoothctl info "$REMOTE_MAC" | grep -q "Connected: yes"; do + echo "Waiting for connection..." + sleep 2 +done + + +echo "Connected! sleep so restart happen only after full connection" +sleep 30 + +echo "Restarting Bluethooth" +# Restart Bluetooth to trigger HID rebind +systemctl restart bluetooth +``` + + ``` bash + chmod +x /usr/local/bin/g20s-bluetooth-rebind.sh + ``` + +``` bash +# /etc/systemd/system/g20s-bluetooth-rebind.service +[Unit] +Description=Restart Bluetooth after G20S remote connects + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/g20s-bluetooth-rebind.sh + + +[Install] +WantedBy=multi-user.target +```