Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 12-28-2022, 02:57 PM   #1
mfuhlendorf
Junior Member
mfuhlendorf began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Dec 2022
Location: Sao Paulo, Brazil
Device: Kindle 4 5-way D01100
Lightbulb BEGINNER: Script to sleep/wake up periodically

Hello!

I'm a longtime reader of this forum, and have used many of the hacks here in my kindles for over a decade (I love the custom screensavers!), but this is my first post.

I come here kindly asking for help, as a newbie coding for the kindle. I work with programming and scripting, but mostly for the web (PHP, JS, etc) and PowerShell windows scripting. I have dabbled in Unix shell scripting, but I'm not confident enough to start meddling with the kindle right away.

Here is what I want to do. I recently found my old K4 lying around, after a move, in an old box. I jailbroke it and installed KUAL and linkss. I want to write a script to force the kindle to go to sleep for a set amount of time, and then wake up for a second and go back to sleep. In conjunction with the linkss tool, it will effectively become a dumb BW, veeery low power digital picture frame, with a few hundred pictures loaded directly via USB after formatting in Lightroom (I first thought of using the Online screensaver tool, but then it would use a lot more battery power).

I found many useful guides here, but no comprehensive detail of the kindle lab126 functions that deal with sleep and wake up, setting up timers, etc.

Can anyone experienced point me in the right direction?

Thanks in advance
mfuhlendorf is offline   Reply With Quote
Old 12-28-2022, 05:27 PM   #2
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
You'll have to deal with RTC shenanigans, and that's always... fun.

I *think* it's been done on a K4, though, but I'll be damned if I can remember when/where :/.
NiLuJe is offline   Reply With Quote
Advert
Old 12-28-2022, 05:47 PM   #3
yparitcher
Connoisseur
yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.
 
Posts: 52
Karma: 616590
Join Date: Feb 2019
Device: K4 KT4 PW4 PW5
It was me of course.

https://www.mobileread.com/forums/sh...d.php?t=315119

https://www.mobileread.com/forums/sh...d.php?t=322900
yparitcher is offline   Reply With Quote
Old 01-06-2023, 09:07 AM   #4
mattcd216
Enthusiast
mattcd216 began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Jan 2023
Device: kindle 4 D01100
newbie here, be gentle

Your scripts - are they run by cron or something? and do they both wake then lock the screen?

I'm looking to automatically unlock the kindle, wait a few seconds and then re-lock in order to change the screensaver (photoframe project).

Thanks,
matt
mattcd216 is offline   Reply With Quote
Old 01-06-2023, 10:15 AM   #5
yparitcher
Connoisseur
yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.
 
Posts: 52
Karma: 616590
Join Date: Feb 2019
Device: K4 KT4 PW4 PW5
You run them on the command line (via ssh) and it waits litening for the system state to change.

It will put the kindle back to sleep
yparitcher is offline   Reply With Quote
Advert
Old 01-07-2023, 05:22 AM   #6
mattcd216
Enthusiast
mattcd216 began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Jan 2023
Device: kindle 4 D01100
Quote:
Originally Posted by yparitcher View Post
You run them on the command line (via ssh) and it waits litening for the system state to change.

It will put the kindle back to sleep
Thanks. And I presume they’ll run indefinitely, until a reboot or shutdown?
mattcd216 is offline   Reply With Quote
Old 01-07-2023, 01:49 PM   #7
mattcd216
Enthusiast
mattcd216 began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Jan 2023
Device: kindle 4 D01100
Struggling a bit.

I saw in one of the threads linked that
Code:
lipc-send-event com.lab126.powerd.debug dbg_power_button_pressed
simulates the lock button being pressed.

So a simple script:
Code:
#!/bin/sh
lipc-send-event com.lab126.powerd.debug dbg_power_button_pressed
sleep 5
lipc-send-event com.lab126.powerd.debug dbg_power_button_pressed
would achieve what I'm after, if I could schedule it to run periodically.

Does a jailbroken kindle have a cron scheduler, or similar?

Appreciate the help.
Matt
mattcd216 is offline   Reply With Quote
Old 01-07-2023, 02:53 PM   #8
mattcd216
Enthusiast
mattcd216 began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Jan 2023
Device: kindle 4 D01100
Found root's crontab. That'll do

Scheduled every 5 mins and that looked to work ok. Set to @daily now, so will see if the image refreshes overnight.

Matt
mattcd216 is offline   Reply With Quote
Old 01-08-2023, 03:26 AM   #9
mattcd216
Enthusiast
mattcd216 began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Jan 2023
Device: kindle 4 D01100
I take it back. 5 minute cron job is... intermittent. Sometimes works, sometimes doesn't. Haven't spotted a pattern in the behaviour yet.

Will keep trying/experimenting.
mattcd216 is offline   Reply With Quote
Old 01-08-2023, 09:20 AM   #10
yparitcher
Connoisseur
yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.yparitcher ought to be getting tired of karma fortunes by now.
 
Posts: 52
Karma: 616590
Join Date: Feb 2019
Device: K4 KT4 PW4 PW5
Quote:
Originally Posted by mattcd216 View Post
Thanks. And I presume they’ll run indefinitely, until a reboot or shutdown?
Correct.

A cron job is not enough, as cron only runs while the kindle is awake.
You need to set a rtc wakealarm to ensure that the kindle wakes up from sleep.

Lipc-wait-event also has a flag to tell it how many times to run, if you dont want it to run forever.
yparitcher is offline   Reply With Quote
Old 01-10-2023, 05:52 AM   #11
mattcd216
Enthusiast
mattcd216 began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Jan 2023
Device: kindle 4 D01100
Thanks for the help @yparitcher.

Couple of questions on your two scripts in this thread:
1. Do both of the scrips need to be run, or does one trigger the other?
2. Could/should they then be added to cron to run on boot?
3. I notice in program script the space to set picture with eips/fbink - I am hoping to use the screensaver hack to display a random image when the kindle is asleep, is this compatible?
4. I put in the eips command, ran, and got:
Code:
line 3: syntax error: "do" unexpected


Matt
mattcd216 is offline   Reply With Quote
Old 01-10-2023, 07:00 AM   #12
mattcd216
Enthusiast
mattcd216 began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Jan 2023
Device: kindle 4 D01100
@yparitcher trying your other single script you linked instead.

I gather this monitors states and when the kindle goes in to readyToSuspend it sets the rtcWakeup. I changed only the delta to 20 to test. Ran the script.

I locked the kindle both with the power button and also by waiting the 10 minutes for it to lock itself. Couldn't get any automatic wake from the script.

Where does the logger log to? Would be handy to troubleshoot what's happening.

Thanks again
mattcd216 is offline   Reply With Quote
Old 01-10-2023, 01:12 PM   #13
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Quote:
Originally Posted by mattcd216 View Post
Where does the logger log to? Would be handy to troubleshoot what's happening.
`showlog` (append `-f` if you want a live feed, àlà `tail`).
NiLuJe is offline   Reply With Quote
Old 11-07-2023, 12:43 PM   #14
tubular
Junior Member
tubular began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jul 2023
Device: K4
Quote:
Originally Posted by mfuhlendorf View Post
Hello!

I'm a longtime reader of this forum, and have used many of the hacks here in my kindles for over a decade (I love the custom screensavers!), but this is my first post.

I come here kindly asking for help, as a newbie coding for the kindle. I work with programming and scripting, but mostly for the web (PHP, JS, etc) and PowerShell windows scripting. I have dabbled in Unix shell scripting, but I'm not confident enough to start meddling with the kindle right away.

Here is what I want to do. I recently found my old K4 lying around, after a move, in an old box. I jailbroke it and installed KUAL and linkss. I want to write a script to force the kindle to go to sleep for a set amount of time, and then wake up for a second and go back to sleep. In conjunction with the linkss tool, it will effectively become a dumb BW, veeery low power digital picture frame, with a few hundred pictures loaded directly via USB after formatting in Lightroom (I first thought of using the Online screensaver tool, but then it would use a lot more battery power).

I found many useful guides here, but no comprehensive detail of the kindle lab126 functions that deal with sleep and wake up, setting up timers, etc.

Can anyone experienced point me in the right direction?

Thanks in advance
My reply is a bit late, but I think it's still useful to share.
This project is basically what you want: https://github.com/pascalw/kindle-dash
It's very power efficient, think only needing to charge your Kindle once a month.
tubular is offline   Reply With Quote
Reply

Tags
rtc


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wake up from sleep peterson Kindle Developer's Corner 37 03-08-2024 04:20 PM
Clara HD Magnet for sleep/wake feature ? Rojofo Kobo Reader 15 01-29-2021 08:49 AM
Can I set my Kindle 4 to wake from sleep? tickett Kindle Developer's Corner 4 12-29-2018 06:41 AM
HD how to debug auto wake/ sleep stumped Kindle Fire 5 12-19-2017 12:26 PM
Kobo h2o won't wake from sleep nikev Kobo Reader 13 01-03-2016 07:01 PM


All times are GMT -4. The time now is 09:59 AM.


MobileRead.com is a privately owned, operated and funded community.