Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial testing #3

Open
shermp opened this issue May 3, 2019 · 105 comments
Open

Initial testing #3

shermp opened this issue May 3, 2019 · 105 comments

Comments

@shermp
Copy link
Owner

shermp commented May 3, 2019

Starting an issue thread to gather early testing results.

@NiLuJe if you have any issues or comments, leave 'em here. Probably better than continuing the discussions in PR's

@shermp
Copy link
Owner Author

shermp commented May 3, 2019

I deleted a book. And transferred a book :D

I haven't really changed anything @NiLuJe , so if it doesn't work, make sure Calibre is listening, and the ports aren't being blocked.

Issues so far:

  • FBInk printing is not behaving how I want it to. It SHOULD show up in a centred box, with the previous contents being cleared for each print. I've probably got some sums wrong in kuPrintEink.go
  • Need to improve status messages to let users have a better idea of what KU is doing, especially when waiting for cover thumbnails to be generated, which leads in to the next issue...
  • Cover/thumbnail generation is s l o w. Like really slow. I obviously need to find a faster library to do this. Probably needs to be based on a C/C++ lib with ARM optimizations.

@NiLuJe
Copy link
Contributor

NiLuJe commented May 4, 2019

I'll do a round of testing tomorrow ;).

What are you currently using to generate the thumbnails? I don't know if that's doable in this context, but it might be worth letting Nickel handle all that, because otherwise, doing it right is going to be expensive, no matter what ;).

@shermp
Copy link
Owner Author

shermp commented May 4, 2019

I'm using a Go library. Just noticed that I asked for it to use Lanczos algorithm. Perhaps (ok, almost certainly) this was a tad ambitious, and the quality is probably lost on such small images anyway. Will try switching to bilinear and see if that helps (it will, just not sure by how much...)

I really want to get thumbnail generation working at an acceptable performance level. Nothing more annoying (for me) to wait at the library screen while Nickel takes its sweet time generating thumbnails...

I'm using a go routine for image generation, so it doesn't block the rest of the code, at least not until we're ready to exit. So long as I can get performance good enough that it's all done by the time the user "ejects" from Calibre, that's good enough for me.

Note when you are having a go, the correct way to exit is to "eject" the device in Calibre, like you would with a USB connection.

@shermp
Copy link
Owner Author

shermp commented May 4, 2019

So, I've got thumbnail generation to an acceptable performance level. Mainly by deciding not to bother with the full cover at all. KU now requests a (much) smaller cover size (the dimensions of the - N3_LIBRARY_FULL.parsed image), and downscales that where necessary. Nickel can generate the full cover from the ebook, when required.

Also fixed an issue around updating the Nickel DB with NULL values. I was sending the string 'NULL' instead of actually setting NULL values. Changed the variable types to pointers, and Go handled the rest :)

And I haven't had any troubles exiting and returning from Nickel. Thanks for making the shell scripts so much more robust @NiLuJe

@NiLuJe
Copy link
Contributor

NiLuJe commented May 4, 2019

After a false start because I have no idea how Go works, and despite a go get, I ended up apparently building old sources, it now appears to be going better!

I'd forgotten that you had to enable a service in Calibre for the Wireless thingy, which probably explains my earlier failures (speaking of, that probably warrants a user-visible warning on-screen, something along the lines of: couldn't connect to Calibre, check that it's running and the Wireless connection service has been started).

  • The Running Kobo-UNCaGED/Creating KU object step still takes a good long while over here, an on-screen hint that it might be the case could be helpful here, too ;).

  • The KoboUNCaGED log entries are timestamped twice:

May  4 17:04:31 UNCaGED: USBMS mode entered . . .
May  4 17:04:31 UNCaGED: Running Kobo-UNCaGED
May  4 17:04:31 KoboUNCaGED[3376]: 2019/05/04 17:04:31 Started Kobo-UNCaGED
May  4 17:04:31 KoboUNCaGED[3376]: 2019/05/04 17:04:31 /mnt/newonboard
May  4 17:04:31 KoboUNCaGED[3376]: 2019/05/04 17:04:31 Creating KU object
May  4 17:04:53 dropbear[3380]: Child connection from 192.168.0.42:54120
May  4 17:04:53 dropbear[3380]: Pubkey auth succeeded for 'root' with key sha1!! 
[root@(none) ~]# logread -f
May  4 17:07:21 KoboUNCaGED[3376]: 2019/05/04 17:07:21 Preparing Kobo UNCaGED!
May  4 17:07:22 KoboUNCaGED[3376]: 2019/05/04 17:07:22 Starting Calibre Connection

You don't need explicit timestamps, the syslog handles those ;).

  • Definitely see what you meant with the OT FBInk prints ;). Haven't looked at the code, though.

@NiLuJe
Copy link
Contributor

NiLuJe commented May 4, 2019

Yeah, when Calibre is down, I see a May 4 17:13:40 KoboUNCaGED[3834]: 2019/05/04 17:13:40 calibre server not found in the logs, but I never saw it on-screen, only the previous Preparing Kobo UNCaGED! was visible ;).

@NiLuJe
Copy link
Contributor

NiLuJe commented May 4, 2019

Aaaaand, semi-success: I apparently successfully downloaded a book, I can see it and everything, but I get a "Oops! This document couldn't be opened" warning when I actually try to read it ;).

I did get the processing pass, I did get the second KU run (it also took a few minutes to start). I couldn't track everything because I of course had to take a call right at this moment -_-".
But the logs look sane:

