shermp / Kobo-UNCaGED

UNCaGED, for Kobo devices
GNU Affero General Public License v3.0
99 stars 7 forks source link

Initial testing #3

Open shermp opened 5 years ago

shermp commented 5 years ago

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

NiLuJe commented 5 years ago

I was on 4.13 the last time I tested this, FWIW, and never had any Wi-Fi issues ;).

shermp commented 5 years ago

So that's where the log is.

Here's an abridged log. I've removed all the FBInk stuff

[START] [2019-05-19 @ 18:58:57] [INFO] [PID: 572] Starting KFMon . . .
[START] [2019-05-19 @ 18:58:57] [INFO] [PID: 572] Launched KFMon! (Initial PID: 749)
[KFMon] [2019-05-19 @ 18:58:57] [INFO] [PID: 777] Initializing KFMon v1.2.16 (2019-04-28 17:57:30 +0200) | Using SQLite 3.28.0 (built against 3.28.0) | With FBInk v1.15.0-3-g2bc5b25 for Kobo
[KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kfmon.ini' . . .
[KFMon] [2019-05-19 @ 18:58:57] [NOTE] Daemon config loaded from 'kfmon.ini': db_timeout=500, use_syslog=0, with_notifications=1
[KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kfmon-log.ini' . . .
[KFMon] [2019-05-19 @ 18:58:57] [NOTE] Watch config @ index 0 loaded from 'kfmon-log.ini': filename=/mnt/onboard/kfmon.png, action=/mnt/onboard/.adds/kfmon/bin/kfmon-printlog.sh, block_spawns=0, do_db_update=0, db_title=KFMon Log, db_author=NiLuJe, db_comment=Print the last few lines of KFMon's log
[KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/koreader.ini' . . .
[KFMon] [2019-05-19 @ 18:58:57] [NOTE] Watch config @ index 1 loaded from 'koreader.ini': filename=/mnt/onboard/koreader.png, action=/mnt/onboard/.adds/koreader/koreader.sh, block_spawns=1, do_db_update=0, db_title=KOReader, db_author=KOReader Devs, db_comment=An eBook reader application
[KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/plato.ini' . . .
[KFMon] [2019-05-19 @ 18:58:57] [NOTE] Watch config @ index 2 loaded from 'plato.ini': filename=/mnt/onboard/icons/plato.png, action=/mnt/onboard/.adds/plato/plato.sh, block_spawns=1, do_db_update=0, db_title=Plato, db_author=Baskerville, db_comment=A document reader
[KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kobo-uncaged.ini' . . .
[KFMon] [2019-05-19 @ 18:58:58] [NOTE] Watch config @ index 3 loaded from 'kobo-uncaged.ini': filename=/mnt/onboard/Kobo-UNCaGED.png, action=/mnt/onboard/.adds/kobo-uncaged/start-ku.sh, block_spawns=1, do_db_update=0, db_title=Kobo UNCaGED, db_author=Sherman Perry, db_comment=A Calibre wireless client
[KFMon] [2019-05-19 @ 18:58:58] [INFO] Beginning the main loop.
[KFMon] [2019-05-19 @ 18:58:58] [INFO] Initializing inotify.
[KFMon] [2019-05-19 @ 18:58:58] [NOTE] Setup an inotify watch for '/mnt/onboard/kfmon.png' @ index 0.
[KFMon] [2019-05-19 @ 18:58:58] [NOTE] Setup an inotify watch for '/mnt/onboard/koreader.png' @ index 1.
[KFMon] [2019-05-19 @ 18:58:58] [NOTE] Setup an inotify watch for '/mnt/onboard/icons/plato.png' @ index 2.
[KFMon] [2019-05-19 @ 18:58:58] [NOTE] Setup an inotify watch for '/mnt/onboard/Kobo-UNCaGED.png' @ index 3.
[KFMon] [2019-05-19 @ 18:58:58] [INFO] Listening for events.
[KFMon] [2019-05-19 @ 18:59:24] [NOTE] Tripped IN_OPEN for /mnt/onboard/kfmon.png
[KFMon] [2019-05-19 @ 18:59:24] [NOTE] Tripped IN_CLOSE for /mnt/onboard/kfmon.png
[KFMon] [2019-05-19 @ 18:59:24] [INFO] Preparing to spawn /mnt/onboard/.adds/kfmon/bin/kfmon-printlog.sh for watch idx 0 . . .
[KFMon] [2019-05-19 @ 18:59:24] [NOTE] Spawned process 1042 (/mnt/onboard/kfmon.png -> /mnt/onboard/.adds/kfmon/bin/kfmon-printlog.sh @ watch idx 0) . . .
[KFMon] [2019-05-19 @ 18:59:24] [INFO] [TID: 1043] Waiting to reap process 1042 (from watch idx 0) . . .
[KFMon] [2019-05-19 @ 18:59:27] [NOTE] [TID: 1043] Reaped process 1042 (from watch idx 0): It exited with status 0.
[KFMon] [2019-05-19 @ 18:59:49] [NOTE] Tripped IN_OPEN for /mnt/onboard/Kobo-UNCaGED.png
[KFMon] [2019-05-19 @ 18:59:49] [NOTE] Tripped IN_CLOSE for /mnt/onboard/Kobo-UNCaGED.png
[KFMon] [2019-05-19 @ 18:59:49] [INFO] Preparing to spawn /mnt/onboard/.adds/kobo-uncaged/start-ku.sh for watch idx 3 . . .
[KFMon] [2019-05-19 @ 18:59:49] [NOTE] /mnt/onboard/.adds/kobo-uncaged/start-ku.sh is flagged as a spawn blocker, it will prevent *any* event from triggering a spawn while it is still running!
[KFMon] [2019-05-19 @ 18:59:49] [NOTE] Spawned process 1067 (/mnt/onboard/Kobo-UNCaGED.png -> /mnt/onboard/.adds/kobo-uncaged/start-ku.sh @ watch idx 3) . . .
[KFMon] [2019-05-19 @ 18:59:49] [INFO] [TID: 1069] Waiting to reap process 1067 (from watch idx 3) . . .
[KFMon] [2019-05-19 @ 18:59:53] [NOTE] Tripped IN_IGNORED for /mnt/onboard/Kobo-UNCaGED.png
[KFMon] [2019-05-19 @ 18:59:53] [INFO] Trying to remove inotify watch for '/mnt/onboard/kfmon.png' @ index 0.
[KFMon] [2019-05-19 @ 18:59:53] [INFO] Trying to remove inotify watch for '/mnt/onboard/koreader.png' @ index 1.
[KFMon] [2019-05-19 @ 18:59:53] [INFO] Trying to remove inotify watch for '/mnt/onboard/icons/plato.png' @ index 2.
[KFMon] [2019-05-19 @ 18:59:53] [INFO] Stopped listening for events.
[KFMon] [2019-05-19 @ 18:59:53] [INFO] Beginning the main loop.
[KFMon] [2019-05-19 @ 18:59:53] [INFO] Initializing inotify.
[KFMon] [2019-05-19 @ 18:59:53] [INFO] /mnt/onboard isn't mounted, waiting for it to be . . .
[KFMon] [2019-05-19 @ 18:59:53] [INFO] Mountpoints changed (iteration nr. 0)
[KFMon] [2019-05-19 @ 18:59:54] [INFO] Mountpoints changed (iteration nr. 1)
[KFMon] [2019-05-19 @ 18:59:56] [INFO] Mountpoints changed (iteration nr. 2)
[KFMon] [2019-05-19 @ 19:00:12] [INFO] Mountpoints changed (iteration nr. 3)
[KFMon] [2019-05-19 @ 19:00:13] [INFO] Mountpoints changed (iteration nr. 4)
[KFMon] [2019-05-19 @ 19:00:13] [ERR!] Too many mountpoint changes without finding our target (shutdown?), aborting!
[START] [2019-05-19 @ 19:11:44] [INFO] [PID: 572] Starting KFMon . . .
[START] [2019-05-19 @ 19:11:44] [INFO] [PID: 572] Launched KFMon! (Initial PID: 747)
[KFMon] [2019-05-19 @ 19:11:44] [INFO] [PID: 810] Initializing KFMon v1.2.16 (2019-04-28 17:57:30 +0200) | Using SQLite 3.28.0 (built against 3.28.0) | With FBInk v1.15.0-3-g2bc5b25 for Kobo
[KFMon] [2019-05-19 @ 19:11:45] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kfmon.ini' . . .
[KFMon] [2019-05-19 @ 19:11:45] [NOTE] Daemon config loaded from 'kfmon.ini': db_timeout=500, use_syslog=0, with_notifications=1
[KFMon] [2019-05-19 @ 19:11:45] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kfmon-log.ini' . . .
[KFMon] [2019-05-19 @ 19:11:45] [NOTE] Watch config @ index 0 loaded from 'kfmon-log.ini': filename=/mnt/onboard/kfmon.png, action=/mnt/onboard/.adds/kfmon/bin/kfmon-printlog.sh, block_spawns=0, do_db_update=0, db_title=KFMon Log, db_author=NiLuJe, db_comment=Print the last few lines of KFMon's log
[KFMon] [2019-05-19 @ 19:11:45] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kobo-uncaged.ini' . . .
[KFMon] [2019-05-19 @ 19:11:45] [NOTE] Watch config @ index 1 loaded from 'kobo-uncaged.ini': filename=/mnt/onboard/Kobo-UNCaGED.png, action=/mnt/onboard/.adds/kobo-uncaged/start-ku.sh, block_spawns=1, do_db_update=0, db_title=Kobo UNCaGED, db_author=Sherman Perry, db_comment=A Calibre wireless client
[KFMon] [2019-05-19 @ 19:11:45] [INFO] Beginning the main loop.
[KFMon] [2019-05-19 @ 19:11:45] [INFO] Initializing inotify.
[KFMon] [2019-05-19 @ 19:11:45] [NOTE] Setup an inotify watch for '/mnt/onboard/kfmon.png' @ index 0.
[KFMon] [2019-05-19 @ 19:11:45] [NOTE] Setup an inotify watch for '/mnt/onboard/Kobo-UNCaGED.png' @ index 1.
[KFMon] [2019-05-19 @ 19:11:45] [INFO] Listening for events.
[KFMon] [2019-05-19 @ 19:12:19] [NOTE] Tripped IN_OPEN for /mnt/onboard/Kobo-UNCaGED.png
[KFMon] [2019-05-19 @ 19:12:19] [NOTE] Tripped IN_CLOSE for /mnt/onboard/Kobo-UNCaGED.png
[KFMon] [2019-05-19 @ 19:12:19] [INFO] Preparing to spawn /mnt/onboard/.adds/kobo-uncaged/start-ku.sh for watch idx 1 . . .
[KFMon] [2019-05-19 @ 19:12:19] [NOTE] /mnt/onboard/.adds/kobo-uncaged/start-ku.sh is flagged as a spawn blocker, it will prevent *any* event from triggering a spawn while it is still running!
[KFMon] [2019-05-19 @ 19:12:19] [NOTE] Spawned process 1038 (/mnt/onboard/Kobo-UNCaGED.png -> /mnt/onboard/.adds/kobo-uncaged/start-ku.sh @ watch idx 1) . . .
[KFMon] [2019-05-19 @ 19:12:19] [INFO] [TID: 1039] Waiting to reap process 1038 (from watch idx 1) . . .
[KFMon] [2019-05-19 @ 19:12:24] [NOTE] Tripped IN_IGNORED for /mnt/onboard/Kobo-UNCaGED.png
[KFMon] [2019-05-19 @ 19:12:24] [INFO] Trying to remove inotify watch for '/mnt/onboard/kfmon.png' @ index 0.
[KFMon] [2019-05-19 @ 19:12:24] [INFO] Stopped listening for events.
[KFMon] [2019-05-19 @ 19:12:24] [INFO] Beginning the main loop.
[KFMon] [2019-05-19 @ 19:12:24] [INFO] Initializing inotify.
[KFMon] [2019-05-19 @ 19:12:24] [INFO] /mnt/onboard isn't mounted, waiting for it to be . . .
[KFMon] [2019-05-19 @ 19:12:25] [INFO] Mountpoints changed (iteration nr. 0)
[KFMon] [2019-05-19 @ 19:12:26] [INFO] Mountpoints changed (iteration nr. 1)
[KFMon] [2019-05-19 @ 19:12:27] [INFO] Mountpoints changed (iteration nr. 2)
[KFMon] [2019-05-19 @ 19:13:17] [INFO] Mountpoints changed (iteration nr. 3)
[KFMon] [2019-05-19 @ 19:13:18] [INFO] Mountpoints changed (iteration nr. 4)
[KFMon] [2019-05-19 @ 19:13:18] [ERR!] Too many mountpoint changes without finding our target (shutdown?), aborting!

I think it's pretty bleeding obvious from that log that I've broken the mount/unmount process :(


As far as Wifi is concerned, I was having no issues at all with FW 4.13. I'll have another go with it once the mount/unmount problems are solved.

NiLuJe commented 5 years ago

How many mount/unmount actions are you actually doing? I'd naively assume something like 4, right?

It may just be a case of KFMon being a tad too picky and giving up too early (https://github.com/NiLuJe/kfmon/blob/master/kfmon.c#L216)...

What do the system logs say? Does nickel actually behave? If you try a real USBMS session after that, can you actually make changes to the FS that "stick"?

On Sun, May 19, 2019, 10:40 Sherman Perry notifications@github.com wrote:

So that's where the log is.

Here's an abridged log. I've removed all the FBInk stuff

[START] [2019-05-19 @ 18:58:57] [INFO] [PID: 572] Starting KFMon . . . [START] [2019-05-19 @ 18:58:57] [INFO] [PID: 572] Launched KFMon! (Initial PID: 749) [KFMon] [2019-05-19 @ 18:58:57] [INFO] [PID: 777] Initializing KFMon v1.2.16 (2019-04-28 17:57:30 +0200) | Using SQLite 3.28.0 (built against 3.28.0) | With FBInk v1.15.0-3-g2bc5b25 for Kobo [KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kfmon.ini' . . . [KFMon] [2019-05-19 @ 18:58:57] [NOTE] Daemon config loaded from 'kfmon.ini': db_timeout=500, use_syslog=0, with_notifications=1 [KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kfmon-log.ini' . . . [KFMon] [2019-05-19 @ 18:58:57] [NOTE] Watch config @ index 0 loaded from 'kfmon-log.ini': filename=/mnt/onboard/kfmon.png, action=/mnt/onboard/.adds/kfmon/bin/kfmon-printlog.sh, block_spawns=0, do_db_update=0, db_title=KFMon Log, db_author=NiLuJe, db_comment=Print the last few lines of KFMon's log [KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/koreader.ini' . . . [KFMon] [2019-05-19 @ 18:58:57] [NOTE] Watch config @ index 1 loaded from 'koreader.ini': filename=/mnt/onboard/koreader.png, action=/mnt/onboard/.adds/koreader/koreader.sh, block_spawns=1, do_db_update=0, db_title=KOReader, db_author=KOReader Devs, db_comment=An eBook reader application [KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/plato.ini' . . . [KFMon] [2019-05-19 @ 18:58:57] [NOTE] Watch config @ index 2 loaded from 'plato.ini': filename=/mnt/onboard/icons/plato.png, action=/mnt/onboard/.adds/plato/plato.sh, block_spawns=1, do_db_update=0, db_title=Plato, db_author=Baskerville, db_comment=A document reader [KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kobo-uncaged.ini' . . . [KFMon] [2019-05-19 @ 18:58:58] [NOTE] Watch config @ index 3 loaded from 'kobo-uncaged.ini': filename=/mnt/onboard/Kobo-UNCaGED.png, action=/mnt/onboard/.adds/kobo-uncaged/start-ku.sh, block_spawns=1, do_db_update=0, db_title=Kobo UNCaGED, db_author=Sherman Perry, db_comment=A Calibre wireless client [KFMon] [2019-05-19 @ 18:58:58] [INFO] Beginning the main loop. [KFMon] [2019-05-19 @ 18:58:58] [INFO] Initializing inotify. [KFMon] [2019-05-19 @ 18:58:58] [NOTE] Setup an inotify watch for '/mnt/onboard/kfmon.png' @ index 0. [KFMon] [2019-05-19 @ 18:58:58] [NOTE] Setup an inotify watch for '/mnt/onboard/koreader.png' @ index 1. [KFMon] [2019-05-19 @ 18:58:58] [NOTE] Setup an inotify watch for '/mnt/onboard/icons/plato.png' @ index 2. [KFMon] [2019-05-19 @ 18:58:58] [NOTE] Setup an inotify watch for '/mnt/onboard/Kobo-UNCaGED.png' @ index 3. [KFMon] [2019-05-19 @ 18:58:58] [INFO] Listening for events. [KFMon] [2019-05-19 @ 18:59:24] [NOTE] Tripped IN_OPEN for /mnt/onboard/kfmon.png [KFMon] [2019-05-19 @ 18:59:24] [NOTE] Tripped IN_CLOSE for /mnt/onboard/kfmon.png [KFMon] [2019-05-19 @ 18:59:24] [INFO] Preparing to spawn /mnt/onboard/.adds/kfmon/bin/kfmon-printlog.sh for watch idx 0 . . . [KFMon] [2019-05-19 @ 18:59:24] [NOTE] Spawned process 1042 (/mnt/onboard/kfmon.png -> /mnt/onboard/.adds/kfmon/bin/kfmon-printlog.sh @ watch idx 0) . . . [KFMon] [2019-05-19 @ 18:59:24] [INFO] [TID: 1043] Waiting to reap process 1042 (from watch idx 0) . . . [KFMon] [2019-05-19 @ 18:59:27] [NOTE] [TID: 1043] Reaped process 1042 (from watch idx 0): It exited with status 0. [KFMon] [2019-05-19 @ 18:59:49] [NOTE] Tripped IN_OPEN for /mnt/onboard/Kobo-UNCaGED.png [KFMon] [2019-05-19 @ 18:59:49] [NOTE] Tripped IN_CLOSE for /mnt/onboard/Kobo-UNCaGED.png [KFMon] [2019-05-19 @ 18:59:49] [INFO] Preparing to spawn /mnt/onboard/.adds/kobo-uncaged/start-ku.sh for watch idx 3 . . . [KFMon] [2019-05-19 @ 18:59:49] [NOTE] /mnt/onboard/.adds/kobo-uncaged/start-ku.sh is flagged as a spawn blocker, it will prevent any event from triggering a spawn while it is still running! [KFMon] [2019-05-19 @ 18:59:49] [NOTE] Spawned process 1067 (/mnt/onboard/Kobo-UNCaGED.png -> /mnt/onboard/.adds/kobo-uncaged/start-ku.sh @ watch idx 3) . . . [KFMon] [2019-05-19 @ 18:59:49] [INFO] [TID: 1069] Waiting to reap process 1067 (from watch idx 3) . . . [KFMon] [2019-05-19 @ 18:59:53] [NOTE] Tripped IN_IGNORED for /mnt/onboard/Kobo-UNCaGED.png [KFMon] [2019-05-19 @ 18:59:53] [INFO] Trying to remove inotify watch for '/mnt/onboard/kfmon.png' @ index 0. [KFMon] [2019-05-19 @ 18:59:53] [INFO] Trying to remove inotify watch for '/mnt/onboard/koreader.png' @ index 1. [KFMon] [2019-05-19 @ 18:59:53] [INFO] Trying to remove inotify watch for '/mnt/onboard/icons/plato.png' @ index 2. [KFMon] [2019-05-19 @ 18:59:53] [INFO] Stopped listening for events. [KFMon] [2019-05-19 @ 18:59:53] [INFO] Beginning the main loop. [KFMon] [2019-05-19 @ 18:59:53] [INFO] Initializing inotify. [KFMon] [2019-05-19 @ 18:59:53] [INFO] /mnt/onboard isn't mounted, waiting for it to be . . . [KFMon] [2019-05-19 @ 18:59:53] [INFO] Mountpoints changed (iteration nr. 0) [KFMon] [2019-05-19 @ 18:59:54] [INFO] Mountpoints changed (iteration nr. 1) [KFMon] [2019-05-19 @ 18:59:56] [INFO] Mountpoints changed (iteration nr. 2) [KFMon] [2019-05-19 @ 19:00:12] [INFO] Mountpoints changed (iteration nr. 3) [KFMon] [2019-05-19 @ 19:00:13] [INFO] Mountpoints changed (iteration nr. 4) [KFMon] [2019-05-19 @ 19:00:13] [ERR!] Too many mountpoint changes without finding our target (shutdown?), aborting! [START] [2019-05-19 @ 19:11:44] [INFO] [PID: 572] Starting KFMon . . . [START] [2019-05-19 @ 19:11:44] [INFO] [PID: 572] Launched KFMon! (Initial PID: 747) [KFMon] [2019-05-19 @ 19:11:44] [INFO] [PID: 810] Initializing KFMon v1.2.16 (2019-04-28 17:57:30 +0200) | Using SQLite 3.28.0 (built against 3.28.0) | With FBInk v1.15.0-3-g2bc5b25 for Kobo [KFMon] [2019-05-19 @ 19:11:45] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kfmon.ini' . . . [KFMon] [2019-05-19 @ 19:11:45] [NOTE] Daemon config loaded from 'kfmon.ini': db_timeout=500, use_syslog=0, with_notifications=1 [KFMon] [2019-05-19 @ 19:11:45] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kfmon-log.ini' . . . [KFMon] [2019-05-19 @ 19:11:45] [NOTE] Watch config @ index 0 loaded from 'kfmon-log.ini': filename=/mnt/onboard/kfmon.png, action=/mnt/onboard/.adds/kfmon/bin/kfmon-printlog.sh, block_spawns=0, do_db_update=0, db_title=KFMon Log, db_author=NiLuJe, db_comment=Print the last few lines of KFMon's log [KFMon] [2019-05-19 @ 19:11:45] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kobo-uncaged.ini' . . . [KFMon] [2019-05-19 @ 19:11:45] [NOTE] Watch config @ index 1 loaded from 'kobo-uncaged.ini': filename=/mnt/onboard/Kobo-UNCaGED.png, action=/mnt/onboard/.adds/kobo-uncaged/start-ku.sh, block_spawns=1, do_db_update=0, db_title=Kobo UNCaGED, db_author=Sherman Perry, db_comment=A Calibre wireless client [KFMon] [2019-05-19 @ 19:11:45] [INFO] Beginning the main loop. [KFMon] [2019-05-19 @ 19:11:45] [INFO] Initializing inotify. [KFMon] [2019-05-19 @ 19:11:45] [NOTE] Setup an inotify watch for '/mnt/onboard/kfmon.png' @ index 0. [KFMon] [2019-05-19 @ 19:11:45] [NOTE] Setup an inotify watch for '/mnt/onboard/Kobo-UNCaGED.png' @ index 1. [KFMon] [2019-05-19 @ 19:11:45] [INFO] Listening for events. [KFMon] [2019-05-19 @ 19:12:19] [NOTE] Tripped IN_OPEN for /mnt/onboard/Kobo-UNCaGED.png [KFMon] [2019-05-19 @ 19:12:19] [NOTE] Tripped IN_CLOSE for /mnt/onboard/Kobo-UNCaGED.png [KFMon] [2019-05-19 @ 19:12:19] [INFO] Preparing to spawn /mnt/onboard/.adds/kobo-uncaged/start-ku.sh for watch idx 1 . . . [KFMon] [2019-05-19 @ 19:12:19] [NOTE] /mnt/onboard/.adds/kobo-uncaged/start-ku.sh is flagged as a spawn blocker, it will prevent any event from triggering a spawn while it is still running! [KFMon] [2019-05-19 @ 19:12:19] [NOTE] Spawned process 1038 (/mnt/onboard/Kobo-UNCaGED.png -> /mnt/onboard/.adds/kobo-uncaged/start-ku.sh @ watch idx 1) . . . [KFMon] [2019-05-19 @ 19:12:19] [INFO] [TID: 1039] Waiting to reap process 1038 (from watch idx 1) . . . [KFMon] [2019-05-19 @ 19:12:24] [NOTE] Tripped IN_IGNORED for /mnt/onboard/Kobo-UNCaGED.png [KFMon] [2019-05-19 @ 19:12:24] [INFO] Trying to remove inotify watch for '/mnt/onboard/kfmon.png' @ index 0. [KFMon] [2019-05-19 @ 19:12:24] [INFO] Stopped listening for events. [KFMon] [2019-05-19 @ 19:12:24] [INFO] Beginning the main loop. [KFMon] [2019-05-19 @ 19:12:24] [INFO] Initializing inotify. [KFMon] [2019-05-19 @ 19:12:24] [INFO] /mnt/onboard isn't mounted, waiting for it to be . . . [KFMon] [2019-05-19 @ 19:12:25] [INFO] Mountpoints changed (iteration nr. 0) [KFMon] [2019-05-19 @ 19:12:26] [INFO] Mountpoints changed (iteration nr. 1) [KFMon] [2019-05-19 @ 19:12:27] [INFO] Mountpoints changed (iteration nr. 2) [KFMon] [2019-05-19 @ 19:13:17] [INFO] Mountpoints changed (iteration nr. 3) [KFMon] [2019-05-19 @ 19:13:18] [INFO] Mountpoints changed (iteration nr. 4) [KFMon] [2019-05-19 @ 19:13:18] [ERR!] Too many mountpoint changes without finding our target (shutdown?), aborting!

I think it's pretty bleeding obvious from that log that I've broken the mount/unmount process :(

As far as Wifi is concerned, I was having no issues at all with FW 4.13. I'll have another go with it once the mount/unmount problems are solved.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/shermp/Kobo-UNCaGED/issues/3?email_source=notifications&email_token=AAA3KZRADK5LUYWMD6YOZG3PWEHAJA5CNFSM4HKXERBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVW5R5Y#issuecomment-493738231, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA3KZQ2457PXYY5QTALVXLPWEHAJANCNFSM4HKXERBA .

NiLuJe commented 5 years ago

Note to self: button scan also has a copy of the same heuristics ( https://github.com/NiLuJe/FBInk/blob/master/fbink_button_scan.c#L66).

On Sun, May 19, 2019, 10:52 NiLuJe ninuje@gmail.com wrote:

How many mount/unmount actions are you actually doing? I'd naively assume something like 4, right?

It may just be a case of KFMon being a tad too picky and giving up too early (https://github.com/NiLuJe/kfmon/blob/master/kfmon.c#L216)...

What do the system logs say? Does nickel actually behave? If you try a real USBMS session after that, can you actually make changes to the FS that "stick"?

On Sun, May 19, 2019, 10:40 Sherman Perry notifications@github.com wrote:

So that's where the log is.

Here's an abridged log. I've removed all the FBInk stuff

[START] [2019-05-19 @ 18:58:57] [INFO] [PID: 572] Starting KFMon . . . [START] [2019-05-19 @ 18:58:57] [INFO] [PID: 572] Launched KFMon! (Initial PID: 749) [KFMon] [2019-05-19 @ 18:58:57] [INFO] [PID: 777] Initializing KFMon v1.2.16 (2019-04-28 17:57:30 +0200) | Using SQLite 3.28.0 (built against 3.28.0) | With FBInk v1.15.0-3-g2bc5b25 for Kobo [KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kfmon.ini' . . . [KFMon] [2019-05-19 @ 18:58:57] [NOTE] Daemon config loaded from 'kfmon.ini': db_timeout=500, use_syslog=0, with_notifications=1 [KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kfmon-log.ini' . . . [KFMon] [2019-05-19 @ 18:58:57] [NOTE] Watch config @ index 0 loaded from 'kfmon-log.ini': filename=/mnt/onboard/kfmon.png, action=/mnt/onboard/.adds/kfmon/bin/kfmon-printlog.sh, block_spawns=0, do_db_update=0, db_title=KFMon Log, db_author=NiLuJe, db_comment=Print the last few lines of KFMon's log [KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/koreader.ini' . . . [KFMon] [2019-05-19 @ 18:58:57] [NOTE] Watch config @ index 1 loaded from 'koreader.ini': filename=/mnt/onboard/koreader.png, action=/mnt/onboard/.adds/koreader/koreader.sh, block_spawns=1, do_db_update=0, db_title=KOReader, db_author=KOReader Devs, db_comment=An eBook reader application [KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/plato.ini' . . . [KFMon] [2019-05-19 @ 18:58:57] [NOTE] Watch config @ index 2 loaded from 'plato.ini': filename=/mnt/onboard/icons/plato.png, action=/mnt/onboard/.adds/plato/plato.sh, block_spawns=1, do_db_update=0, db_title=Plato, db_author=Baskerville, db_comment=A document reader [KFMon] [2019-05-19 @ 18:58:57] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kobo-uncaged.ini' . . . [KFMon] [2019-05-19 @ 18:58:58] [NOTE] Watch config @ index 3 loaded from 'kobo-uncaged.ini': filename=/mnt/onboard/Kobo-UNCaGED.png, action=/mnt/onboard/.adds/kobo-uncaged/start-ku.sh, block_spawns=1, do_db_update=0, db_title=Kobo UNCaGED, db_author=Sherman Perry, db_comment=A Calibre wireless client [KFMon] [2019-05-19 @ 18:58:58] [INFO] Beginning the main loop. [KFMon] [2019-05-19 @ 18:58:58] [INFO] Initializing inotify. [KFMon] [2019-05-19 @ 18:58:58] [NOTE] Setup an inotify watch for '/mnt/onboard/kfmon.png' @ index 0. [KFMon] [2019-05-19 @ 18:58:58] [NOTE] Setup an inotify watch for '/mnt/onboard/koreader.png' @ index 1. [KFMon] [2019-05-19 @ 18:58:58] [NOTE] Setup an inotify watch for '/mnt/onboard/icons/plato.png' @ index 2. [KFMon] [2019-05-19 @ 18:58:58] [NOTE] Setup an inotify watch for '/mnt/onboard/Kobo-UNCaGED.png' @ index 3. [KFMon] [2019-05-19 @ 18:58:58] [INFO] Listening for events. [KFMon] [2019-05-19 @ 18:59:24] [NOTE] Tripped IN_OPEN for /mnt/onboard/kfmon.png [KFMon] [2019-05-19 @ 18:59:24] [NOTE] Tripped IN_CLOSE for /mnt/onboard/kfmon.png [KFMon] [2019-05-19 @ 18:59:24] [INFO] Preparing to spawn /mnt/onboard/.adds/kfmon/bin/kfmon-printlog.sh for watch idx 0 . . . [KFMon] [2019-05-19 @ 18:59:24] [NOTE] Spawned process 1042 (/mnt/onboard/kfmon.png -> /mnt/onboard/.adds/kfmon/bin/kfmon-printlog.sh @ watch idx 0) . . . [KFMon] [2019-05-19 @ 18:59:24] [INFO] [TID: 1043] Waiting to reap process 1042 (from watch idx 0) . . . [KFMon] [2019-05-19 @ 18:59:27] [NOTE] [TID: 1043] Reaped process 1042 (from watch idx 0): It exited with status 0. [KFMon] [2019-05-19 @ 18:59:49] [NOTE] Tripped IN_OPEN for /mnt/onboard/Kobo-UNCaGED.png [KFMon] [2019-05-19 @ 18:59:49] [NOTE] Tripped IN_CLOSE for /mnt/onboard/Kobo-UNCaGED.png [KFMon] [2019-05-19 @ 18:59:49] [INFO] Preparing to spawn /mnt/onboard/.adds/kobo-uncaged/start-ku.sh for watch idx 3 . . . [KFMon] [2019-05-19 @ 18:59:49] [NOTE] /mnt/onboard/.adds/kobo-uncaged/start-ku.sh is flagged as a spawn blocker, it will prevent any event from triggering a spawn while it is still running! [KFMon] [2019-05-19 @ 18:59:49] [NOTE] Spawned process 1067 (/mnt/onboard/Kobo-UNCaGED.png -> /mnt/onboard/.adds/kobo-uncaged/start-ku.sh @ watch idx 3) . . . [KFMon] [2019-05-19 @ 18:59:49] [INFO] [TID: 1069] Waiting to reap process 1067 (from watch idx 3) . . . [KFMon] [2019-05-19 @ 18:59:53] [NOTE] Tripped IN_IGNORED for /mnt/onboard/Kobo-UNCaGED.png [KFMon] [2019-05-19 @ 18:59:53] [INFO] Trying to remove inotify watch for '/mnt/onboard/kfmon.png' @ index 0. [KFMon] [2019-05-19 @ 18:59:53] [INFO] Trying to remove inotify watch for '/mnt/onboard/koreader.png' @ index 1. [KFMon] [2019-05-19 @ 18:59:53] [INFO] Trying to remove inotify watch for '/mnt/onboard/icons/plato.png' @ index 2. [KFMon] [2019-05-19 @ 18:59:53] [INFO] Stopped listening for events. [KFMon] [2019-05-19 @ 18:59:53] [INFO] Beginning the main loop. [KFMon] [2019-05-19 @ 18:59:53] [INFO] Initializing inotify. [KFMon] [2019-05-19 @ 18:59:53] [INFO] /mnt/onboard isn't mounted, waiting for it to be . . . [KFMon] [2019-05-19 @ 18:59:53] [INFO] Mountpoints changed (iteration nr. 0) [KFMon] [2019-05-19 @ 18:59:54] [INFO] Mountpoints changed (iteration nr. 1) [KFMon] [2019-05-19 @ 18:59:56] [INFO] Mountpoints changed (iteration nr. 2) [KFMon] [2019-05-19 @ 19:00:12] [INFO] Mountpoints changed (iteration nr. 3) [KFMon] [2019-05-19 @ 19:00:13] [INFO] Mountpoints changed (iteration nr. 4) [KFMon] [2019-05-19 @ 19:00:13] [ERR!] Too many mountpoint changes without finding our target (shutdown?), aborting! [START] [2019-05-19 @ 19:11:44] [INFO] [PID: 572] Starting KFMon . . . [START] [2019-05-19 @ 19:11:44] [INFO] [PID: 572] Launched KFMon! (Initial PID: 747) [KFMon] [2019-05-19 @ 19:11:44] [INFO] [PID: 810] Initializing KFMon v1.2.16 (2019-04-28 17:57:30 +0200) | Using SQLite 3.28.0 (built against 3.28.0) | With FBInk v1.15.0-3-g2bc5b25 for Kobo [KFMon] [2019-05-19 @ 19:11:45] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kfmon.ini' . . . [KFMon] [2019-05-19 @ 19:11:45] [NOTE] Daemon config loaded from 'kfmon.ini': db_timeout=500, use_syslog=0, with_notifications=1 [KFMon] [2019-05-19 @ 19:11:45] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kfmon-log.ini' . . . [KFMon] [2019-05-19 @ 19:11:45] [NOTE] Watch config @ index 0 loaded from 'kfmon-log.ini': filename=/mnt/onboard/kfmon.png, action=/mnt/onboard/.adds/kfmon/bin/kfmon-printlog.sh, block_spawns=0, do_db_update=0, db_title=KFMon Log, db_author=NiLuJe, db_comment=Print the last few lines of KFMon's log [KFMon] [2019-05-19 @ 19:11:45] [INFO] Trying to load config file '/mnt/onboard/.adds/kfmon/config/kobo-uncaged.ini' . . . [KFMon] [2019-05-19 @ 19:11:45] [NOTE] Watch config @ index 1 loaded from 'kobo-uncaged.ini': filename=/mnt/onboard/Kobo-UNCaGED.png, action=/mnt/onboard/.adds/kobo-uncaged/start-ku.sh, block_spawns=1, do_db_update=0, db_title=Kobo UNCaGED, db_author=Sherman Perry, db_comment=A Calibre wireless client [KFMon] [2019-05-19 @ 19:11:45] [INFO] Beginning the main loop. [KFMon] [2019-05-19 @ 19:11:45] [INFO] Initializing inotify. [KFMon] [2019-05-19 @ 19:11:45] [NOTE] Setup an inotify watch for '/mnt/onboard/kfmon.png' @ index 0. [KFMon] [2019-05-19 @ 19:11:45] [NOTE] Setup an inotify watch for '/mnt/onboard/Kobo-UNCaGED.png' @ index 1. [KFMon] [2019-05-19 @ 19:11:45] [INFO] Listening for events. [KFMon] [2019-05-19 @ 19:12:19] [NOTE] Tripped IN_OPEN for /mnt/onboard/Kobo-UNCaGED.png [KFMon] [2019-05-19 @ 19:12:19] [NOTE] Tripped IN_CLOSE for /mnt/onboard/Kobo-UNCaGED.png [KFMon] [2019-05-19 @ 19:12:19] [INFO] Preparing to spawn /mnt/onboard/.adds/kobo-uncaged/start-ku.sh for watch idx 1 . . . [KFMon] [2019-05-19 @ 19:12:19] [NOTE] /mnt/onboard/.adds/kobo-uncaged/start-ku.sh is flagged as a spawn blocker, it will prevent any event from triggering a spawn while it is still running! [KFMon] [2019-05-19 @ 19:12:19] [NOTE] Spawned process 1038 (/mnt/onboard/Kobo-UNCaGED.png -> /mnt/onboard/.adds/kobo-uncaged/start-ku.sh @ watch idx 1) . . . [KFMon] [2019-05-19 @ 19:12:19] [INFO] [TID: 1039] Waiting to reap process 1038 (from watch idx 1) . . . [KFMon] [2019-05-19 @ 19:12:24] [NOTE] Tripped IN_IGNORED for /mnt/onboard/Kobo-UNCaGED.png [KFMon] [2019-05-19 @ 19:12:24] [INFO] Trying to remove inotify watch for '/mnt/onboard/kfmon.png' @ index 0. [KFMon] [2019-05-19 @ 19:12:24] [INFO] Stopped listening for events. [KFMon] [2019-05-19 @ 19:12:24] [INFO] Beginning the main loop. [KFMon] [2019-05-19 @ 19:12:24] [INFO] Initializing inotify. [KFMon] [2019-05-19 @ 19:12:24] [INFO] /mnt/onboard isn't mounted, waiting for it to be . . . [KFMon] [2019-05-19 @ 19:12:25] [INFO] Mountpoints changed (iteration nr. 0) [KFMon] [2019-05-19 @ 19:12:26] [INFO] Mountpoints changed (iteration nr. 1) [KFMon] [2019-05-19 @ 19:12:27] [INFO] Mountpoints changed (iteration nr. 2) [KFMon] [2019-05-19 @ 19:13:17] [INFO] Mountpoints changed (iteration nr. 3) [KFMon] [2019-05-19 @ 19:13:18] [INFO] Mountpoints changed (iteration nr. 4) [KFMon] [2019-05-19 @ 19:13:18] [ERR!] Too many mountpoint changes without finding our target (shutdown?), aborting!

I think it's pretty bleeding obvious from that log that I've broken the mount/unmount process :(

As far as Wifi is concerned, I was having no issues at all with FW 4.13. I'll have another go with it once the mount/unmount problems are solved.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/shermp/Kobo-UNCaGED/issues/3?email_source=notifications&email_token=AAA3KZRADK5LUYWMD6YOZG3PWEHAJA5CNFSM4HKXERBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVW5R5Y#issuecomment-493738231, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA3KZQ2457PXYY5QTALVXLPWEHAJANCNFSM4HKXERBA .

shermp commented 5 years ago

Um, well, SD card basically doubles the number of mounts.

So, potentially 8 mount/dismount events in total. 2 Mounts, then 2 dismounts, then if it needs to restart again for metadata, another 2 mounts and dismounts.

These events all happen during the scripts lifetime however.

You're probably on to something though. I ran it without an SD card present, and kfmon is quite happy. Wifi also seems to be behaving itself.

shermp commented 5 years ago

Arrrgh! Trying to test @geek1011 's PR, and run into a decision I made that is biting me in the arse now.

Turns out, go get isn't retrieving submodules for go-fbink-v2, and therefore isn't picking up the fbink.h header.

NiLuJe commented 5 years ago

It's not doing a --recursive clone? (or running git submodule init and/or git submodule update w/ -u either?)

I don't suppose there's a way to teach it to?

shermp commented 5 years ago

Interesting. go help get has this paragraph.

When go get checks out or updates a Git repository,
it also updates any git submodules referenced by the repository.

Whereas go help module-get contains no such statement

pgaskin commented 5 years ago

That is true: https://github.com/golang/go/issues/24094#issuecomment-377559768. I think there are a few possible workarounds for this with some module trickery (I played around with this a while ago), but the easiest is just to copy the header into the repo.

shermp commented 5 years ago

That is true: golang/go#24094 (comment). I think there are a few possible workarounds for this with some module trickery (I played around with this a while ago), but the easiest is just to copy the header into the repo.

Ah that's unfortunate. That stance certainly makes things a bit more annoying for libraries using CGO. Copy the header it is...

NiLuJe commented 5 years ago

Okay, waiting for the dust to settle on the last few PRs to actually test all this :).

In the meantime, here's a KFMon build with a slightly raised mountpoint changes cap. This may need more tweaking, but I will be able to test all this, since I managed to dig out an old micro sd card from an equally old tablet ;p. (Unlike current versions, it should also print something on screen if it does end up aborting because of this check).

KFMon-v1.2.16-10-g4181423.zip

shermp commented 5 years ago

Okay, waiting for the dust to settle on the last few PRs to actually test all this :).

In the meantime, here's a KFMon build with a slightly raised mountpoint changes cap. This may need more tweaking, but I will be able to test all this, since I managed to dig out an old micro sd card from an equally old tablet ;p. (Unlike current versions, it should also print something on screen if it does end up aborting because of this check).

KFMon-v1.2.16-10-g4181423.zip

That seems to have done the trick. Using the SD card using the binary I was having troubles with before, kfmon launched everything properly. I tried several times, and there didn't appear to be any issues.

Tested with the binary before any of todays PR's

pgaskin commented 5 years ago

Here are the results of the image resize library benchmark:

goos: linux
goarch: amd64
pkg: imgbench
BenchmarkImagingLanczos-4                    500           3932481 ns/op
BenchmarkImagingNearestNeighbor-4           5000            215358 ns/op
BenchmarkImagingCatmullRom-4                 500           2911818 ns/op
BenchmarkImagingMitchellNetravali-4          500           2895267 ns/op
BenchmarkImagingLinear-4                    1000           1996054 ns/op
BenchmarkResizeNearestNeighbor-4             500           2853196 ns/op
BenchmarkResizeBilinear-4                    500           3720607 ns/op
BenchmarkResizeBicubic-4                     300           5141554 ns/op
BenchmarkResizeLanczos2-4                    300           4969040 ns/op
BenchmarkResizeLanczos3-4                    200           6253797 ns/op
BenchmarkResizeMitchellNetravali-4           300           4721741 ns/op
BenchmarkBildLinear-4                        200           8192214 ns/op
BenchmarkBildBox-4                           200           5673657 ns/op
BenchmarkBildGaussian-4                       20          52835551 ns/op
BenchmarkBildMitchellNetravali-4             100          17115462 ns/op
BenchmarkBildCatmullRom-4                    100          17024602 ns/op
BenchmarkBildLanczos-4                        30          59347798 ns/op
BenchmarkRezBicubic-4                       2000            500082 ns/op
BenchmarkRezBilinear-4                      5000            296590 ns/op
BenchmarkRezLanczos2-4                      2000            659241 ns/op
BenchmarkRezLanczos3-4                      2000           1069625 ns/op
PASS
ok      imgbench        38.815s
goos: linux
goarch: arm
pkg: imgbench
BenchmarkImagingLanczos                    1    14652688042 ns/op
BenchmarkImagingNearestNeighbor           20      53550435 ns/op
BenchmarkImagingCatmullRom                 1    9939826377 ns/op
BenchmarkImagingMitchellNetravali          1    9939386627 ns/op
BenchmarkImagingLinear                     1    5314377750 ns/op
BenchmarkResizeNearestNeighbor             1    3381681000 ns/op
BenchmarkResizeBilinear                   10     133334445 ns/op
BenchmarkResizeBicubic                     5     200040091 ns/op
BenchmarkResizeLanczos2                    5     313570208 ns/op
BenchmarkResizeLanczos3                    3     432721861 ns/op
BenchmarkResizeMitchellNetravali           5     204855525 ns/op
BenchmarkBildLinear                        1    12568487042 ns/op
BenchmarkBildBox                           1    6992410877 ns/op
BenchmarkBildGaussian                      1    68470815591 ns/op
BenchmarkBildMitchellNetravali             1    35156644546 ns/op
BenchmarkBildCatmullRom                    1    33081780504 ns/op
BenchmarkBildLanczos                       1    98406429387 ns/op
BenchmarkRezBicubic                       10     158502129 ns/op
BenchmarkRezBilinear                      20      63737918 ns/op
BenchmarkRezLanczos2                       3     382409819 ns/op
BenchmarkRezLanczos3                       2     572310833 ns/op
PASS

It seems that rez is significantly faster on amd64 due to SIMD, imaging's nearestneighbour is the fastest in general, but rez's bilinear is quite close. Bilinear is slightly better quality though.

shermp commented 5 years ago

Interesting. While imaging/linear isn't the worst choice I could have made, there are certainly quicker options.

Decisions decisions. Thanks for the benchmarks

shermp commented 5 years ago

OK, all the PR's from today are merged. That should hopefully make it a bit easier for you @NiLuJe

NiLuJe commented 5 years ago

I just had a potentially not completely terrible idea re: device detection/thumbnail sizes.

We could just check what Nickel does with our own PNG files (provided they honor the most common AR: 0.75).

i.e., with KFMon's icon:

┌─(ROOT@(none):pts/0)───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────(/)─┐
└─(0.31:67%:17:39:100%:#)── find /mnt/onboard/.kobo-images/ -name '*kfmon*'                                                                                                                                                                                                                                                                             ──(Mon, May 20)─┘
/mnt/onboard/.kobo-images/39/72/file____mnt_onboard_kfmon_png - N3_FULL.parsed
/mnt/onboard/.kobo-images/39/72/file____mnt_onboard_kfmon_png - N3_LIBRARY_FULL.parsed
/mnt/onboard/.kobo-images/39/72/file____mnt_onboard_kfmon_png - N3_LIBRARY_GRID.parsed
┌─(ROOT@(none):pts/0)───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────(/)─┐
└─(0.57:68%:17:39:100%:#)── identify "/mnt/onboard/.kobo-images/39/72/file____mnt_onboard_kfmon_png - N3_FULL.parsed"                                                                                                                                                                                                                                   ──(Mon, May 20)─┘
/mnt/onboard/.kobo-images/39/72/file____mnt_onboard_kfmon_png - N3_FULL.parsed JPEG 1080x1440 1080x1440+0+0 8-bit sRGB 99542B 0.010u 0:00.010
┌─(ROOT@(none):pts/0)───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────(/)─┐
└─(0.63:69%:17:40:100%:#)── identify "/mnt/onboard/.kobo-images/39/72/file____mnt_onboard_kfmon_png - N3_LIBRARY_FULL.parsed"                                                                                                                                                                                                                           ──(Mon, May 20)─┘
/mnt/onboard/.kobo-images/39/72/file____mnt_onboard_kfmon_png - N3_LIBRARY_FULL.parsed JPEG 355x473 355x473+0+0 8-bit sRGB 17061B 0.000u 0:00.010
┌─(ROOT@(none):pts/0)───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────(/)─┐
└─(0.58:69%:17:40:100%:#)── identify "/mnt/onboard/.kobo-images/39/72/file____mnt_onboard_kfmon_png - N3_LIBRARY_GRID.parsed"                                                                                                                                                                                                                           ──(Mon, May 20)─┘
/mnt/onboard/.kobo-images/39/72/file____mnt_onboard_kfmon_png - N3_LIBRARY_GRID.parsed JPEG 149x198 149x198+0+0 8-bit sRGB 4940B 0.000u 0:00.000

The only question mark is the few devices where the AR is off by a few pixels, or the Forma, where Nickel happens to think it's on a KA1, and generates smaller thumbnails than the one it downloads for store KePubs...

NiLuJe commented 5 years ago

Okay, did a new round of tests :).

I'm having the opposite thumbnail issue: UNCaGED is generating the Library thumbnails just fine, but Nickel stubbornly refuses to generate the full-screen one, which makes the sleep screen mightily ugly ;).

I'm also getting a sql: no rows in result set warning on each book sent :?

May 20 19:01:19 nickel: (    16.399 @ 0xdffba8 / ui.debug) Pruning file "file:///mnt/onboard/Kobo-UNCaGED.png" 
May 20 19:01:57 UNCaGED: Entering USBMS mode...
May 20 19:01:57 UNCaGED: Inserting USB
May 20 19:01:58 UNCaGED: Scanning for Button
May 20 19:02:04 UNCaGED: Mounting onboard
May 20 19:02:06 UNCaGED: Mounting SD card
May 20 19:02:07 UNCaGED: Enabling WiFi
May 20 19:02:09 UNCaGED: Acquiring IP
May 20 19:02:20 UNCaGED: USBMS mode entered . . .
May 20 19:02:20 UNCaGED: Running Kobo-UNCaGED
May 20 19:02:21 KoboUNCaGED[1285]: 2019/05/20 19:02:21 Started Kobo-UNCaGED
May 20 19:02:21 KoboUNCaGED[1285]: 2019/05/20 19:02:21 Creating KU object
May 20 19:02:21 KoboUNCaGED[1285]: 2019/05/20 19:02:21 Opening NickelDB
May 20 19:02:21 KoboUNCaGED[1285]: 2019/05/20 19:02:21 Getting Kobo Info
May 20 19:02:21 KoboUNCaGED[1285]: 2019/05/20 19:02:21 Getting Device Info
May 20 19:02:21 KoboUNCaGED[1285]: 2019/05/20 19:02:21 Reading Metadata
May 20 19:02:21 KoboUNCaGED[1285]: 2019/05/20 19:02:21 1 Reading metadata.calibre
May 20 19:02:23 KoboUNCaGED[1285]: 2019/05/20 19:02:23 1 Gathering metadata
May 20 19:02:25 KoboUNCaGED[1285]: 2019/05/20 19:02:25 Book not in cache: file:///mnt/onboard/.kobo/guide/userguide.pdf
May 20 19:02:29 KoboUNCaGED[1285]: 2019/05/20 19:02:29 Preparing Kobo UNCaGED!
May 20 19:02:30 KoboUNCaGED[1285]: 2019/05/20 19:02:30 Starting Calibre Connection
May 20 19:02:48 KoboUNCaGED[1285]: 2019/05/20 19:02:48 sql: no rows in result set
May 20 19:02:49 KoboUNCaGED[1285]: 2019/05/20 19:02:49 sql: no rows in result set
May 20 19:03:22 UNCaGED: Leaving USBMS . . .
May 20 19:03:22 UNCaGED: Disabling WiFi
May 20 19:03:23 UNCaGED: WiFi disabled (0) . . .
May 20 19:03:24 UNCaGED: Unmounting onboard
May 20 19:03:27 UNCaGED: Onboard unmounted (0) . . .
May 20 19:03:27 UNCaGED: Unmounting SD card
May 20 19:03:28 UNCaGED: SD card unmounted (0) . . .
May 20 19:03:28 UNCaGED: Waiting for content processing
May 20 19:03:42 nickel: (   147.562 @ 0xf42788 / ui.debug) Pruning file "file:///mnt/onboard/Kobo-UNCaGED.png" 
May 20 19:03:44 UNCaGED: Updating metadata . . .
May 20 19:03:44 UNCaGED: Entering USBMS mode . . .
May 20 19:03:44 UNCaGED: Scanning for Button
May 20 19:03:48 UNCaGED: (Re)mounting onboard
May 20 19:03:51 UNCaGED: Remounting SD card
May 20 19:03:52 UNCaGED: Running Kobo-UNCaGED
May 20 19:03:52 KoboUNCaGED[1605]: 2019/05/20 19:03:52 Started Kobo-UNCaGED
May 20 19:03:52 KoboUNCaGED[1605]: 2019/05/20 19:03:52 Creating KU object
May 20 19:03:52 KoboUNCaGED[1605]: 2019/05/20 19:03:52 Opening NickelDB
May 20 19:03:52 KoboUNCaGED[1605]: 2019/05/20 19:03:52 Getting Kobo Info
May 20 19:03:52 KoboUNCaGED[1605]: 2019/05/20 19:03:52 Getting Device Info
May 20 19:03:52 KoboUNCaGED[1605]: 2019/05/20 19:03:52 Reading Metadata
May 20 19:03:52 KoboUNCaGED[1605]: 2019/05/20 19:03:52 1 Reading metadata.calibre
May 20 19:03:54 KoboUNCaGED[1605]: 2019/05/20 19:03:54 1 Gathering metadata
May 20 19:03:55 KoboUNCaGED[1605]: 2019/05/20 19:03:55 Book not in cache: file:///mnt/onboard/.kobo/guide/userguide.pdf
May 20 19:03:57 KoboUNCaGED[1605]: 2019/05/20 19:03:57 Updating Metadata
May 20 19:03:58 UNCaGED: Unmounting onboard
May 20 19:04:01 UNCaGED: Onboard unmounted (0) . . .
May 20 19:04:01 UNCaGED: Unmounting SD card
May 20 19:04:02 UNCaGED: SD card unmounted (0) . . .
May 20 19:04:02 UNCaGED: Going back to Nickel
May 20 19:04:21 nickel: (   186.326 @ 0x134d708 / ui.debug) Pruning file "file:///mnt/onboard/Kobo-UNCaGED.png"
NiLuJe commented 5 years ago

This may be a side-effect of the fact that the SD card I found was full of crap, some of it apparently causing Nickel to try to import stuff on each startup or real USBMS unplug.

(I've never used an SD card before, so this may simply be the expected behavior, although I doubt it. I'm not seeing it complain about anything in the logs, though, which usually happens when the import process is choking on a file).

EDIT: Hmm, it may be actually complaining about a few CBRs, I'm just not used to those warnings, as I don't usually read that kind of files on eInk ;).

That said, what was on it and is sane (i.e., ePubs or CBZs) works just fine, and gets thumbnailed just fine, too.

pgaskin commented 5 years ago

@NiLuJe I think I know what may be the issue. Can you send a dump of the rows in the content table related to your book?

NiLuJe commented 5 years ago

@geek1011: Calibre's or Nickel's?

pgaskin commented 5 years ago

@NiLuJe nickel's.

NiLuJe commented 5 years ago

@geek1011:

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-20T17:23:32Z|kepub_user|||1501912|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

It's the same book I originally tested at the start of this issue, if you need another data point to compare to ;).

(I assume you don't need the KePub chapter/section breaking stuff?).

(I'm in the CLI SQLite shell, so, if you need anything else in particular, just send me an SQL query to run ;)).

pgaskin commented 5 years ago

Can I see the metadata.calibre file for it too? I really wish that sql error was more descriptive about where it came from ... actually, I'll submit a PR in a moment, if you could run that instead.

NiLuJe commented 5 years ago

In the meantime:

    {
        "authors": [
            "Jean Teulé"
        ],
        "languages": [
            "fra"
        ],
        "user_metadata": {
            "#hyphenated": {
                "#extra#": null,
                "#value#": null,
                "category_sort": "value",
                "colnum": 3,
                "column": "value",
                "datatype": "bool",
                "display": {},
                "is_category": false,
                "is_csp": false,
                "is_custom": true,
                "is_editable": true,
                "is_multiple": null,
                "is_multiple2": {},
                "kind": "field",
                "label": "hyphenated",
                "link_column": "value",
                "name": "Hyphenated",
                "rec_index": 22,
                "search_terms": [
                    "#hyphenated"
                ],
                "table": "custom_column_3"
            },
            "#kindleread": {
                "#extra#": null,
                "#value#": null,
                "category_sort": "value",
                "colnum": 1,
                "column": "value",
                "datatype": "bool",
                "display": {
                    "description": "Read status on Kindle"
                },
                "is_category": false,
                "is_csp": false,
                "is_custom": true,
                "is_editable": true,
                "is_multiple": null,
                "is_multiple2": {},
                "kind": "field",
                "label": "kindleread",
                "link_column": "value",
                "name": "Read on Kindle",
                "rec_index": 23,
                "search_terms": [
                    "#kindleread"
                ],
                "table": "custom_column_1"
            },
            "#kobolastread": {
                "#extra#": null,
                "#value#": "None",
                "category_sort": "value",
                "colnum": 8,
                "column": "value",
                "datatype": "datetime",
                "display": {
                    "date_format": null,
                    "description": "Last time the book was Read on Kobo"
                },
                "is_category": false,
                "is_csp": false,
                "is_custom": true,
                "is_editable": true,
                "is_multiple": null,
                "is_multiple2": {},
                "kind": "field",
                "label": "kobolastread",
                "link_column": "value",
                "name": "Last Read",
                "rec_index": 24,
                "search_terms": [
                    "#kobolastread"
                ],
                "table": "custom_column_8"
            },
            "#koboreadloc": {
                "#extra#": null,
                "#value#": null,
                "category_sort": "value",
                "colnum": 6,
                "column": "value",
                "datatype": "text",
                "display": {
                    "description": "Current Reading Location on Kobo",
                    "use_decorations": 0
                },
                "is_category": true,
                "is_csp": false,
                "is_custom": true,
                "is_editable": true,
                "is_multiple": null,
                "is_multiple2": {},
                "kind": "field",
                "label": "koboreadloc",
                "link_column": "value",
                "name": "Reading Location",
                "rec_index": 25,
                "search_terms": [
                    "#koboreadloc"
                ],
                "table": "custom_column_6"
            },
            "#koboreadpct": {
                "#extra#": null,
                "#value#": null,
                "category_sort": "value",
                "colnum": 5,
                "column": "value",
                "datatype": "int",
                "display": {
                    "description": "Current Reading status on Kobo",
                    "number_format": null
                },
                "is_category": false,
                "is_csp": false,
                "is_custom": true,
                "is_editable": true,
                "is_multiple": null,
                "is_multiple2": {},
                "kind": "field",
                "label": "koboreadpct",
                "link_column": "value",
                "name": "Progress",
                "rec_index": 26,
                "search_terms": [
                    "#koboreadpct"
                ],
                "table": "custom_column_5"
            },
            "#pages": {
                "#extra#": null,
                "#value#": 192,
                "category_sort": "value",
                "colnum": 2,
                "column": "value",
                "datatype": "int",
                "display": {
                    "number_format": "{0:,}"
                },
                "is_category": false,
                "is_csp": false,
                "is_custom": true,
                "is_editable": true,
                "is_multiple": null,
                "is_multiple2": {},
                "kind": "field",
                "label": "pages",
                "link_column": "value",
                "name": "Pages",
                "rec_index": 27,
                "search_terms": [
                    "#pages"
                ],
                "table": "custom_column_2"
            },
            "#read": {
                "#extra#": null,
                "#value#": "",
                "category_sort": "value",
                "colnum": 7,
                "column": "value",
                "datatype": "composite",
                "display": {
                    "composite_sort": "bool",
                    "composite_template": "program:\n#\tIf it's Read (i.e. at 100%) on Kobo, flag it as read, otherwise, use the Kindle status as-is.\n\ttest(field('#koboreadpct'), cmp(field('#koboreadpct'), 100, '', 'Yes', ''), field('#kindleread'));",
                    "contains_html": false,
                    "description": "Read status",
                    "make_category": false,
                    "use_decorations": 2
                },
                "is_category": false,
                "is_csp": false,
                "is_custom": true,
                "is_editable": true,
                "is_multiple": null,
                "is_multiple2": {},
                "kind": "field",
                "label": "read",
                "link_column": "value",
                "name": "Read",
                "rec_index": 28,
                "search_terms": [
                    "#read"
                ],
                "table": "custom_column_7"
            }
        },
        "user_categories": {},
        "comments": "\u003cp class=\"description\"\u003eAvec 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.\u003c/p\u003e",
        "tags": [
            "+Urban Fantasy"
        ],
        "pubdate": "2019-03-06T23:00:00+00:00",
        "series_index": null,
        "thumbnail": [
            299,
            473,
            "<BASE64>"
        ],
        "publication_type": null,
        "mime": "application/octet-stream",
        "author_sort": "Teulé, Jean",
        "series": null,
        "rights": null,
        "db_id": null,
        "cover": "/tmp/calibre_3.42.0_tmp_uPL7qC/ZRwZ1R_dbcover.jpg",
        "application_id": 6336,
        "book_producer": null,
        "size": 1501912,
        "author_sort_map": {
            "Jean Teulé": "Teulé, Jean"
        },
        "rating": 6,
        "lpath": "Teule, Jean - Gare a Lou _.kepub",
        "publisher": "Julliard",
        "timestamp": "2019-04-30T00:21:51+00:00",
        "last_modified": "2019-05-04T17:15:56+00:00",
        "uuid": "1d958b9a-558e-4460-ad11-b7179caaed5f",
        "title_sort": "Gare à Lou !",
        "author_link_map": {
            "Jean Teulé": ""
        },
        "title": "Gare à Lou !",
        "identifiers": {
            "barnesnoble": "w/gare-lou-jean-teul/1130534116",
            "goodreads": "44294662",
            "google": "YyPkwgEACAAJ",
            "isbn": "9782260053026",
            "kobo": "gare-a-lou"
        }
    },
pgaskin commented 5 years ago

OK, here's #10. You'll want to disable the stripping for this build, though. It should produce slightly better logs now.

NiLuJe commented 5 years ago

Here goes:

May 20 20:19:49 KoboUNCaGED[1804]: 2019/05/20 20:19:49 [0x28AAD7 /home/niluje/MPLAYER/Kobo-UNCaGED/kobo-uncaged/util.go:82]: could not find nickel content to update: sql: no rows in result set

(Don't ask me why I clone stuff in an MPLAYER folder, it's a long story :D).

pgaskin commented 5 years ago

@NiLuJe Sorry, messed up that helper, meant to type a 1, not a zero. Let me fix that first ... done, could you try again?

Edit: Nevermind about testing it again, the error messages are unique.

pgaskin commented 5 years ago

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? :confused:

NiLuJe commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

NiLuJe commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

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

shermp commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

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

pgaskin commented 5 years ago

Can you dmesg after a poweroff?

NiLuJe commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

NiLuJe commented 5 years ago

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 commented 5 years ago

@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)