maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   MeeGo / Harmattan (https://talk.maemo.org/forumdisplay.php?f=45)
-   -   Security lock on the Nokia N9 (https://talk.maemo.org/showthread.php?t=85373)

rainisto 2013-02-02 10:45

Re: Security lock on the Nokia N9
 
#!/bin/sh
/usr/bin/gconftool-2 --type=int --set /system/osso/dsm/display/inhibit_blank_mode 3
/usr/bin/gconftool-2 --type=int --set /schemas/system/osso/dsm/display/inhibit_blank_mode 3
/usr/bin/gconftool-2 --type=int --set /system/osso/dsm/display/display_blank_timeout 600000000
/usr/bin/gconftool-2 --type=int --set /schemas/system/osso/dsm/display/display_blank_timeout 600000000
/usr/bin/gconftool-2 --type=int --set /system/osso/dsm/display/display_dim_timeout 600000000
/usr/bin/gconftool-2 --type=int --set /schemas/system/osso/dsm/display/display_dim_timeout 600000000
/usr/bin/gconftool-2 --type=bool --set /system/osso/dsm/locks/touchscreen_keypad_autolock_enabled false

This only works if you do not have mail for exchange setup with forced values. There is a way to disable the timeout force on mfe too, but that requires you to hack devicelockd and clear the force bits, so that is another story and too complicated for most people to do.

Eztran 2013-02-02 14:40

Re: Security lock on the Nokia N9
 
The thing with the above is that it will also mean having a screen that will never timeout at all, so you have to lock it manually all the time.

I was looking for a setting like in Settings>Security>Device lock>Autolock, where you can adjust the time before the security lock engages without changing the screen timeout (which I think is what solbrit was looking for, if not the OP).

solbrit 2013-02-02 20:22

Re: Security lock on the Nokia N9
 
Thankyou for replying rainisto!

As Eztran points out it is a drawback though that this adresses the problem by changing the screen timeout settings...

It's a shame that this isn't as easy as on the N900 where you could change the devicelock-autolock timeout to whatever you liked. I actually prefer the devicelock kicking in after a while, but one hour is too short.

solbrit 2013-02-08 16:20

Re: Security lock on the Nokia N9
 
And btw, if you set the screen to never timeout as suggested and lock it manually you'll still get the security lock after x minutes as usual...

solbrit 2013-02-10 09:26

Re: Security lock on the Nokia N9
 
I just stumbled upon this.

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

With a way to enable the security lock from command line it's easy to write a script to check if the screen is locked (or one that checks for screen input, if you prefer) for x time and if true enable the security lock, and have the script run a constant loop.

Code:

#!/bin/bash

/usr/bin/devicelock-enable --lock-screen

# Sleep time 20 --> 3 lines/minute if screen locked
while true; do sleep 20 &&

if dbus-send --system --type=method_call --dest="com.nokia.mce" --print-reply "/com/nokia/mce/request" com.nokia.mce.request.get_tklock_mode|awk -F "\"" '/g/ {print $2}' | grep -q 'unlocked'

then
> /path/to/sec-lock.log

else
echo "Screen locked..." >> /path/to/sec-lock.log

fi

# Check if sec-lock.log is full (3 lines/minute --> 120 minutes = 360 lines)
if [ 360 -eq "$(wc -l < /path/to/sec-lock.log)" ]

then
> /path/to/sec-lock.log && /usr/bin/devicelock-enable --lock-screen

fi;

done

This will enable the security lock once initially and then keep locking it after two hours if the screen isn't unlocked during that time. You can use it in /etc/init/apps to enable it from boot (what OP was going for would be running only the first line on boot).

solbrit 2013-03-29 01:38

Re: Security lock on the Nokia N9
 
This might be a bit more interesting. It enables the security lock after 30 minutes if the phone's neither charging nor connected through wifi, both of which only occur, in my case, when at home.

Code:

#!/bin/bash

# Enable device lock on boot
/usr/bin/devicelock-enable

# Sleep time 20 --> 3 lines/minute if discharging, not connected to wlan and screen locked
while true; do sleep 20 &&

if
lshal | grep -q 'battery.rechargeable.is_charging = true'

then
> /opt/sec-lock/sec-lock.log

elif dbus-send --system --type=method_call --dest="com.nokia.mce" --print-reply "/com/nokia/mce/request" com.nokia.mce.request.get_tklock_mode|awk -F "\"" '/g/ {print $2}' | grep -q 'unlocked'

then
> /opt/sec-lock/sec-lock.log

elif /usr/sbin/iw dev wlan0 link | grep -q 'Connected to'

then
> /opt/sec-lock/sec-lock.log

else
echo "Screen locked..." >> /opt/sec-lock/sec-lock.log

fi

# Check if sec-lock.log is full (3 lines/minute --> 30 minutes = 90 lines)
if [ 90 -eq "$(wc -l < /opt/sec-lock/sec-lock.log)" ]

then
> /opt/sec-lock/sec-lock.log && /usr/bin/devicelock-enable

fi;

done



All times are GMT. The time now is 15:18.

vBulletin® Version 3.8.8