Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Can the N900 be set to only lock at startup?

    Reply
    purrcatian | # 1 | 2010-07-24, 06:53 | Report

    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    qwerty12 | # 2 | 2010-07-24, 15:29 | Report

    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...

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 3 Users Say Thank You to qwerty12 For This Useful Post:
    dana.s, moepda, vkv.raju

     
    Zas | # 3 | 2010-07-24, 16:37 | Report

    Is there a way to manually set the lock time to say 24 hours or more by using xterm?

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to Zas For This Useful Post:
    moepda

     
    qwerty12 | # 4 | 2010-07-24, 16:47 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to qwerty12 For This Useful Post:
    jbd, Zas

     
    Matan | # 5 | 2010-07-24, 17:00 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to Matan For This Useful Post:
    moepda

     
    purrcatian | # 6 | 2010-07-24, 21:55 | Report

    Thanks for all of the quick and informitive responces. Qwerty12's solution worked great.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    tjsgls | # 7 | 2010-07-25, 07:45 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to tjsgls For This Useful Post:
    dchky, ToJa92

     
    Discoveryellow | # 8 | 2011-08-03, 05:48 | Report

    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!

    Edit | Forward | Quote | Quick Reply | Thanks

     
    n900ak | # 9 | 2011-08-03, 05:58 | Report

    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
vBulletin® Version 3.8.8
Normal Logout