May  4 17:19:43 KoboUNCaGED[4573]: 2019/05/04 17:19:43 Started Kobo-UNCaGED
May  4 17:19:43 KoboUNCaGED[4573]: 2019/05/04 17:19:43 /mnt/newonboard
May  4 17:19:43 KoboUNCaGED[4573]: 2019/05/04 17:19:43 Creating KU object
May  4 17:22:06 KoboUNCaGED[4573]: 2019/05/04 17:22:06 Updating Metadata
May  4 17:22:06 UNCaGED: Unmounting onboard
May  4 17:22:09 UNCaGED: Onboard unmounted (0) . . .
May  4 17:22:09 UNCaGED: Going back to Nickel

Side-note: this is a KePub. I have both an ePub and a KePub for this book in my Calibre library, and it preferred the KePub (which is fine by me). That may be because of my format preferences in Calibre, in which case, perfect ;).

@NiLuJe
Copy link
Contributor

NiLuJe commented May 4, 2019

FWIW, I can open that same book on my Forma, where I transferred it the usual way.

@shermp
Copy link
Owner Author

shermp commented May 4, 2019

I haven't actually tested kepub yet. it SHOULD work, but obviously there may be some kinks.

The reason it takes so long to before it connects to Calibre, is because before connecting, I gather all the metadata, which is a 2.5 pass process. First, if it exists, I read the metadata.calibre file, and put it into a map, checking with the Nickel DB that the book still exists while I do so. Then it checks the database for books that aren't in the metadata cache, and adds them by opening the (k)epub and extracting metadata.

As you can see, depending on how many books you have, and how in sync the Nickel DB and calibre cache file are, this step can take a while. I'm not sure how to speed this step up, and still present calibre with an accurate list of books on device (as seen by Nickel).

As far as preferring kepub, that's because that's the extension listed first in the code. I should probably make that configurable.

As far as the timestamps on the logs go, that's automatically added by Go's default logger which I'm using.

Agreed I need to better display the state to the user.

It's the book corruption I'm most worried about however. Will need to look into that.

Thanks so much for helping to test this.

@shermp
Copy link
Owner Author

shermp commented May 4, 2019

Ok, sent a kepub to my H2O, and it opened fine. So not a kepub issue. If the kepub is a known good file that Nickel reads correctly, then there's probably some corruption going on in the book saving code, or networking code. Joys...

@NiLuJe
Copy link
Contributor

NiLuJe commented May 5, 2019

Okay, take two:

Still no dice on that book.
A few things about it: there's a bang in the title/filename, it's in French.
It also inherited a completely bogus "Series" entry on the second send (it doesn't actually belong to a Series).

The main content DB entry looked like this the first time around:

file:///mnt/onboard/Gare a Lou ! - Jean Teule (6336).kepub.epub|6|application/x-kobo-epub+zip|||file____mnt_onboard_Gare_a_Lou_!_-_Jean_Teule_(6336)_kepub_epub|Gare à Lou !|Jean Teulé|<p class="description">Avec Gare à Lou ! Jean Teulé revient à la veine fantastique qui avait fait le succès du Magasin des suicides et laisse libre court à un imaginaire plus débridé que jamais. Comme le disaient Mozart et Shakespeare : " Il est très agréable de jouir d'un don exceptionnel, mais il ne faut pas oublier que c'est une source inépuisable d'embêtements ". A 12 ans, Lou partage absolument cette opinion. Au prétexte qu'elle est en mesure de faire tomber immédiatement les pires calamités sur la tête de tous ceux qui la contrarient, on l'enferme dans un endroit secret en compagnie de militaires haut gradés pour qu'elle devienne une arme absolue capable de mettre en échec les plans malveillants des ennemis du pays ou, pire, d'ourdir de méchantes et sournoises manoeuvres afin de causer des torts effroyables à d'autres nations. De telles occupations n'offrent pas à une adolescente les satisfactions que la vie aurait pu lui promettre. D'autant que son super pouvoir, aussi extraordinaire soit-il, ne fonctionne pas toujours comme prévu. Rien ne pouvait mieux inspirer Jean Teulé que d'imaginer les horreurs qu'un être humain bien disposé peut infliger à ses contemporains.</p>|||/mnt/onboard/Gare a Lou ! - Jean Teule (6336).kepub.epub|Julliard|true||true||0|0|890|0|-1|0|2019-05-04T15:19:24Z|kepub_user|||2104362|0|0|-1|-1||fr||true|0|0|0||FALSE|||0|true|-1|2|||||-1||0|0|0.0|0|||||||0||||false|0|||false|true|0|0|||||||||false|false||||||true|true

Here's what Nickel says when it fails to open it:

May  5 18:12:18 nickel: (  5061.154 @ 0x142af20) QList<int> KepubBookWordCounter::wordsInBook(const Volume&, const QVector<Shortcover>&) EPUB PATH NOT FOUND:  "/mnt/onboard/Gare a Lou " 
May  5 18:12:18 nickel: (  5061.386 @ 0x9db9f0 / ui.warning) ZipStreamDevice::ZipStreamDevice(zip*, const QString&) 0x0 
May  5 18:12:18 nickel: (  5061.387 @ 0x9db9f0 / ui.debug) virtual bool KepubBookReaderBase::contentMissing() "file:///mnt/onboard/Gare a Lou ! - Jean Teule (6336).kepub.epub" Trying to load first chapter false 
May  5 18:12:19 nickel: (  5061.549 @ 0x9db9f0 / ui.warning) ZipStreamDevice::ZipStreamDevice(zip*, const QString&) 0x0 
May  5 18:12:19 nickel: (  5061.550 @ 0x9db9f0 / ui.debug) virtual bool KepubBookReaderBase::contentMissing() "file:///mnt/onboard/Gare a Lou ! - Jean Teule (6336).kepub.epub" Trying to load first chapter true 
May  5 18:12:19 nickel: (  5061.551 @ 0x9db9f0 / ui.warning) virtual void KepubBookReaderBase::reloadContent() markup check failed "file:///mnt/onboard/Gare a Lou ! - Jean Teule (6336).kepub.epub" true false

And here's the entry from the second send (I did tweak the book a bit, because of a page-break issue I caught on the Forma), where it gets assigned to book 6 of The Witcher series.

(Not sure if relevant: that's probably the latest Series created/updated on that device, and the latest book sent to the device before that. If not the very latest, in the latest batch, at least).

file:///mnt/onboard/Teule, Jean - Gare a Lou !.kepub.epub|6|application/x-kobo-epub+zip|||file____mnt_onboard_Teule,_Jean_-_Gare_a_Lou_!_kepub_epub|Gare à Lou !|Jean Teulé|<p class="description">Avec Gare à Lou ! Jean Teulé revient à la veine fantastique qui avait fait le succès du Magasin des suicides et laisse libre court à un imaginaire plus débridé que jamais. Comme le disaient Mozart et Shakespeare : " Il est très agréable de jouir d'un don exceptionnel, mais il ne faut pas oublier que c'est une source inépuisable d'embêtements ". A 12 ans, Lou partage absolument cette opinion. Au prétexte qu'elle est en mesure de faire tomber immédiatement les pires calamités sur la tête de tous ceux qui la contrarient, on l'enferme dans un endroit secret en compagnie de militaires haut gradés pour qu'elle devienne une arme absolue capable de mettre en échec les plans malveillants des ennemis du pays ou, pire, d'ourdir de méchantes et sournoises manoeuvres afin de causer des torts effroyables à d'autres nations. De telles occupations n'offrent pas à une adolescente les satisfactions que la vie aurait pu lui promettre. D'autant que son super pouvoir, aussi extraordinaire soit-il, ne fonctionne pas toujours comme prévu. Rien ne pouvait mieux inspirer Jean Teulé que d'imaginer les horreurs qu'un être humain bien disposé peut infliger à ses contemporains.</p>|||/mnt/onboard/Teule, Jean - Gare a Lou !.kepub.epub|Julliard|true||true||0|0|57|0|-1|0|2019-05-05T16:17:54Z|kepub_user|||1501912|0|0|-1|-1||fr||true|0|0|0||FALSE|||0|true|-1|2||The Witcher|6||-1||0|0|0.0|0|||||||0||||false|0|||false|true|0|0|||||||6.0||false|false||||||true|true

No issues with another book, in English, part of a series. It opens and was assigned to the proper series :).

@NiLuJe
Copy link
Contributor

NiLuJe commented May 5, 2019

Oh, and if I actually read the error messages instead of just copy/pasting 'em: the failure to open it definitely appears to be because of the bang ;p.

So I guess sanitizing filenames to be FAT-friendly should be enough?

No idea what happened with the Series metadata the second time around, though.

FWIW, I deleted the first copy from within Nickel, and not via Calibre.

@NiLuJe
Copy link
Contributor

NiLuJe commented May 5, 2019

And about the startup delay: progress bar? ;p.

I get that keeping things in sync can be tricky, but maybe some stuff could be cached? And then naively checked for changes via timestamps, as that's probably going to be the fastest. Walking the full onboard tree will take its toll no matter what, though :/.

Also, no idea how feasible that would be, but if the metadata pass could avoid having to re-do the whole thing that would probably help, too ;).

@shermp
Copy link
Owner Author

shermp commented May 5, 2019

Thanks for continuing your testing. I had hoped that Calibre would sanitize the filename before sending it. Seems I'll have to do it on device instead :(
EDIT: Just realised, I'm running on Windows, so calibre is already sanitizing filenames for me. Am going to have to think of how to handle this, as Lpath is basically used by calibre as an ID.

As far as the wrong series info, that was a bug I fixed locally last evening, I noticed it myself. Simple silly error of forgetting to null variables in a loop.

And I specifically don't walk the onboard tree, merely check the DB. The only time it should open a book is if the book exists in Nickel, but not in the metadata cache. Will instrument this to make sure though.I'll definitely have a bit of a think on how to speed this up though, as currently it is definitely slower than I'd like.

Thanks for the continued testing!

@shermp
Copy link
Owner Author

shermp commented May 5, 2019

Well, here's the relevant comment from the calibre driver that it doesn't sanitize filenames:
https://github.com/kovidgoyal/calibre/blob/56036fd77ae3cd1ddbeb9c9841a228e19785cdc3/src/calibre/devices/smart_device_app/driver.py#L434

Going to have to have a bit of a rethink as to how to handle this. There looks to be two possible options. I can ask calibre to send UUID filenames. Or there's the option CacheUsesLpaths that I could experiment with setting false. I guess the third option is to add the functionality as an option to the Calibre driver...

@shermp
Copy link
Owner Author

shermp commented May 6, 2019

Well, that wasn't too hard. The driver API accounts for this scenario, and allows us to change the 'lpath' if the Calibre generated one isn't suitable. Hopefully shermp/UNCaGED@cb4fc32 and 41798b2 fixes the filepath issue.

Since this fix updates UNCaGED as well, you will probably need to update that manually. A go get -u github.com/shermp/UNCaGED/uc should do that.

Next up, will have a think about how to make metadata collection/management more efficient...

@shermp
Copy link
Owner Author

shermp commented May 6, 2019

Ok, bff9e8a should dramatically speed up metadata collection.

In hindsight, performing individual single row DB queries for potentially hundreds or even thousands of books really was a rather silly idea wasn't it?

Now there's only one multi-row query out to the DB, and I create the final map there instead. Both simpler, and MUCH faster.

@NiLuJe
Copy link
Contributor

NiLuJe commented May 6, 2019

Success! :)

