Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-05-2013, 08:53 AM   #1
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
Hack to reopen last book

I would find a way to reopen the last opened book at startup, if I shut down when the book was opened.
What I want to do is to write the document path to some file before the device is shut down if the document is open, and re-open the document when the OS is ready. The problems are:
  1. how can I insert an action before the shutting down?
  2. where can I find the last opened document? I'm quite sure this information is stored somewhere (the db?)
  3. how can I open a document?
Lucas Malor is offline   Reply With Quote
Old 05-05-2013, 01:51 PM   #2
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
As for point 1, this might be helpful.
tshering is offline   Reply With Quote
Old 05-05-2013, 03:23 PM   #3
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
Ok, this is what I have done:
  1. opened a SSH connection
  2. mkdir /etc/rc0.d
  3. cd /etc/init.d
  4. echo "#! /bin/sh" > test
  5. echo >> test
  6. echo "echo 'OOOOOOOOOOK!!!!!!!' > /mnt/onboard/OOK.txt" >> test
  7. cd /etc/rc0.d
  8. ln -s /etc/init.d/test S10test
  9. sync
  10. exit
  11. unplugged kobo
  12. restarted kobo

Result: no OOOOOOK.txt even after another shutdown.... but my db is corrupted, since kobo doesn't find any book in my library even if the files are ok

It seems that the OS doesn't use rc#.d scripts. Any other ideas?

Last edited by Lucas Malor; 05-05-2013 at 03:34 PM.
Lucas Malor is offline   Reply With Quote
Old 05-05-2013, 03:53 PM   #4
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Maybe you can do something like KevinShort does here.
tshering is offline   Reply With Quote
Old 05-05-2013, 04:08 PM   #5
yoq
Developer
yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.
 
Posts: 77
Karma: 206176
Join Date: Apr 2013
Location: Europe
Device: Kobo Glo
don't forget to "chmod +x script.sh"

busybox probably doesn't support /etc/rc0.d
however /etc/inittab should do as well by adding:
Code:
::shutdown:/path/to/script.sh
Details: http://git.busybox.net/busybox/tree/examples/inittab
yoq is offline   Reply With Quote
Old 05-06-2013, 07:40 AM   #6
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
Quote:
Originally Posted by yoq View Post
don't forget to "chmod +x script.sh"
......damnit :-P

Quote:
Originally Posted by yoq View Post
busybox probably doesn't support /etc/rc0.d
/etc/inittab should do as well
It doesn't work... I added

Code:
::shutdown:/etc/init.d/test
before

Code:
::shutdown:/bin/umount -a -r
the stupid test script works if I run it manually, but it's not executed at shutdown

EDIT: I also added sync at the end, but nothing

Last edited by Lucas Malor; 05-06-2013 at 08:33 AM. Reason: added sync without success
Lucas Malor is offline   Reply With Quote
Old 05-06-2013, 03:03 PM   #7
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
After some help from the BusyBox maling list, I've found that any output, even the stdout, is suppressed during the shutdown, but the script is executed. I don't know if there's a way to write an output on shutdown. Maybe I can use acpid to run a script when the power button is slided.
Lucas Malor is offline   Reply With Quote
Old 05-06-2013, 03:24 PM   #8
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
If acipd does not work as wished, I would like to draw your attention again to KevinShort's ingenious solution.
tshering is offline   Reply With Quote
Old 05-06-2013, 05:29 PM   #9
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
I completely missed you post, this is a lot more simple! I'll try it tomorrow

The best for me will be to disable also the display of the shutdown image, so the last page will be displayed instead. Unfortunately, like Kevin, I have no idea where's the code that loads that image.
Lucas Malor is offline   Reply With Quote
Old 05-07-2013, 06:44 PM   #10
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
Ok, it works! Now the real big problem is to find a way to open the book. I think there's no command line solution this time... probably books are managed by nickel? Furthermore I should be able to open it instead of showing the homepage, to save time.

Yoq, you have linked a library to nickel. Do you have any idea where I can find what I'm searching for? On Kobo git I can't find nothing useful.

I can also simulate a touch on the first book, but it will be slow and not so useful.
Lucas Malor is offline   Reply With Quote
Old 05-08-2013, 03:39 AM   #11
yoq
Developer
yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.
 
Posts: 77
Karma: 206176
Join Date: Apr 2013
Location: Europe
Device: Kobo Glo
My approach is described here: http://www.jayconrod.com/cgi/view_post.py?23
However, this is probably not useful for your problem, it's better suited to change the way nickel interacts with the kernel or other programs. I have not looked into it yet, but "ah-" seems to have gained some access to the nickel internas with his KoboTweaks plugin.
yoq is offline   Reply With Quote
Old 05-08-2013, 04:03 AM   #12
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
So I have to take a look to tweaks code. ah- seems to be inactive...
Lucas Malor is offline   Reply With Quote
Old 05-08-2013, 10:54 AM   #13
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Quote:
Originally Posted by Lucas Malor View Post
I can also simulate a touch on the first book, but it will be slow and not so useful.
I doubt you could get anything to go much faster than that. Even the tweaks plugin doesn't start until after the home screen loads.
KevinShort is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Told to reopen bug ticket if someone else was interested, but... ThePage Calibre 1 11-29-2012 12:04 AM
Paid Hack Request: Photo Slideshow Hack for Kindle 3 chmreader Kindle Developer's Corner 0 05-25-2011 01:24 PM
New hack for the PRS-505. % of book read surquizu Sony Reader Dev Corner 1 10-11-2009 01:30 AM
Book titles hack? Time delay hack? re838uk Sony Reader 0 10-08-2009 05:29 AM
PRS-500 Please help: Copy Book Hack mdhuang Sony Reader Dev Corner 9 10-21-2007 03:50 PM


All times are GMT -4. The time now is 04:53 AM.


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