Reply
Thread Tools
stopgap's Avatar
Posts: 139 | Thanked: 135 times | Joined on Jan 2010 @ Cambridgeshire, UK
#1
I have the autolock set to 10 minutes with code to unlock, which is great as a device with this much personal data on needs at least that sort of protection when one is out and about.

I was wondering if there is any way to trigger a script before the auto-lock happens? I'd like to be able to specify wlan connections which are "home" so that the locking just doesn't happen when connected to one of those.

Is there an event handler for this? Does anyone know how I might achieve this?
 
Posts: 183 | Thanked: 115 times | Joined on Nov 2007 @ Seattle, WA
#2
You could write a script that disables the autolock when you connect to a home network and re-enables it when you disconnect. As an example, here's a script I use to create a reverse SSH tunnel when I get to work. It is located in /etc/network/if-up.d.

Code:
#!/bin/sh

iwgetid|grep -q CENPA
if [ $? -eq 0 ]; then
   su -c /home/user/bin/LinkOffice.sh user
fi
Just replace "CENPA" with the name or the wireless network and "su -c . . ." with the command to disable the auto-lock (you'll have to find that on your own).
Then put a script in /etc/network/if-down.d (or maybe /etc/network/if-post-down.d?) to enable the auto-lock.
 

The Following User Says Thank You to baksiidaa For This Useful Post:
Posts: 540 | Thanked: 288 times | Joined on Sep 2009
#3
The GConf key is (probably) "/system/osso/dsm/locks/devicelock_autolock_enabled" (boolean type), you can set it either via gconf-client or make a simple python program that uses python-gconf to set it.
 

The Following 2 Users Say Thank You to rambo For This Useful Post:
Guest | Posts: n/a | Thanked: 0 times | Joined on
#4
I've created a script just like this but it seems that the part in if-down.d (and if-post-down.d) is run after if-up.d. The phone therefore connects to my "safe" wlan before it disconnects from the "unsafe" gprs. The result is that devicelock_autolock_enabled first is set to false, then to true. I was thinking about adding a delay of some sort to the if-up.d but I don't really like that solution. Any ideas? I would really like to have something in if-post[-down].d to make sure autolock is enabled when a connection is lost and no other connection is established.

For people wanting to create scripts like these, here is the information I've found so far:
Code:
# Get the autolock status (true or false)
gconftool-2 --get /system/osso/dsm/locks/devicelock_autolock_enabled
# Set the autolock status to for example true
gconftool-2 --set --type boolean /system/osso/dsm/lock/devicelock_autolock_enabled true
Scripts run in /etc/network/if-up.d etc have access to $ICD_CONNECTION_ID, which contains the access point ID. You also have access to $IFACE, $MODE and $PHASE. $MODE tell you if the script is run because of a "stop" or a "start".
Code:
# List all the registered internet access points IDs:
gconftool-2 --all-dirs /system/osso/connectivity/IAP
# Get an access point's name:
gconftool-2 -g /system/osso/connectivity/IAP/$ICD_CONNECTION_ID/name
 
Reply


 
Forum Jump


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