Android OS2.2 used to have an option under Settings/Applications/Development to disable screen lock during USB debugging. After upgrading my Samsung Galaxy S to OS2.3.3 this
I created simple shell script for my macOS
File Name : cell-screen.sh
#!/bin/sh
echo '`cell-screen on` to keep the screen on during usb debugging'
echo '`cell-screen off` to reset'
echo ''
echo 'your parameter - ' $1
if [[ "$1" = "on" ]]; then
~/Library/Android/sdk/platform-tools/adb shell settings put global stay_on_while_plugged_in 2
elif [[ "$1" = "off" ]]; then
~/Library/Android/sdk/platform-tools/adb shell settings put global stay_on_while_plugged_in 0
else
echo '\n[****]Bad Input.'
fi
echo '\nEnd'
Steps:
/Users/[your username]chmod +x ~/cell-screen.sh~/cell-screen.sh on~/cell-screen.sh offFor Windows Users:
Change the shell script for the adb location - %LOCALAPPDATA%\Android\sdk\platform-tools\adb