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
On console
while true; do adb shell input keyevent mouse ; sleep 1 ; done