#!/bin/bash #RESOLUTION="1280x720" RESOLUTION="1920x1080" VIDEODEV="/dev/video10" function unlock { ### Activates the screen and unlocks the phone # Reads the current screen state eturns any combination of ON/OFF and # LOCKED/UNLOCKED (i.e. OFF_LOCKED). # Works only on NFC enabled phones but alternative methods exist. IFS='_' read -ra screenstate <<< $(adb shell dumpsys nfc | awk -F'=' \ '/mScreenState/ {print $2}') # Emulate Power-Button press if screen is OFF. [[ ${screenstate[0]} == "OFF" ]] && adb shell input keyevent 26 && \ echo Screen activated # Emulate Menu-button press if phone is locked. Requires the phone to # unlock without PIN or password. [[ ${screenstate[1]} == "LOCKED" ]] && adb shell input keyevent 82 && \ echo Device unlocked } function blank { ### Blanks the screen after X seconds sleep ${1} IFS='_' read -ra screenstate <<< $(adb shell dumpsys nfc | awk -F'=' \ '/mScreenState/ {print $2}') [[ ${screenstate[0]} == "ON" ]] && adb shell input keyevent 26 && \ echo Screen deactivated } # Unlock phone unlock