maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   [Announce - #MCCXII] Timenow: Proximity enabled lock screen (https://talk.maemo.org/showthread.php?t=83682)

qwazix 2012-04-18 16:01

Re: [q] turn the screen on programmatically
 
So, after the marvellous ideas posted above I have a first, crude version. I don't know yet how much will suck your battery but I'm pretty excited and want to share it.

I know there are many things that should be improved like the commands that should not be in the loop because they are needed only once when the user locks the device (I tried hooking up to dbus-scripts lock event without success) but this is a first step. Also the backlight returns to 128 after unlocking and stays there whatever, but I haven't got around to that yet.

Script must be run as root. When you lock your device a dim time shows up just like on the N9 (with a huge pixelated font, but anyway)

Code:

while true
do
LOCK=$(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}')

if [ $LOCK == "locked" ]
then
    echo 0 > /sys/class/graphics/fb0/blank
    #uncomment this line for no backlight (darker image, less battery consumption)
    echo 2 > /sys/class/backlight/acx565akm/brightness
    d=`date '+%H:%M'`
    text2screen -t "$d" -s 10 -T 0xFFFFFF -B 0x000000 -x 50 -y 100
    sleep 2
else
  echo 128 > /sys/class/backlight/acx565akm/brightness
fi
done


retsaw 2012-04-18 17:29

Re: [q] turn the screen on programmatically
 
Nice start. You need to fix the LOCK= line in that code which I guess didn't copy and paste correctly. I tried using the dbus line to query lockstate from the wiki, but that always seems to return "unlocked" for me even when locked for both my N900s (could be something I've done, which I'll look into later). Anyway, I tried the middle part of the code over ssh and that's fine but the size of the time could be bigger.

qwazix 2012-04-18 17:39

Re: [q] turn the screen on programmatically
 
Yes, that's an error while copying from nano. Editing now. For the size change -s 10 to a number of your liking in the line starting with text2screen.
By the way after having the phone in my pocket for some time it started showing the time over the lockscreen, which is very nice because it shows the notifications too but I am trying to reproduce it some time now and I can't.

qwazix 2012-04-18 21:21

Re: [q] turn the screen on programmatically
 
Quote:

Originally Posted by MohammadAG (Post 1193815)

Optionally, this enables the touchscreen.
Code:

echo 0 > /sys/devices/platform/omap2_mcspi.1/spi1.0/disable_ts

I modified the script to mimic more the N9 behaviour and unlock with double click. So far I've been able to configure xbindkeys to detect double taps and run a script, to run xbindkeys when locked and kill it when unlocked, but when I do double tap on the "idle" screen nothing happens (xbindkeys does not notice any taps, I can see the verbose console output afterwards) does this happen because the screen is painted with the framebuffer? should xbindkeys register something? Of course I have included the above line in the script.

qwazix 2012-04-18 22:14

Re: [q] turn the screen on programmatically
 
It seems that I overdid it and took care of things I shouldn't. This one works better, as it doesn't mess with default brightness settings

Code:

while true
do
LOCK=$(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}')
if [ $LOCK == "locked" ]
then
    echo 0 > /sys/class/graphics/fb0/blank
    echo 2 > /sys/class/backlight/acx565akm/brightness
    d=`date '+%H:%M'`
    text2screen -t "$d" -s 10 -T 0xFFFFFF -B 0x000000 -x 50 -y 100
    sleep 2
fi
done

I also tried to convert some bmp's to raw images for catting to fb0 with a bmp2raw I found somewhere on the net but it dumps the image scrambled. I suppose that the framebuffer doesn't have 800x480 resolution as the image doesn't fill up the screen.

That's all for now. Time to go to bed.

MohammadAG 2012-04-18 22:46

Re: [q] turn the screen on programmatically
 
Quote:

Originally Posted by qwazix (Post 1194053)
I modified the script to mimic more the N9 behaviour and unlock with double click. So far I've been able to configure xbindkeys to detect double taps and run a script, to run xbindkeys when locked and kill it when unlocked, but when I do double tap on the "idle" screen nothing happens (xbindkeys does not notice any taps, I can see the verbose console output afterwards) does this happen because the screen is painted with the framebuffer? should xbindkeys register something? Of course I have included the above line in the script.

Did you enable the touchscreen with my last command in the first post? The display can be on with the ts off.

ammyt 2012-04-18 22:53

Re: [q] turn the screen on programmatically
 
Quote:

Originally Posted by MohammadAG (Post 1193856)
If you're not interested in the UI you can play a video in mplayer as well.
Code:

mplayer -vo fbdev videofile

Hehehe, a bit too much for a standby screen eh? :D

qwazix 2012-04-18 22:58

Re: [q] turn the screen on programmatically
 
Quote:

Originally Posted by MohammadAG (Post 1194079)
Did you enable the touchscreen with my last command in the first post? The display can be on with the ts off.

Yes I did that, but still xbindkeys does not read anything. Also the script eats too much cpu so I'll have to make it work with dbus-scripts. Maybe a sleep of a couple of seconds before issuing the commands would help

woody14619 2012-04-19 22:46

Re: [q] turn the screen on programmatically
 
Quote:

Originally Posted by qwazix (Post 1194087)
Yes I did that, but still xbindkeys does not read anything. Also the script eats too much cpu so I'll have to make it work with dbus-scripts. Maybe a sleep of a couple of seconds before issuing the commands would help

Have you considered using Queen Bee Widget with it? It has dbus monitoring, and can be set to do periodic updates. I don't know if they still get time updates when hildon is alseep, but may be worth a try. I'll give it a shot tonight and let you know how things work if I get a chance. :)

Edit:
In fact, yes... it does work.

I stripped the shell script to:
Code:

#!/bin/sh

LOCK=$(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}')

time=`date '+%I:%M'`
day=`date '+%m/%d/%y'`
till=3600

if [ $LOCK == "locked" ]
then
    echo "echo 0 > /sys/class/graphics/fb0/blank" | sudo gainroot >/dev/null
    #echo 2 > /sys/class/backlight/acx565akm/brightness
    text2screen -t "$time" -s 10 -T 0xFFFFFF -B 0x000000 -x 50 -y 100
    text2screen -t "$day" -s 10 -T 0xFFFFFF -B 0x000000 -x -600 -y 350
    till=30;
fi

if [ $2 == "QBW_DBUS_MONITOR"  -o $till -gt 100  ]
then
    id="/oh/no/more/qbw"$1
    dbus-send --session --type=method_call --dest=oh.no.more.qbw $id oh.no.more.qbw.set_param_uint32 string:'delayIndex' uint32:9 string:''
    dbus-send --session --type=method_call --dest=oh.no.more.qbw $id oh.no.more.qbw.set_param_uint32 string:'customIntervalSecs' uint32:$till string:''
    dbus-send --session --type=method_call --dest=oh.no.more.qbw $id oh.no.more.qbw.reset_rearm_timer
fi


return 0

The QBW widget I setup is here:

Code:

[queen-beecon-header]
version=1.000000
checksum=3330600
[queen-beecon-exported-instance]
widgetType=0
widgetVisible=0
operationalStatus=0
hideCanvas=true
hideClickCanvas=true
snippetBgRGB=0
snippetExtBgRGB=#000000000000
beecon_lt0_ImgZoom=0
beecon_lt0_BgRGB=2
beecon_lt0_ExtBgRGB=#808080808080
beecon_lt0_ImgFilename=queen-beecon-syserr.png
beecon_eq0_ImgZoom=0
beecon_eq0_BgRGB=3
beecon_eq0_ExtBgRGB=#0000ffff0000
beecon_eq0_ImgFilename=queen-beecon-appok.png
beecon_eq1_ImgZoom=0
beecon_eq1_BgRGB=4
beecon_eq1_ExtBgRGB=#ffffffff0000
beecon_eq1_ImgFilename=queen-beecon-appwrn.png
beecon_ge2_ImgZoom=0
beecon_ge2_BgRGB=5
beecon_ge2_ExtBgRGB=#ffff00000000
beecon_ge2_ImgFilename=queen-beecon-apperr.png
beecon_idxge2_ImgZoom=0
beecon_idxge2_BgRGB=11
beecon_idxge2_ExtBgRGB=#0000ffffffff
beecon_idxge2_ImgFilename=queen-beecon-index.png
widWidth=64.509316770186331
widHeight=64.551083591331263
instanceTitle=screen-time
instanceCmd=/root/scripts/scrlockclock.sh
rememberMe=
cmdImgFilename=queen-beecon.png
cmdImgAngle=0
cmdImgZoom=0
cmdFgRGB=1
cmdExtFgRGB=#ffffffffffff
cmdTextAngle=0
cmdVisibilityPosition=2
cmdImgVisibilityPosition=5
cmdJustify=0
cmdExtFont=Nokia Sans bold italic 12
cmdFontName=3
cmdFontSize=12
resImgFilename=queen-beecon-resimg.png
resImgAngle=0
resImgZoom=0
resFgRGB=1
resExtFgRGB=#ffffffffffff
resTextAngle=0
resVisibilityPosition=8
resImgVisibilityPosition=3
resJustify=0
resExtFont=Nokia Sans Cn  10
resFontName=16
resFontSize=10
resWrapLongLines=false
progressAnimationFrames=4
progressAnimationTimer=4
progressAnimationPos=4
progressAnimationAtClickXY=false
progressAnimationBasename=queen-beecon-progress
updOnStartup=false
updOnClick=false
multiClick=false
updOnDesktop=false
updOnSight=false
updOnOrientation=false
delayIndex=1
customIntervalSecs=0
updNeworkPolicy=0
GPSsettings=0
updOnDBUS=1
updOnDBUSBus=0
updOnDBUSMatchRule=type='signal',path='/com/nokia/mce/signal',interface='com.nokia.mce.signal',member='tklock_mode_ind'


qwazix 2012-04-20 09:34

Re: [q] turn the screen on programmatically
 
Another idea is to build images with imagemagick and have them displayed on the framebuffer with mplayer, so that icons, better fonts etc are possible. I'll look into it probably in the weekend


All times are GMT. The time now is 16:44.

vBulletin® Version 3.8.8