May  6 18:44:09 nickel: (  6123.566 @ 0x1756098 / ui.debug) Pruning file "file:///mnt/onboard/Kobo-UNCaGED.png" 
May  6 18:45:11 UNCaGED: Entering USBMS mode...
May  6 18:45:11 UNCaGED: Inserting USB
May  6 18:45:12 UNCaGED: Scanning for Button
May  6 18:45:16 UNCaGED: (Re)mounting onboard
May  6 18:45:18 UNCaGED: Enabling WiFi
May  6 18:45:19 UNCaGED: Acquiring IP
May  6 18:45:31 UNCaGED: USBMS mode entered . . .
May  6 18:45:31 UNCaGED: Running Kobo-UNCaGED
May  6 18:45:31 KoboUNCaGED[6455]: 2019/05/06 18:45:31 Started Kobo-UNCaGED
May  6 18:45:31 KoboUNCaGED[6455]: 2019/05/06 18:45:31 /mnt/newonboard
May  6 18:45:31 KoboUNCaGED[6455]: 2019/05/06 18:45:31 Creating KU object
May  6 18:45:39 KoboUNCaGED[6455]: 2019/05/06 18:45:39 Preparing Kobo UNCaGED!
May  6 18:45:39 KoboUNCaGED[6455]: 2019/05/06 18:45:39 Calibre Address 192.168.0.42:9090
May  6 18:45:39 KoboUNCaGED[6455]: 2019/05/06 18:45:39 Starting Calibre Connection
May  6 18:45:59 KoboUNCaGED[6455]: 2019/05/06 18:45:59 Send Book detail is: {...}
May  6 18:45:59 KoboUNCaGED[6455]: 2019/05/06 18:45:59 Sending OK-to-send packet
May  6 18:46:01 KoboUNCaGED[6455]: 2019/05/06 18:46:01 Send Book detail is: {...}
May  6 18:46:01 KoboUNCaGED[6455]: 2019/05/06 18:46:01 Sending OK-to-send packet
May  6 18:46:01 KoboUNCaGED[6455]: 2019/05/06 18:46:01 Send Book detail is: {...}
May  6 18:46:08 KoboUNCaGED[6455]: 2019/05/06 18:46:08 Sending OK-to-send packet
May  6 18:46:20 UNCaGED: Leaving USBMS . . .
May  6 18:46:20 UNCaGED: Disabling WiFi
May  6 18:46:21 UNCaGED: WiFi disabled (0) . . .
May  6 18:46:21 UNCaGED: Unmounting onboard
May  6 18:46:25 UNCaGED: Onboard unmounted (0) . . .
May  6 18:46:25 UNCaGED: Waiting for content processing
May  6 18:46:41 nickel: (  6275.708 @ 0x1fd0490 / ui.debug) Pruning file "file:///mnt/onboard/Kobo-UNCaGED.png" 
May  6 18:46:44 UNCaGED: Updating metadata . . .
May  6 18:46:44 UNCaGED: Entering USBMS mode . . .
May  6 18:46:44 UNCaGED: Scanning for Button
May  6 18:46:48 UNCaGED: (Re)mounting onboard
May  6 18:46:53 UNCaGED: Running Kobo-UNCaGED
May  6 18:46:53 KoboUNCaGED[6741]: 2019/05/06 18:46:53 Started Kobo-UNCaGED
May  6 18:46:53 KoboUNCaGED[6741]: 2019/05/06 18:46:53 /mnt/newonboard
May  6 18:46:53 KoboUNCaGED[6741]: 2019/05/06 18:46:53 Creating KU object
May  6 18:47:01 KoboUNCaGED[6741]: 2019/05/06 18:47:01 Updating Metadata
May  6 18:47:01 UNCaGED: Unmounting onboard
May  6 18:47:05 UNCaGED: Onboard unmounted (0) . . .
May  6 18:47:05 UNCaGED: Going back to Nickel
May  6 18:47:21 nickel: (  6315.593 @ 0x1fc3450 / ui.debug) Pruning file "file:///mnt/onboard/Kobo-UNCaGED.png"

@shermp
Copy link
Owner Author

shermp commented May 7, 2019

Finally have printing to screen working properly. It's probably a little (ok, more than just a little) fancier than is strictly required, but hey gotta use at least some of my FBInk feature requests :p

If you want to test it, I've updated go-fbink-v2 with a new function to aid printing a Go image.RGBA structure, and am using that new function.

I have to say, the valign option was giving me all sorts of grief, mainly because I kept forgetting that it applies to image/raw printing as well. So I would set it to center for printing OT text, then forgot to reset it in subsequent calls to print the image. And that in turn made button_scan barf. And I didn't notice the reason because my eink refresh calls were hiding the displacement.

Anyways, it's working now, and everything looks a lot nicer.

@shermp
Copy link
Owner Author

shermp commented May 7, 2019

On a related note, how much faster is providing print_raw_data with an 8bpp grayscale image instead of an RGBA image? If the speed up significantly faster, it might be worth it for me to switch to using that.

@NiLuJe
Copy link
Contributor

NiLuJe commented May 7, 2019 via email

@NiLuJe
Copy link
Contributor

NiLuJe commented May 7, 2019

Yeah, I've been caught unaware by *align stuff, mainly when I forget that I've set it earlier... >_<".

c.f., the dump/restore test for fun interactions between that and the H2O viewport ;p.

Besides not forgetting to reset the flag and/or bracket stuff that needs with a set/reset, one could also theoretically use a different FBInkConfig instance, but that's potentially trickier, unless you set it up at the same time you _init/_reinit, so it gets the same values that _init will enforce in there...

I usually temporarily switch to full-screen updates to make sure I don't do something stupid when I start playing with stuff like that ;).

@NiLuJe
Copy link
Contributor

