|
![]() |
|
Thread Tools | Search this Thread |
![]() |
#1 |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
![]()
On some KUAL apps (like "draw"), physical power button has been used on KindleTouch and PW to execute some commands, like exiting the program. This was a bit annoying, because put the device into screensaver mode and user had to wake up the device later, by hand. To avoid this, just add to dbus-monitor event commands this one:
Code:
lipc-set-prop com.lab126.powerd powerButton 1 Sample KUAL app attached ("draw", renamed to "whiteboard" for the occasion) App script: Code:
#!/bin/sh SSSTATE=`lipc-get-prop com.lab126.powerd preventScreenSaver` lipc-set-prop com.lab126.powerd preventScreenSaver 0 /usr/bin/xtestlab126 & ( dbus-monitor "interface='com.lab126.powerd',member='goingToScreenSaver'" --system; killall xtestlab126; lipc-set-prop com.lab126.powerd powerButton 1; lipc-set-prop com.lab126.powerd preventScreenSaver "$SSSTATE" ) & usleep 50000 killall -INT dbus-monitor Code:
( dbus-monitor "interface='com.lab126.interfaceName',member='interfaceEvent'" --system; lipc-set-prop com.lab126.powerd powerButton 1; yourCommandsHere) & Last edited by Aeris; 10-25-2013 at 06:32 PM. Reason: Updated to prevent screensaver |
![]() |
![]() |
![]() |
#2 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 456
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
|
nice! that always bugged me also. I'll try it on my touch when I can.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
This is nice.
How would you solve the additional puzzle of the "screensaver time issue." When people choose to run an app with this configuration of "tap-out" escape, the default screensaver timeout time of 600 seconds comes back into play. as you yourself have noted, some applications don't like being "backgrounded" by the Screensaver layer and will in fact end up irretrievably hidden... There is a way to touch the screensaver timeout and set it back to another ten minutes, perhaps that could be part of the solution. Code:
lipc-set-prop com.lab126.powerd -i touchScreenSaverTimeout 1 One final question, I wonder if the lipc-wait-event construct would be worth demonstrating too... Last edited by twobob; 10-25-2013 at 08:24 AM. |
![]() |
![]() |
![]() |
#4 |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Do you mean the issue regarding screensaver after the 10 minutes timeout? A simple workaround could be to temporary increase the time needed to enter screensaver to something huge (maybe lipc-set-prop com.lab126.powerd touchScreenSaverTimeout could do the work). Or to send periodically a wakeup signal (lipc-set-prop com.lab126.powerd wakeUp 1 about every 9 minutes). Or again, prevent screensaver and listen on powerButton events (if exist). This would be the best solution because allow auto-screensaver while keeping the power button usable to quit the app
Last edited by Aeris; 10-25-2013 at 08:26 AM. |
![]() |
![]() |
![]() |
#5 |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Sorry, I read late your edit... and wrote powerButton instead of wakeUp, now fixed
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
right. I was busily typing a better question.
I guess I was asking /how/ that 590s loop might be best constructed in your opinion, in the context of this example. EDIT: I have considered this problem myself before and didn't come up with a really tidy solution, hence me asking. Last edited by twobob; 10-25-2013 at 08:31 AM. |
![]() |
![]() |
![]() |
#7 |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Forking the bash script on two thread... I mean, launch a second .sh from the main script, with a while cycle within, then running the dbus-monitoring code line without having to wait the forked code to quit... after the program exits the second script will be killed too with a simple killall command
EDIT: don't know why but lipc-set-prop com.lab126.powerd wakeUp 1 doesn't seem to work O.o I'd better try your one Last edited by Aeris; 10-25-2013 at 08:50 AM. |
![]() |
![]() |
![]() |
#8 |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Proof of concept
(I can't test this until I'm back home) - File removed, fixed and placed in the first post -- Last edited by Aeris; 10-25-2013 at 06:31 PM. |
![]() |
![]() |
![]() |
#9 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Dont let me bother you while you are busy. Thanks for the test. I will abuse it.
|
![]() |
![]() |
![]() |
#10 |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
No bothering
![]() |
![]() |
![]() |
![]() |
#11 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Another puzzle to be solved
![]() |
![]() |
![]() |
![]() |
#12 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Code:
#!/bin/sh SSSTATE=`lipc-get-prop com.lab126.powerd preventScreenSaver` lipc-set-prop com.lab126.powerd preventScreenSaver 0 /mnt/us/extensions/whiteboard/bin/wakeup.sh & /usr/bin/xtestlab126 & ( dbus-monitor "interface='com.lab126.powerd',member='goingToScreenSaver'" --system; killall xtestlab126; lipc-set-prop com.lab126.powerd powerButton 1; lipc-set-prop com.lab126.powerd preventScreenSaver "$SSSTATE" ) & usleep 50000 killall -INT dbus-monitor killall wakeup.sh should be Code:
#!/bin/sh SSSTATE=`lipc-get-prop com.lab126.powerd preventScreenSaver` lipc-set-prop com.lab126.powerd preventScreenSaver 0 /mnt/us/extensions/whiteboard/bin/wakeup.sh & /usr/bin/xtestlab126 & ( dbus-monitor "interface='com.lab126.powerd',member='goingToScreenSaver'" --system; killall wakeup.sh; killall xtestlab126; lipc-set-prop com.lab126.powerd powerButton 1; lipc-set-prop com.lab126.powerd preventScreenSaver "$SSSTATE" ) & usleep 50000 killall -INT dbus-monitor |
![]() |
![]() |
![]() |
#13 |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Thank you!! Updating package in the first post
![]() Last edited by Aeris; 10-25-2013 at 06:33 PM. |
![]() |
![]() |
![]() |
#14 |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Does anybody know how much resources does sleep function consume (CPU and RAM mainly)? I've googled but didn't find nothing... are so low to be completely neglectable?
Last edited by Aeris; 10-26-2013 at 08:48 AM. |
![]() |
![]() |
![]() |
#15 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
from what I can figure the process is put into a "sleep" state (see htop, the processes marked S are sleeping) and then (depending if the usleep or sleep command) is used they are subsequently triggered by a "type of" signal. (this /may/ be the "alarm" signal)
I am also relatively certain this is achieved by the use of http://man7.org/linux/man-pages/man2...meofday.2.html mixed with http://man7.org/linux/man-pages/man2/alarm.2.html , but as I intimated above usleep is guaranteed to fire - whereas "sleep" is a bit more sketchy strace usage often reveals MANY gettimeofday calls inside apps, and I have always thought that this was /probably/ related to sleeping processes. In terms of resource I would list it as "negligible" Hopefully someone can back-up or pooh-pooh what I have said here as it is mainly conjecture. Last edited by twobob; 10-29-2013 at 03:20 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PRS-505 Power button not shutting off | Atagahi | Sony Reader | 2 | 11-16-2012 05:48 PM |
PRS-T1 How can I use back button as power button? | younghere | Sony Reader | 1 | 03-12-2012 06:37 PM |
PRS-T1 Does Screensaver use power or not ? | blupaul | Sony Reader | 13 | 11-06-2011 04:59 AM |
Dead K3 showing a non-OEM screensaver | Francesco | Amazon Kindle | 5 | 07-10-2011 11:57 PM |
Keylock keeping current page - not showing screensaver? | guiyoforward | Amazon Kindle | 8 | 10-13-2010 06:44 PM |