View Single Post
laasonen's Avatar
Posts: 565 | Thanked: 618 times | Joined on Jun 2010 @ Finland
#4
Wrote simple script which unlocks the device when you click the power button when it's connected to the wlan you specified
Code:
#!/bin/sh
homeESSID="Home_1" #Set up your ESSID

while true; do
	cat /dev/input/pwrbutton | echo "Waiting.."
	echo "Trying to open.."
	if [ `iwconfig wlan0 | grep ESSID | awk -F'"' '{print $2}'` = $homeESSID ];	then
		if [ `cat /sys/class/backlight/acx565akm/brightness` = "0" ]; then
			sleep 1
			dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:"unlocked"
			dbus-send --system --type=method_call --dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.devlock_close string:"com.nokia.mce" string:"/com/nokia/mce/request" string:"com.nokia.mce.request" string:"devlock_callback" uint32:'0'
			echo "..opened";
		else 
			echo "..not locked!";
		fi
	else 
		echo "..not in home network!";
	fi
done
You need to run it as root, because user can't read /dev/input/pwrbutton
Comment the first dbus-send, if you miss the slider.

EDIT: Now it checks if the screen is unlocked already.

Last edited by laasonen; 2011-04-04 at 22:58.
 

The Following 5 Users Say Thank You to laasonen For This Useful Post: