@echo off
setlocal EnableExtensions
cd /d "%~dp0\.."
set "ADB=platform-tools\adb.exe"

echo TECHNOZON X11: close TCP ADB now
echo Connect the TV box by USB before continuing.
echo.

"%ADB%" shell su 0 sh -c "setprop persist.adb.tcp.port -1; setprop persist.sys.wifi.adb 0; setprop service.adb.tcp.port -1; settings put global adb_wifi_enabled 0; stop adbd; start adbd"
if errorlevel 1 (
  echo ERROR: USB ADB or root is unavailable.
  pause
  exit /b 1
)

echo TCP ADB is closed. USB debugging was not intentionally disabled.
pause