NiLuJe commented May 7, 2019

Gave it a go, looks neat :).

Ann here's a couple of nitpicky suggestions on how to make use of that space ;).

I'd probably clear the footer on Eject in the first pass, and possibly print something there in the metadata pass when it's over.
In the first pass, right now you get a progression % that doesn't mean anything anymore mixed with the "we're going to restart" stuff; and on the second pass, the only new info comes from the wrapper, above the message box ;).

May  7 18:39:06 nickel: (  6761.066 @ 0x1ff0cf0 / ui.debug) Pruning file "file:///mnt/onboard/Kobo-UNCaGED.png" 
May  7 18:39:28 UNCaGED: Entering USBMS mode...
May  7 18:39:28 UNCaGED: Inserting USB
May  7 18:39:28 UNCaGED: Scanning for Button
May  7 18:39:33 UNCaGED: (Re)mounting onboard
May  7 18:39:34 UNCaGED: Enabling WiFi
May  7 18:39:36 UNCaGED: Acquiring IP
May  7 18:39:47 UNCaGED: USBMS mode entered . . .
May  7 18:39:47 UNCaGED: Running Kobo-UNCaGED
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 Started Kobo-UNCaGED
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 /mnt/newonboard
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 Creating KU object
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 MBox Width: 756   MBox Height: 756
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 Top Margin: 336, Bottom Margin: 942
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 Top Margin: 487, Bottom Margin: 489
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 Top Margin: 940, Bottom Margin: 338
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 Top Margin: 336, Bottom Margin: 942
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 Top Margin: 487, Bottom Margin: 489
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 Top Margin: 940, Bottom Margin: 338
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 Opening NickelDB
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 Getting Kobo Info
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 Getting Device Info
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 Reading Metadata
May  7 18:39:48 KoboUNCaGED[7387]: 2019/05/07 18:39:48 1 Reading metadata.calibre
May  7 18:39:50 KoboUNCaGED[7387]: 2019/05/07 18:39:50 1 Gathering metadata
May  7 18:39:56 KoboUNCaGED[7387]: 2019/05/07 18:39:56 Preparing Kobo UNCaGED!
May  7 18:39:56 KoboUNCaGED[7387]: 2019/05/07 18:39:56 Top Margin: 336, Bottom Margin: 942
May  7 18:39:56 KoboUNCaGED[7387]: 2019/05/07 18:39:56 Top Margin: 487, Bottom Margin: 489
May  7 18:39:56 KoboUNCaGED[7387]: 2019/05/07 18:39:56 Top Margin: 940, Bottom Margin: 338
May  7 18:39:56 KoboUNCaGED[7387]: 2019/05/07 18:39:56 Calibre Address 192.168.0.42:9090
May  7 18:39:56 KoboUNCaGED[7387]: 2019/05/07 18:39:56 Starting Calibre Connection
May  7 18:39:56 KoboUNCaGED[7387]: 2019/05/07 18:39:56 Top Margin: 336, Bottom Margin: 942
May  7 18:39:56 KoboUNCaGED[7387]: 2019/05/07 18:39:56 Top Margin: 487, Bottom Margin: 489
May  7 18:39:56 KoboUNCaGED[7387]: 2019/05/07 18:39:56 Top Margin: 940, Bottom Margin: 338
May  7 18:39:56 KoboUNCaGED[7387]: 2019/05/07 18:39:56 Top Margin: 336, Bottom Margin: 942
May  7 18:39:56 KoboUNCaGED[7387]: 2019/05/07 18:39:56 Top Margin: 487, Bottom Margin: 489
May  7 18:39:56 KoboUNCaGED[7387]: 2019/05/07 18:39:56 Top Margin: 940, Bottom Margin: 338
May  7 18:40:59 KoboUNCaGED[7387]: 2019/05/07 18:40:59 Send Book detail is: {...}
May  7 18:40:59 KoboUNCaGED[7387]: 2019/05/07 18:40:59 Top Margin: 336, Bottom Margin: 942
May  7 18:40:59 KoboUNCaGED[7387]: 2019/05/07 18:40:59 Top Margin: 487, Bottom Margin: 489
May  7 18:40:59 KoboUNCaGED[7387]: 2019/05/07 18:40:59 Top Margin: 940, Bottom Margin: 338
May  7 18:41:03 KoboUNCaGED[7387]: 2019/05/07 18:41:03 Sending OK-to-send packet
May  7 18:41:04 KoboUNCaGED[7387]: 2019/05/07 18:41:04 Top Margin: 336, Bottom Margin: 942
May  7 18:41:04 KoboUNCaGED[7387]: 2019/05/07 18:41:04 Top Margin: 487, Bottom Margin: 489
May  7 18:41:04 KoboUNCaGED[7387]: 2019/05/07 18:41:04 Top Margin: 940, Bottom Margin: 338
May  7 18:41:18 KoboUNCaGED[7387]: 2019/05/07 18:41:18 Top Margin: 336, Bottom Margin: 942
May  7 18:41:18 KoboUNCaGED[7387]: 2019/05/07 18:41:18 Top Margin: 487, Bottom Margin: 489
May  7 18:41:18 KoboUNCaGED[7387]: 2019/05/07 18:41:18 Top Margin: 940, Bottom Margin: 338
May  7 18:41:18 KoboUNCaGED[7387]: 2019/05/07 18:41:18 Top Margin: 336, Bottom Margin: 942
May  7 18:41:18 KoboUNCaGED[7387]: 2019/05/07 18:41:18 Top Margin: 487, Bottom Margin: 489
May  7 18:41:18 KoboUNCaGED[7387]: 2019/05/07 18:41:18 Top Margin: 940, Bottom Margin: 338
May  7 18:41:18 KoboUNCaGED[7387]: 2019/05/07 18:41:18 Top Margin: 336, Bottom Margin: 942
May  7 18:41:18 KoboUNCaGED[7387]: 2019/05/07 18:41:18 Top Margin: 487, Bottom Margin: 489
May  7 18:41:18 KoboUNCaGED[7387]: 2019/05/07 18:41:18 Top Margin: 940, Bottom Margin: 338
May  7 18:41:18 UNCaGED: Leaving USBMS . . .
May  7 18:41:18 UNCaGED: Disabling WiFi
May  7 18:41:19 UNCaGED: WiFi disabled (0) . . .
May  7 18:41:19 UNCaGED: Unmounting onboard
May  7 18:41:23 UNCaGED: Onboard unmounted (0) . . .
May  7 18:41:23 UNCaGED: Waiting for content processing
May  7 18:41:39 nickel: (  6914.237 @ 0xe812f0 / ui.debug) Pruning file "file:///mnt/onboard/Kobo-UNCaGED.png" 
May  7 18:41:40 UNCaGED: Updating metadata . . .
May  7 18:41:40 UNCaGED: Entering USBMS mode . . .
May  7 18:41:41 UNCaGED: Scanning for Button
May  7 18:41:43 UNCaGED: (Re)mounting onboard
May  7 18:41:46 UNCaGED: Running Kobo-UNCaGED
May  7 18:41:46 KoboUNCaGED[7658]: 2019/05/07 18:41:46 Started Kobo-UNCaGED
May  7 18:41:46 KoboUNCaGED[7658]: 2019/05/07 18:41:46 /mnt/newonboard
May  7 18:41:46 KoboUNCaGED[7658]: 2019/05/07 18:41:46 Creating KU object
May  7 18:41:47 KoboUNCaGED[7658]: 2019/05/07 18:41:47 MBox Width: 756   MBox Height: 756
May  7 18:41:47 KoboUNCaGED[7658]: 2019/05/07 18:41:47 Top Margin: 336, Bottom Margin: 942
May  7 18:41:47 KoboUNCaGED[7658]: 2019/05/07 18:41:47 Top Margin: 487, Bottom Margin: 489
May  7 18:41:47 KoboUNCaGED[7658]: 2019/05/07 18:41:47 Top Margin: 940, Bottom Margin: 338
May  7 18:41:47 KoboUNCaGED[7658]: 2019/05/07 18:41:47 Top Margin: 336, Bottom Margin: 942
May  7 18:41:47 KoboUNCaGED[7658]: 2019/05/07 18:41:47 Top Margin: 487, Bottom Margin: 489
May  7 18:41:47 KoboUNCaGED[7658]: 2019/05/07 18:41:47 Top Margin: 940, Bottom Margin: 338
May  7 18:41:47 KoboUNCaGED[7658]: 2019/05/07 18:41:47 Opening NickelDB
May  7 18:41:47 KoboUNCaGED[7658]: 2019/05/07 18:41:47 Getting Kobo Info
May  7 18:41:47 KoboUNCaGED[7658]: 2019/05/07 18:41:47 Getting Device Info
May  7 18:41:47 KoboUNCaGED[7658]: 2019/05/07 18:41:47 Reading Metadata
May  7 18:41:47 KoboUNCaGED[7658]: 2019/05/07 18:41:47 1 Reading metadata.calibre
May  7 18:41:49 KoboUNCaGED[7658]: 2019/05/07 18:41:49 1 Gathering metadata
May  7 18:41:54 KoboUNCaGED[7658]: 2019/05/07 18:41:54 Updating Metadata
May  7 18:41:54 KoboUNCaGED[7658]: 2019/05/07 18:41:54 Top Margin: 336, Bottom Margin: 942
May  7 18:41:54 KoboUNCaGED[7658]: 2019/05/07 18:41:54 Top Margin: 487, Bottom Margin: 489
May  7 18:41:54 KoboUNCaGED[7658]: 2019/05/07 18:41:54 Top Margin: 940, Bottom Margin: 338
May  7 18:41:55 UNCaGED: Unmounting onboard
May  7 18:42:03 UNCaGED: Onboard unmounted (0) . . .
May  7 18:42:03 UNCaGED: Going back to Nickel
May  7 18:42:20 nickel: (  6954.977 @ 0xd37b68 / ui.debug) Pruning file "file:///mnt/onboard/Kobo-UNCaGED.png"

