Reply
Thread Tools
Posts: 8 | Thanked: 7 times | Joined on Jul 2010
#1
Hi,

I know that the N900 can be set to lock after 5, 10, 30, or 60 minutes, or not lock at all, but I can't figure out how to make it only lock at startup. If I disable autolock, it never asks for the lock code. Is this even possible? I know it was on the N800.

Thanks,
Ian
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#2
Hi,

Originally Posted by purrcatian View Post
I know it was on the N800.
Nope. The N900 copied the N800's behaviour in this regard.

MCE/SystemUI along with most of Maemo are closed, so you can't modify them to introduce such an option.

You can, however, tell them to lock the tablet externally.

Hack #1:
Of course with autolock disabled, make a file called /etc/event.d/lock with its contents thus:
Code:
description "Locks da phone"

start on started hildon-desktop

console none

script
	run-standalone.sh /usr/bin/dbus-send --system --type=method_call --dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.devlock_open string:'com.nokia.mce' string:'/com/nokia/mce/request' string:'com.nokia.mce.request' string:'devlock_callback' uint32:'3'
end script

service
The downside of this method is that it'll lock once the desktop is showing, with a window of 3 seconds allowing somebody to launch a shortcut placed on the desktop.

Hack #2:
Of course with autolock disabled, make a file called /etc/X11/Xsession.d/52lock with its contents thus:
Code:
#!/bin/sh

#set +x

monitor()
{
	run-standalone.sh dbus-monitor --system type='signal',path='/com/nokia/mce/signal',interface='com.nokia.mce.signal',member='devicelock_mode_ind' | awk '/string "/ {print $2; fflush() }' | 
	{
		while read line; do
			if echo $line | grep -q ":"; then
				DBUS_MONITOR_PID=$(echo $line | sed s/\"//g)
			fi

			if grep -q "unlocked"; then
				kill $(run-standalone.sh dbus-send --system --print-reply=literal --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID string:$DBUS_MONITOR_PID | awk '{print $2; fflush()}')
				exit 0
			fi
		done
	}
}

main()
{
#	SLIDE_STATE=`cat /sys/devices/platform/gpio-switch/slide/state`
#	if [ x"$SLIDE_STATE" = "xopen" ]; then
#		exit 0
#	fi

	/usr/sbin/waitdbus system
	local result=$(/usr/bin/run-standalone.sh /usr/bin/dbus-send --print-reply=literal --system --type=method_call --dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.devlock_open string:'com.nokia.mce' string:'/com/nokia/mce/request' string:'com.nokia.mce.request' string:'devlock_callback' uint32:'3' | awk '{print $2}')
	if [ x"$result" = "x1" ]; then
		monitor
	fi
}

main
However, I really, really do not recommend Hack #2; a possible race condition could occur (more than likely) in which the device is unlocked before dbus-monitor is started, resulting in the script waiting to receive the "unlocked" message...
If your curiosity prevails, at least uncomment the SLIDE_STATE lines so that you have a way of escaping the script.
You could probably modify one of my DBus-GLib examples to make something more robust.

Oh Closed Maemo, your possibilities for customisation are endless...
 

The Following 3 Users Say Thank You to qwerty12 For This Useful Post:
Zas's Avatar
Posts: 196 | Thanked: 113 times | Joined on Jun 2010 @ Finland
#3
Is there a way to manually set the lock time to say 24 hours or more by using xterm?
 

The Following User Says Thank You to Zas For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#4
Originally Posted by Zas View Post
Is there a way to manually set the lock time to say 24 hours or more by using xterm?
Hmm, that makes sense...

Try this:
gconftool -s -t bool /system/osso/dsm/locks/devicelock_autolock_enabled true
gconftool -s -t int /system/osso/dsm/locks/devicelock_autolock_timeout 1440

I haven't tried this myself, but the values set to the key /system/osso/dsm/locks/devicelock_autolock_timeout by the applet suggest it takes a value of minutes.

Oh, one thing to note: When the autolock is disabled, the timeout does get set to 1000 minutes.
 

The Following 2 Users Say Thank You to qwerty12 For This Useful Post:
Posts: 1,224 | Thanked: 1,763 times | Joined on Jul 2007
#5
Trying to combine upstart and gconf:
Why not use upstart to enable autolock early during boot, and disable it after mce already locks the device on startup. This should give the requested behaviour, assumig mce does not unlock the device when autolock is disabled.
__________________
My repository

"N900 community support for the MeeGo-Harmattan" Is the new "Mer is Fremantle for N810".

No more Nokia devices for me.
 

The Following User Says Thank You to Matan For This Useful Post:
Posts: 8 | Thanked: 7 times | Joined on Jul 2010
#6
Thanks for all of the quick and informitive responces. Qwerty12's solution worked great.
 
Posts: 22 | Thanked: 22 times | Joined on Jul 2010
#7
Indeed Matan, this one works for me:
Code:
start on startup
stop on starting hildon-desktop

console none

pre-start script
  /usr/bin/gconftool -s -t bool /system/osso/dsm/locks/devicelock_autolock_enabled true
end script

pre-stop script
  /usr/bin/gconftool -s -t bool /system/osso/dsm/locks/devicelock_autolock_enabled false
end script

service
Throw it into /etc/event.d/ and you're done.
 

The Following 2 Users Say Thank You to tjsgls For This Useful Post:
Posts: 140 | Thanked: 20 times | Joined on Apr 2011
#8
This is great stuff!

Is is possible to have the device lock with SMS? Like in Symbian, you could preset a secret text and upon sending it to the phone it would lock.

Also the qwerty12 suggestion in Hack#1 that worked: could someone please explain in plain language what to do in steps? Thanks in advance!
 
Posts: 65 | Thanked: 8 times | Joined on Jul 2010
#9
Originally Posted by Discoveryellow View Post
This is great stuff!

Is is possible to have the device lock with SMS? Like in Symbian, you could preset a secret text and upon sending it to the phone it would lock.

Also the qwerty12 suggestion in Hack#1 that worked: could someone please explain in plain language what to do in steps? Thanks in advance!
Hmm.. I beleive this should cheer you up

http://talk.maemo.org/showthread.php?t=60729
 
Reply


 
Forum Jump


All times are GMT. The time now is 13:12.