Android Remote Control

A completely open-source solution, partly stimulated by TeamViewer's aggressive approach to classify personal users as commercial users. Btw, Chrome Remote Desktop is recommended for desktop remote control.

repos:

Genymobile/scrcpy: Display and control your Android device

Optional for audio:

rom1v/sndcpy: Android audio forwarding (scrcpy, but for audio)

Windows client

.bat file

C:\repo\scrcpy-win64-v1.17\adb.exe disconnect
C:\repo\scrcpy-win64-v1.17\adb.exe connect 10.0.0.6:5555
start C:\repo\scrcpy-win64-v1.17\scrcpy.exe --turn-screen-off --stay-awake
cd C:\repo\sndcpy-with-adb-windows-v1.0\
start sndcpy

or hide the consoles with .vbs file

Set objShell = CreateObject ("Wscript.Shell")
objShell.Run "cmd /c C:\repo\scrcpy-win64-v1.17\adb.exe connect 10.0.0.6:5555", 0, false
objShell.Run "cmd /c C:\repo\scrcpy-win64-v1.17\scrcpy.exe --turn-screen-off --stay-awake", 0, false

Set objShell2 = CreateObject ("Wscript.Shell")
objShell2.CurrentDirectory = "C:\repo\sndcpy-with-adb-windows-v1.0\"
objShell2.Run "cmd /c sndcpy", 0, false

Note the directory is specified for sndcpy due to its implementation requirements.

VLC is required to play the sound on client. To suppress the 'Enter' input requirement, comment out the following line in sndcpy.bat if you are using Windows

pause >nul

or in sndcpy if you are using Linux or alike.

read dummy

Optional: Android adb tcp server auto start on boot

I use Magisk so to simply things I just put the following .sh script to /data/adb/service.d. Any equivalence will do.

setprop service.adb.tcp.port 5555
stop adbd
start adbd

The port can be customized, but would result some apps to function abnormally, such as Brevent.

Reference

networking - How can I connect to Android with ADB over TCP? - Stack Overflow

shell - How can I run a script on boot? - Android Enthusiasts Stack Exchange