@NiLuJe
Copy link
Contributor

NiLuJe commented May 7, 2019

Sidebar: I have no idea how the go get/build stuff works, but the build script will probably need some tweaks to make sure it always pulls/builds the latest stuff, even on rebuilds ;).

(Also, the same kind of info pointed out in the go-fbink-v2 README about how to set up the env probably needs to be shown somewhere ;)).

@shermp
Copy link
Owner Author

shermp commented May 7, 2019

Yeah, I'm aware some the content needs more work, Yesterday was about making sure the thing actually functions properly :)

Not sure about downloading updates from the build script. If people are doing any dev work, they may want to specifically use their current version on disk, and not update on every run of the build script. Will have a think about it.

@shermp
Copy link
Owner Author

shermp commented May 7, 2019

Have you got any ideas on making the enable_wifi bit of the shell script even safer? It currently doesn't check whether wpa_supplicant or udhcpc actually succeed in giving us a network.

wpa_cli looks like it should give us the wpa_supplicant status, but my initial naive attempt to check the status failed miserably.

@NiLuJe
Copy link
Contributor

NiLuJe commented May 8, 2019

I have no idea how those are supposed to work, but a generic "are we connected" check might be enough? (i.e., ping/check if there's a gateway/try to read something over HTTP). I think all of those are implemented one way or another in KOReader ;).

@shermp
Copy link
Owner Author

shermp commented May 8, 2019

Determining if we have an IP address should be easy enough. Parsing ip addr show ${INTERFACE} should do the job there. KU doesn't need an internet connection, just a LAN connection.

But there's no point trying to get an IP address if wpa_supplicant doesn't connect to a Wifi network. That's what I'd like to try and determine if possible.

@NiLuJe
Copy link
Contributor

NiLuJe commented May 8, 2019 via email

@pgaskin
Copy link
Contributor

pgaskin commented May 20, 2019

If this error doesn't appear after the first import, I don't think it is an issue. @shermp?

And ... what exactly is @kobothingy doing? 😕

@NiLuJe
Copy link
Contributor

NiLuJe commented May 20, 2019

FWIW:

May 20 20:32:29 KoboUNCaGED[2614]: 2019/05/20 20:32:29 [0x282A47 /home/niluje/MPLAYER/Kobo-UNCaGED/kobo-uncaged/main.go:239]: could not find nickel content to update: sql: no rows in result set

@shermp
Copy link
Owner Author

shermp commented May 20, 2019

Right, after doing a bit of repository maintenance, I can actually start looking at things.

While somewhat harmless, I do consider that an actual error. Basically, if you are replacing a book, it means its in the metadata map, and therefore it SHOULD also be in the database. That check is supposed to be a just-in-case test.

I'll have a look to see if anything jumps out at me.

@NiLuJe
Copy link
Contributor

NiLuJe commented May 20, 2019

That was on an initial import of a book (well, not exactly initial, as it was on the device at one point, but had been deleted from the UI, which should pretty much wipe any trace of it).

@shermp
Copy link
Owner Author

shermp commented May 20, 2019

Hmm, so that would indicate to me that has snuck (back) into the metadata cache somewhere. I'm having another look over the "read metadata" code now.

@shermp
Copy link
Owner Author

shermp commented May 20, 2019

Just another thought, did you send the book more than once in the same session? That could also explain the behavior.

@NiLuJe NiLuJe mentioned this issue May 20, 2019
@NiLuJe
Copy link
Contributor

NiLuJe commented May 20, 2019

I don't think so? I can reproduce it pretty much 100% of the time across different sessions, and I should only be sending books once per session, unless there's something seriously wonky with my "Send To Device" button ;).

