Files
virtual-smart-tv/README.md
2025-10-27 20:34:45 +00:00

351 lines
8.0 KiB
Markdown

# Virtual Smart TV
- [Apps](#apps)
- [Steam](#steam)
- [Greenlight](#greenlight)
- [Microsoft Edge](#microsoft-edge)
- [youtube tv](#youtube-tv)
- [gamepass](#gamepass)
- [System](#system)
- [Kde Plasma](#kde-plasma)
- [flatpak](#flatpak)
- [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:**
- Flatpak
**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
```
### Greenlight
**Requirements:**
- Flatpak
**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
Categories=Game;smart-tv;
```
### Microsoft Edge
**Install:**
``` bash
sudo apt install software-properties-common apt-transport-https ca-certificates curl -y
curl -fSsL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/microsoft-edge.gpg > /dev/null
echo 'deb [signed-by=/usr/share/keyrings/microsoft-edge.gpg] https://packages.microsoft.com/repos/edge stable main' | sudo tee /etc/apt/sources.list.d/microsoft-edge.list
sudo apt install microsoft-edge-stable
sudo apt install wtype #requires to force youtube rebresh on load
```
**Run:**
``` bash
microsoft-edge-stable
```
### youtube tv
Added as an edge app to <https://youtbe.com/tv>. added --start-fullscreen argument.
Requires edge plugin "youtube tv on pc".
Plugin only works correcly if other instance of edge is running for example for gamepass.
### 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
```
### flatpak
**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: <https://github.com/stanford-scs/hid-g20s>, 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)
# check if is aplyed
sudo modinfo hid_g20s | grep description
description: G20S Bluetooth Remote HID driver with fixed descriptor and key remapping
```
*Module loads on boot:**
```bash
echo "hid-g20s" | sudo tee /etc/modules-load.d/hid-g20s.conf
```
``` bash
#/etc/udev/rules.d/99-hid-g20s.rules
# Automatically load hid-g20s driver for G20S Bluetooth Remote
# This rule triggers when the G20S device is detected and loads the custom driver
SUBSYSTEM=="hid", ATTRS{modalias}=="hid:b0005g0001v00001D5Ap0000C081", \
RUN+="/sbin/modprobe hid-g20s"
# Alternative rule that matches on vendor/product ID
SUBSYSTEM=="bluetooth", ATTR{product}=="0xc081", ATTR{vendor}=="0x1d5a", \
RUN+="/sbin/modprobe hid-g20s"
#ACTION=="add", SUBSYSTEM=="hid", ATTRS{name}=="G20S", RUN+="/sbin/modprobe -r hid_g20s; /sbin/modprobe hid_g20s"
```
**Problem - requires restart bluetooth -** after first connection for remote control to work (for example after reboot).
*Remote Control must be in connected bluethooth state.*
- **/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 "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=Bluetooth rebind after SDDM greeter appears
After=display-manager.service
Requires=display-manager.service
ConditionPathExists=!/run/g20s-bluetooth-rebind.done
[Service]
Type=oneshot
ExecStart=/usr/local/bin/g20s-bluetooth-rebind.sh
ExecStartPost=/bin/touch /g20s-bluetooth-rebind.done
RemainAfterExit=yes
[Install]
WantedBy=graphical.target
```
``` bash
sudo systemctl daemon-reload
sudo systemctl enable g20s-bluetooth-rebind
sudo systemctl start g20s-bluetooth-rebind
sudo systemctl status g20s-bluetooth-rebind
```