Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 03-16-2014, 03:50 PM   #76
z000ao8q
Connoisseur
z000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toys
 
Posts: 51
Karma: 5942
Join Date: May 2013
Device: kobo mini
Hello,
I just remember 2 important parts from my implementation:
- kill all nickel & Co (I don´t even start them; i commented them in run.sh)
- get the system- and the hardware-clock right. if they are not matching, the wakeup timestamp can not be used.

i am running a own sh-script to set the times from time to time. because both clocks are running un-synced.
I know its not completely correct with summer/winter-time. but I don´t care. I simply added another hour-wake to be more tolerant.

Quote:
echo `date`
ntpd -d -q -p de.pool.ntp.org
sleep 10
echo `date`
newtime=$((`date +%s`+7200))
newtime2=`date +%T -d @$newtime`
date +%T -s $newtime2
echo `date`
hwclock -w -u
z000ao8q is offline   Reply With Quote
Old 05-12-2014, 09:50 AM   #77
Soern
Junior Member
Soern began at the beginning.
 
Posts: 1
Karma: 10
Join Date: May 2014
Device: Kobo Mini
Hi there!

First of all, thank you z000ao8q for your work - suspending my Kobo works now!

However I had to fiddle with a few things as suspending did not function right away.

My device did suspend, but did not resume properly. I fixed the issue by unloading the modules and stopping the blinking LED.
Spoiler:
Code:
echo "ch 4" > /sys/devices/platform/pmic_light.1/lit
echo "cur 0" > /sys/devices/platform/pmic_light.1/lit
echo "dc 0" > /sys/devices/platform/pmic_light.1/lit


My suspend script now looks as follows:
Code:
#!/bin/sh
zcat /etc/images/one_moment_please.raw.gz  | /usr/local/Kobo/pickel showpic
echo 1 > /sys/power/state-extended
sh /usr/sbin/wifidown.sh

rmmod dhd
rmmod sdio_wifi_pwr
sync

/mnt/onboard/stuff/busybox_kobo rtcwake -m mem -s 30

insmod /drivers/ntx508/wifi/sdio_wifi_pwr.ko
insmod /drivers/ntx508/wifi/dhd.ko
sleep 2
sh /usr/sbin/wifiup.sh
zcat /etc/images/splash.raw.gz   | /usr/local/Kobo/pickel showpic
I don't know if stopping the blinking is absolutely necessary - I believe that the module unloading did the trick ;-)

The wifiup/wifidown.sh scripts are identical to the ones described here: http://www.scherello.de/?id=265.
Soern is offline   Reply With Quote
Old 02-15-2021, 12:44 AM   #78
fulldecent
Junior Member
fulldecent is an enigma wrapped up in a mystery.fulldecent is an enigma wrapped up in a mystery.fulldecent is an enigma wrapped up in a mystery.fulldecent is an enigma wrapped up in a mystery.fulldecent is an enigma wrapped up in a mystery.fulldecent is an enigma wrapped up in a mystery.fulldecent is an enigma wrapped up in a mystery.fulldecent is an enigma wrapped up in a mystery.fulldecent is an enigma wrapped up in a mystery.fulldecent is an enigma wrapped up in a mystery.fulldecent is an enigma wrapped up in a mystery.
 
fulldecent's Avatar
 
Posts: 3
Karma: 41000
Join Date: Feb 2021
Location: Philadelphia
Device: Kobo Aura Edition 2
I have tested rtc_sleep on a Kobo Aura Edition 2. It is apparently working as expected--basically it is unresponsive in all ways for a set number of seconds and then comes back to life.

I'd like to know if unloading modules like Wi-Fi before sleep will actually save energy.
fulldecent is offline   Reply With Quote
Old 08-04-2022, 08:11 AM   #79
bzar
Junior Member
bzar began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2022
Device: Kobo Aura
I'm trying to utilize the RTC on my Kobo Aura to use it as an info display for HomeAssistant.

Since I'm making an application for this, I skipped using rtcwake altogether and just ioctl the rtc0 device directly.

I have a simple test program to figure out how to suspend and wake reliably, but the RTC does not seem to work like linux docs expect it to. Basically I'm running into the same issue as pizzamonster above. dmesg shows my test program correctly sets an alarm for 10 seconds and unmasks the interrupts, but when the alarm should happen my `read` from rtc0 does not return like it should based on https://man7.org/linux/man-pages/man4/rtc.4.html ("RTC functionality", last paragraph). I've tried suspending to memory instead of reading from the device but it won't wake up either.

My test program is here https://gist.github.com/bzar/f7bbdd0...8c3a4408c8054c

It hangs on line 86, waiting for the read.

Here's the relevant dmesg output for running the program.
Code:
read_alarm: 0 70/0/1 0:0:0
[mxc_rtc_alarm_enable-253]
[msp430_setalarm-798] alarm 10
read_alarm: 1 122/7/4 11:52:10
[mxc_rtc_alarm_enable-253]
[msp430_setalarm-798] alarm 10
TPS65185 temprature data = 0x1a,26
mxc_epdc_fb mxc_epdc_fb: hist_stat = 0x8, new waveform = 0x4
[ntx_get_battery_vol-1843] 88,bat=997
[msp_int-1883] MSP430 interrupt triggered !!!
bzar is offline   Reply With Quote
Old 08-04-2022, 09:52 AM   #80
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,477
Karma: 26012492
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
What about the actual output from your program? ;o).

Also, see https://github.com/koreader/koreader/issues/7994 for a tale of how a dead RTC will screw with you in fun and interesting ways .

FWIW, nickel itself makes *extensive* use of RTC alarms, so on a sane device, it should Just Work (TM).

c.f., KOReader's implementation for some comments about common gotchas, too.

My mushy brain is not up to reviewing anything, so good luck .
NiLuJe is offline   Reply With Quote
Old 08-04-2022, 11:49 AM   #81
bzar
Junior Member
bzar began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2022
Device: Kobo Aura
Here's an output from one of the runs
Code:
# ./kobo_test_rtc
Reading previous alarm
Previous RTC alarm date/time is 2022-8-4, 12:15:42.
Reading current time
Current RTC date/time is 2022-8-4, 12:16:44.
Setting alarm
Alarm date/time is 2022-8-4, 12:16:54.
Enabling alarm interrupts
Reading alarm back
Current RTC alarm date/time is 2022-8-4, 12:16:54.
Enabling alarm interrupts AGAIN
Flushing I/O...
Waiting for alarm...
^C
Thanks for the links, I'll look into them.
bzar is offline   Reply With Quote
Old 08-05-2022, 02:03 AM   #82
bzar
Junior Member
bzar began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2022
Device: Kobo Aura
Hm, the koreader one seems to use RTC_WKALM_SET, which is not supported on Kobo Aura. According to my poking about it seems to only support RTC_ALM_SET+RTC_AIE_ON, but those should accomplish the same thing (RTC_WKALM_SET is just a bit nicer API). I'm not seeing any other significant differences. I'll have to check the battery voltages though.
bzar is offline   Reply With Quote
Old 08-05-2022, 08:25 AM   #83
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,477
Karma: 26012492
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 bzar View Post
which is not supported on Kobo Aura
What makes you say that?

(I don't recall ever hearing of that, then again, I don't have a device that old myself).

IIRC, the feature flag for that is the '24hr' field in /proc/driver/rtc

Last edited by NiLuJe; 08-05-2022 at 08:28 AM.
NiLuJe is offline   Reply With Quote
Old 08-05-2022, 08:58 AM   #84
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,477
Karma: 26012492
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
I've never tested the read approach myself, but at least I can tell you that your testcase doesn't work either over here, on a device where my usual RTC shenanigans work just fine ;o).

(Power management on Kobo is... pain).
NiLuJe is offline   Reply With Quote
Old 08-08-2022, 06:05 AM   #85
bzar
Junior Member
bzar began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2022
Device: Kobo Aura
I tried setting WKALM and just get an error from the ioctl. There's also no /sys/class/rtc/rtc0/wakealarm.

So on your device you can get RTC alarms to work with other code but not mine? That's odd. I specifically tried to mimic pre-existing solutions, just simplified. It could be that WKALM is needed for the device to wake up (which your other code could use) but it wouldn't write to /dev/rtc0 either using just plain alarms, making my code fail on your device as well?

The fact that my test program generates interrupts in /proc/interrupts which are also logged in dmesg tells me the alarm is set and processed, but for some reason doesn't wake the device nor write to /dev/rtc0 as it should.

Guess I'll dig deeper into why WKALM didn't work if it should.
bzar is offline   Reply With Quote
Old 08-08-2022, 09:33 AM   #86
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,477
Karma: 26012492
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Assuming reading /dev/rtc0 is broken, period (I can't vouch for that ever working, as I've never tried it), it's a bitch and a half to debug on those older devices, because they can't PM while plugged in and/or with Wi-Fi on, and without ever entering a sleep state in the first place, you of course never get "woken up", alarm or not ;o).
NiLuJe is offline   Reply With Quote
Old 08-08-2022, 11:03 AM   #87
bzar
Junior Member
bzar began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2022
Device: Kobo Aura
The device does go unresponsive (I assume suspended) when I write "mem" to /sys/power/state even if I have WLAN on. Then it stays unresponsive until I hard reset with the power switch.
bzar is offline   Reply With Quote
Old 08-09-2022, 11:17 AM   #88
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,477
Karma: 26012492
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Yes, that's a kernel crash ;o).

(You can't suspend (any?) NTX boards with Wi-Fi on (or even just *powered* on): it hangs the kernel, either right away, or on resume/next wifi bringup).

(Hence my "debugging this is a bitch" comment above ).

Last edited by NiLuJe; 08-09-2022 at 11:20 AM.
NiLuJe is offline   Reply With Quote
Old 08-09-2022, 11:29 AM   #89
bzar
Junior Member
bzar began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2022
Device: Kobo Aura
OH. That explains it, thanks. I also got WKALM to work, it was a stupid mistake. I'll work on getting wifi disabling to this "small test program" next then. I could probably run it through NickelMenu and pipe the logs somewhere to avoid depending on a network/usb connection?
bzar is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Glo How to import reading Life Statistics from Kobo Touch to Kobo Glo? the_m Kobo Reader 5 12-13-2012 03:40 PM
$25 gift card w. purchase of Kobo Touch or Kobo Vox at Frys sufue Deals and Resources (No Self-Promotion or Affiliate Links) 0 07-15-2012 10:39 AM
Touch Kobo Touch defective after 3 months and Kobo Customer Support useless shaf Kobo Reader 5 12-04-2011 05:10 PM
Touch Kobo Touch not ejecting cleanly with Calibre OR Kobo Desktop - Windows 7 JBlyth Kobo Reader 11 08-03-2011 05:38 PM
Kobo Touch not disconnecting properly from Calibre OR Kobo Desktop - Windows 7 JBlyth Devices 1 08-03-2011 06:50 AM


All times are GMT -4. The time now is 07:39 PM.


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