Let me try with a file that the device's actually never seen, ever ;).

@NiLuJe
Copy link
Contributor

NiLuJe commented May 21, 2019

That works better when I don't forget to launch the service... I got to see the new "You're stupid and you forgot to enable the Wireless Service" message, at least :D.

But alas, same thing with a book I'm fairly sure the device's never ever heard of (also, an ePub and not a KePub, in case that makes a difference).

EDIT: And still no full-screen cover, either. Putting the device to sleep, I don't even get to see the placeholder text-only cover get replaced on-the-fly, like you usually do for unprocessed side-loaded content, it just happily appear to be directly upscaling one of those tiny thumbnails :/.

NOTE: I don't recall if I ever tested this in my original tests, though. Given how much I care about this stuff, I would think I did, but, err, this is starting to make me wonder...

@shermp
Copy link
Owner Author

shermp commented May 21, 2019

Aww crap. I'm beginning to wonder that if Nickel sees any type of pre-generated thumbnail, but no full cover, it uses the thumbnail instead of whatever's in the ebook :(

Starting to wonder if finding a small C resize library with ARM NEON optimizations might be the way to go.

@pgaskin
Copy link
Contributor

pgaskin commented May 21, 2019

@shermp it may be even better to port rez's assembly resizing: https://github.com/bamiaux/rez/blob/master/vscalers_amd64.s https://github.com/bamiaux/rez/blob/master/hscalers_amd64.s.

Update: Actually, I don't think it would be possible due to golang/go#7300.

Another update: Maybe it might if CL 57470 has all the instructions.

@NiLuJe
Copy link
Contributor

NiLuJe commented May 21, 2019

I ripped out Qt/imlib2's scaler for FBInk, and it has a marginally faster NEON implementation (as in, faster than its own C implementation, no idea how that compares to what you currently have), FWIW, c.f., https://github.com/NiLuJe/FBInk/tree/master/qimagescale

@shermp
Copy link
Owner Author

shermp commented May 21, 2019

My knowledge of assembly is essentially zilch. Let alone SIMD stuff. So it wouldn't be me doing the porting!

@shermp
Copy link
Owner Author

shermp commented May 21, 2019

Facepalms

Yeah, that SQL error is harmless. The function that produces is called regardless of whether it's actually needed.

Need to tweak tweak the logic slightly so it doesn't produce an error though.

@NiLuJe
Copy link
Contributor

NiLuJe commented May 21, 2019

I'm wondering if it's not a combination of populating the Nickel db AND shipping partial thumbnails.

I'd need to check if manually sideloading an ePub and manually shipping only a few of the thumbnails behaves the same.

That vaguely looks like something I might already have done in the past, and I fear that the answer is, yeah, it's all or nothing. But, still, FOR SCIENCE! :D.

@shermp
Copy link
Owner Author

shermp commented May 21, 2019

Note, that KU does not actually add any new rows to the Nickel DB. Or modify anything to do with images in the DB either. The only thing we do regarding images is create the directory structure that nickel would create and populate (some) of the images.

@NiLuJe
Copy link
Contributor

NiLuJe commented May 21, 2019

Random fun fact: I can't shutdown my H2O :D.

halt deadlocks, and poweroff makes the frontlight go crazy. :?.

@pgaskin
Copy link
Contributor

pgaskin commented May 21, 2019

Can you dmesg after a poweroff?

@NiLuJe
Copy link
Contributor

NiLuJe commented May 21, 2019

Probably not easily, as it appeared dead to the world, except for the power button (unlike the halt deadlock, where I had to pinhole hard reboot it).

By "crazy", I meant it properly turned off after a while, then started flickering on and off at a very slow frequency (like very sluggish keyboard LEDs during a kernel panic, so I'm going to assume it was a kernel panic ;p).

@NiLuJe
Copy link
Contributor

NiLuJe commented May 21, 2019

Now I probably know why the SD card is mounted RO: because you don't have any other solution than ripping it out like a savage :D.

@shermp
Copy link
Owner Author

shermp commented May 21, 2019

Random fun fact: I can't shutdown my H2O :D.

halt deadlocks, and poweroff makes the frontlight go crazy. :?.

I hope this is not a common issue, or an issue with KU!

@NiLuJe
Copy link
Contributor

NiLuJe commented May 21, 2019

Nah, probably one of the the usual "everything is racy as hell" NTX kernel issue ;).

@NiLuJe
Copy link
Contributor

NiLuJe commented May 21, 2019

Okay, yeah, bad news: same "no fullscreen cover" behavior when sideloading stuff by hand with half the thumbnails :/.

I took the opportunity to try ImageMagick's version of Qt::KeepAspectRatioByExpanding (i.e., the ^ suffix), and it appears to behave perfectly fine in practice :).

Starting from a fairly narrow cover @ 1391x2200, I ended up with a FULL @ 355x561 and a GRID @ 149x236. Not quite sure where each of 'em is used, but it's pretty much only downscaling at display time, which is good :).

