@echo off ::::::::::::::: Configurations :::::::::::::::::::: set max=10000 set "PWR_EVENT=event0" set "FTS_EVENT=event1" set "IIC_NODE=/sys/bus/i2c/devices/3-0038" :::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::: Constants ::::::::::::::::::::::::::: set KEY_POWER=116 set EV_ABS=3 set EV_KEY=1 set EV_SYN=0 set SYN_REPORT=0 set KEY_F17=187 set KEYCODE_POWER=26 set BTN_TOUCH=330 set BTN_TOOL_DOUBLETAP=333 set ABS_MT_POSITION_X=53 set ABS_MT_POSITION_Y=54 set ABS_MT_TOOL_TYPE=55 set ABS_MT_SLOT=47 set ABS_MT_TRACKING_ID=57 set "RW_REG=fts_rw_reg" :::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::: Variables ::::::::::::::::::::: set "TO_NUL= >NUL 2>NUL" set DEBUG=0 ::::::::::::::::::::::::::::::::::::::::::::::::: echo 请插入您的手机 adb wait-for-device call open-i2c.bat if "%1" == "cmd" ( @echo on set DEBUG=2 set "TO_NUL=" ) if "%1" == "dbg" ( set "TO_NUL=" set DEBUG=1 ) echo Open Screen call :ScreenOn set counter=1 :TestBody echo ----- Test No. %counter% ------ call :delay_sec 1 echo [%counter%]Close Screen call :ScreenOff REM one second 100% error REM two second is ok call :delay_sec 2 call :ScreenOn set /a counter+=1 if not %counter%==%max% goto TestBody goto END :ScreenOn adb shell sendevent /dev/input/%PWR_EVENT% %EV_KEY% %KEY_POWER% 1 adb shell sendevent /dev/input/%PWR_EVENT% %EV_SYN% %SYN_REPORT% 0 call :delay_ms 3000 adb shell sendevent /dev/input/%PWR_EVENT% %EV_KEY% %KEY_POWER% 0 adb shell sendevent /dev/input/%PWR_EVENT% %EV_SYN% %SYN_REPORT% 0 goto :EOF :ScreenOff adb shell input keyevent %KEYCODE_POWER% goto :EOF :TapTP set x=%1 set y=%2 adb shell sendevent /dev/input/%FTS_EVENT% %EV_ABS% %BTN_TOUCH% 1 adb shell sendevent /dev/input/%FTS_EVENT% %EV_ABS% %ABS_MT_SLOT% 0 adb shell sendevent /dev/input/%FTS_EVENT% %EV_ABS% %ABS_MT_TRACKING_ID% %trkid% adb shell sendevent /dev/input/%FTS_EVENT% %EV_ABS% %ABS_MT_POSITION_X% %x% adb shell sendevent /dev/input/%FTS_EVENT% %EV_ABS% %ABS_MT_POSITION_Y% %y% adb shell sendevent /dev/input/%FTS_EVENT% %EV_SYN% %SYN_REPORT% 0 adb shell sendevent /dev/input/%FTS_EVENT% %EV_ABS% %ABS_MT_SLOT% 0 adb shell sendevent /dev/input/%FTS_EVENT% %EV_ABS% %ABS_MT_TRACKING_ID% -1 adb shell sendevent /dev/input/%FTS_EVENT% %EV_ABS% %BTN_TOUCH% 0 adb shell sendevent /dev/input/%FTS_EVENT% %EV_SYN% %SYN_REPORT% 0 set /a trkid+=1 goto :EOF :delay_ms if %DEBUG% GEQ 1 echo delay %1 ms echo Wscript.Sleep WScript.Arguments(0) >%tmp%\delay.vbs if %DEBUG% EQU 2 echo %time% cscript //b //nologo %tmp%\delay.vbs %1 if %DEBUG% EQU 2 echo %time% goto :EOF :delay_sec if %DEBUG% GEQ 1 echo delay %1 sec ping 127.0.0.1 -n %1 %TO_NUL% goto :EOF :END
<Android/Windows> bat脚本自动开关屏
猜你喜欢
转载自blog.csdn.net/meta_cpp/article/details/78722582
今日推荐
周排行