![]() |
#1 |
Pain in the arse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
|
DB Auto-Backup Tool for Kobo
Since I got the database corrupted very much times, I decided to do this little auto-backup tool.
It simply backups the db every 20 minutes, or when the USB cable is attached, in a hidden place. If the database is corrupted, LED light starts to blink and you can find the backup in the .kobo folder. How to install it: Check the instructions here. How to repair your db: if you want to restore the backup, you have to follow these steps very carefully:
------------------------------------------------------------------------------- Currently the script has some limitations:
I hope it will help us to save some time. Thanks to tshering for sqlite, LED control and USB flashing detection, and yoq for runonce trick. Last edited by Lucas Malor; 04-26-2014 at 11:42 AM. |
![]() |
![]() |
![]() |
#2 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Quote:
Code:
MODULE_LOADED=`lsmod | grep -c g_file_storage` if [ $MODULE_LOADED -eq 0 ]; then exit fi Last edited by tshering; 03-27-2014 at 06:07 AM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Quote:
|
|
![]() |
![]() |
![]() |
#4 |
Pain in the arse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
|
Thank you tshering! I updated the tool, adding also a more reliable method to install it and removing the startup delay with an ad-hoc hack.
Now if the database gets corrupted it will be copied on the flash partition. The only problem with this method is that it's not reliable in all cases. For example when you attach the device using telnet or SSH, it won't work. I modified it a little for SSH case, but I would try to port lsusb to Kobo. About pickel, I tried with PHP Code:
Do you know if there's a way to control the LED light instead? I'll prefer it a lot much, but pickel blinkon seems to not work. Scripts in /etc/init.d seem to not control the LED. |
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
I didn't try myself to control the LED apart from switching it off, but these two links should give enough information:
http://uni.2ch.net/test/read.cgi/ebooks/1355887854/544 http://www.tablix.org/~avian/blog/ar...linken_kindle/ |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Pain in the arse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
|
Thank you very much! Now Kobo blinks if the db is corrupted. Furthermore I fixed some bugs and the backup is compressed now, so we save some space.
In the meanwhile I compiled a program that sends ioctl signals to devices. I do not need it anymore, but if someone is interested I attach the binary. |
![]() |
![]() |
![]() |
#7 |
GranPohbah-Fezzes r cool!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,056
Karma: 3151024
Join Date: Jul 2010
Device: Nook STRs, Kobo Touch, Kobo Glo
|
I don't want to rain on anyone's parade, hardly qualify as a fanboi of any denomination, but have to wonder just what you're doing that necessitates backing up the sqlite database every twenty minutes, and wonder that you might consider disclaiming the necessity for anyone using the reader as intended. I think we get enough people trolling without possibly seeming to indicate that the system is so fragile the db needs to be backed up every time we turn around... I sometimes wonder that Kobo provides enough ammunition just by updating so often because some people are afraid of breaking something that is working...
Anyhow, cool hack! |
![]() |
![]() |
![]() |
#8 | ||
Pain in the arse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
|
Quote:
Quote:
![]() I don't know if my db corruptions are my fault or it's the software that is fragile, because source code of nickel is closed. Saying that bugs are my fault is not 100% sure as saying it's Kobo's fault. Any guess is just... guess. I simply had a problem and I'm trying to do a workaround. |
||
![]() |
![]() |
![]() |
#9 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Quote:
So for my needs it is better to do the backup at strategical points, before a synchronization, before deleting books from my device, before testing hacks etc. Nevertheless, I like the project. |
|
![]() |
![]() |
![]() |
#10 | |
Pain in the arse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
|
Quote:
Deletion: I'll create a launcher for Kobo Start Monitor. Sync: I have to find a way to detect internet connections... ![]() |
|
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
This is very kind. But please don't misunderstand me. I did not intend to ask for this feature. Actually, I don't need auto backup. I like to decide at what point I pack-up the database. I do it already with the Kobo Start Menu (scripts > back up > back up db.sh)
|
![]() |
![]() |
![]() |
#12 |
GranPohbah-Fezzes r cool!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,056
Karma: 3151024
Join Date: Jul 2010
Device: Nook STRs, Kobo Touch, Kobo Glo
|
No offense intended, Lucas. I'm just trying to get you to look at the bigger picture. As far as stating that it backs up every twenty minutes, you did that in your first post:
"It simply backups the db every 20 minutes in a hidden place." I suppose what you meant to say was, "It checks to see if the db has changed every twenty minutes and backs it up as long as it hasn't been corrupted in the mean time." Of course, I'm just supposing... I'm also supposing it suspends during sleep mode or it would be a fair battery drain over time. Complete sentences composed with the same logic one devotes to a problem would be helpful in determining intent. I don't work for Kobo, but I would like to give them a fair shake. I'm hard enough on them when they screw up, so the least I can do is try to be fair when they haven't. I've had a great deal of enjoyment from the Touch and Glo I own, so feel they haven't screwed up too badly -mostly cosmetics and not listening when users want choices. I've also had a corrupted database maybe only once or twice in a couple of years and those occurred during copying of files or perhaps due to an improper dismount from windows. All that was required was to log out/in and let it rebuild the database and then replace any titles affected. Not a big deal. Annoying at worst as a non regularly scheduled inconvenience... |
![]() |
![]() |
![]() |
#13 |
Pain in the arse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
|
Updated, now backup starts also when an USB cable is attached to Kobo.
If someone is interested, I created a stupid little program that check the usb and a stupid little script that controls the led lights very easily. See the attachment. You supposed wrong. Currently I do not know how to check sleeping status. I think I must detect nickel process status, or the ability to catch touch signals. Anyway "fair battery drain" is an exageration. Do you ever checked the battery drain panel of any Android device? Usually more than 50% of power consumption is due to the use of the screen. Last edited by Lucas Malor; 04-01-2014 at 09:36 AM. |
![]() |
![]() |
![]() |
#14 |
GranPohbah-Fezzes r cool!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,056
Karma: 3151024
Join Date: Jul 2010
Device: Nook STRs, Kobo Touch, Kobo Glo
|
This is not an android device, e-ink displays use much less power than active TFT or the like, which is why we recharge after around 46.5 hours of actual reading/operation over a 24 day+ period with a Glo rather than 6-10 or so hours with the average Android tablet... at least according to the actual usage test I logged/performed with my Glo last year.(that was with lighting around 20% brightness as I recall)
All I was saying was I assumed you'd have a way to keep it from coming out of sleep every 20 minutes or that your code/timer wouldn't be executing because it was "powered down". If it is running every twenty minutes and impacting sleep mode then it's drawing current that need not be drawn because nothing is changing while the device is being slept. E-ink is all about low power. Granted it may not be a big impact if it's just checking for db change when there can be none, but every milliamp counts... Have you noticed how the average current draw drops off after a few seconds of no change while the device is running with only the normal code executing? This is why people had such trouble when using sleep covers that had a pocket that tripped the IR hardware into a powered mode by blocking the IR and preventing a proper sleep mode. Typical battery life in that situation was under 72 hours in what people thought was sleep. I think you're doing great, keep going. Last edited by TechniSol; 04-02-2014 at 01:10 AM. |
![]() |
![]() |
![]() |
#15 |
Pain in the arse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
|
Ok, I updated the tool. Now it backups the database immediately if an internet connection is established.
@TechniSol: you can check yourself the cpu usage ![]() PHP Code:
I can't find a way to detect sleeping status, but I suppose it doesn't really matter: db can't change while Kobo is sleeping, so the auto-backup tool remains at that level of cpu usage. Last edited by Lucas Malor; 04-26-2014 at 11:56 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Tool to auto create bookmarks in pdf's? | ehead | Related Tools | 1 | 06-24-2013 06:06 PM |