Crappy test script to make sure I did things right:

#!/bin/env python2
import os
import sys

def qhash(inputstr):
    instr = b""
    if isinstance(inputstr, bytes):
        instr = inputstr
    elif isinstance(inputstr, unicode):
        instr = inputstr.encode("utf8")
    else:
        return -1

    h = 0x00000000
    for x in bytearray(instr):
        h = (h << 4) + x
        h ^= (h & 0xf0000000) >> 23
        h &= 0x0fffffff

    return h

ContentID = "file://" + "/mnt/onboard/TEST/" + sys.argv[1]

ImageID = ContentID.replace('/', '_')
ImageID = ImageID.replace(' ', '_')
ImageID = ImageID.replace(':', '_')
ImageID = ImageID.replace('.', '_')

hash1 = qhash(ImageID)
dir1  = hash1 & (0xff * 1)
dir2  = (hash1 & (0xff00 * 1)) >> 8
path = "/run/media/" + os.getenv("USER") + "/KOBOeReader/" + ".kobo-images/"
path = os.path.join(path, "%s" % dir1, "%s" % dir2)

im_args_pre = "-colorspace Lab -filter LanczosSharp -distort Resize"
im_args_post = "-colorspace sRGB -grayscale Rec709Luminance -colorspace sRGB -dither Riemersma -remap /home/niluje/SVN/Configs/trunk/Kindle/Touch_Hacks/ScreenSavers/src/linkss/etc/kindle_colors.gif -quality 75 png:"

im_args_pre_lb = "-colorspace sRGB -background black -gravity center -extent"
im_args_post_lb = "-grayscale Rec709Luminance -colorspace sRGB -dither Riemersma -remap /home/niluje/SVN/Configs/trunk/Kindle/Touch_Hacks/ScreenSavers/src/linkss/etc/kindle_colors.gif -quality 75 png:"

print("{}".format(path))
print
print("convert cover.jpg {} {} {} {} {}'{}'".format(im_args_pre, "1080x1429", im_args_pre_lb, "1080x1429\!", im_args_post_lb, ImageID + " - N3_FULL.parsed"))
print("convert cover.jpg {} {} {}'{}'".format(im_args_pre, "355x530\^", im_args_post, ImageID + " - N3_LIBRARY_FULL.parsed"))
print("convert cover.jpg {} {} {}'{}'".format(im_args_pre, "149x223\^", im_args_post, ImageID + " - N3_LIBRARY_GRID.parsed"))

@shermp
Copy link
Owner Author

shermp commented May 21, 2019

@NiLuJe I've just opened #15 that should fix the SQL error on sending books. (The main point of the PR is to make kepub handling less complicated)

@shermp
Copy link
Owner Author

shermp commented May 29, 2019

I'm thinking of releasing another public version with all the changes and improvements that have been made.

@NiLuJe when will you be ready to release a new version of kfmon? SD card users will need a version with the slightly relaxed mountpoint change limits.

@NiLuJe
Copy link
Contributor

NiLuJe commented May 31, 2019 via email

@shermp
Copy link
Owner Author

shermp commented May 31, 2019

I'm away for a few days, and I was in the middle of refactoring some stuff in kfmon, but I should be back basically early this week end to finish it I think ;).

Thanks for the update.

I've decided to do a bit of refactoring (mostly around code organisation, I'm moving stuff out of main into separate packages), so no rush.

@NiLuJe
Copy link
Contributor

NiLuJe commented Jun 6, 2019

I've finally released KFMon 1.3.0 ;).

Relevant to your interests, it will pickup new configs right after an USBMS session, meaning new users won't have to reboot after a brand new UNCaGED install (... as long as it's done via USBMS, and not through other, more esoteric means ^^) ;).

The release was slightly delayed because of a last minute experiment with replacing the boot progress bar, after I realized it was chewing through > 50% CPU on my H2O, which seemed a bit much to essentially draw 5 big pixels in the middle of the screen ;p.
This gave me an excuse to put your old activity bar FBInk feature request to some use, and, boom, shaved 10% off Nickel's boot times. -_-".

@shermp
Copy link
Owner Author

shermp commented Jun 6, 2019

Nice! I'll be suggesting that as the recommended minimum version for the next release (When I get time to finish my current PR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants