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

Can't open books from library when files are associated on some Pocketbooks #11760

Closed
sdasda7777 opened this issue May 6, 2024 · 12 comments · Fixed by #11764
Closed

Can't open books from library when files are associated on some Pocketbooks #11760

sdasda7777 opened this issue May 6, 2024 · 12 comments · Fixed by #11764
Milestone

Comments

@sdasda7777
Copy link
Contributor

  • KOReader version: 2024.04
  • Device: Pocketbook Basic Touch

Issue

I'm not sure why, but when I set up file associations (Device -> Associate file extensions -> epub, epub3, pdf) so that KOreader would open automatically when starting the reader, I can no longer reliably open books from the system library application or from the "recent books" on home screen. Sometimes it works, but most of the time nothing happens (the given book starts opening only when I manually start KOreader). I should also note that opening books on reader startup works flawlessly, and I have no such issues whatsoever on my other Pocketbook reader (Aqua 2).

If you have any ideas what might help with diagnostics, I'd be most happy to try it out.

@sdasda7777
Copy link
Contributor Author

sdasda7777 commented May 6, 2024

For me it doesn't seem to depend on the format, happens with both epub and pdf. I don't get any message in the UI, but there does in fact seem to be a crash.log entry in applications/koreader:

---------------------------------------------
                launching...
  _  _____  ____                _
 | |/ / _ \|  _ \ ___  __ _  __| | ___ _ __
 | ' / | | | |_) / _ \/ _` |/ _` |/ _ \ '__|
 | . \ |_| |  _ <  __/ (_| | (_| |  __/ |
 |_|\_\___/|_| \_\___|\__,_|\__,_|\___|_|

 It's a scroll... It's a codex... It's KOReader!

 [*] Current time: 05/06/24-16:00:11
 [*] Version: v2024.04

ffi.load: libs/libutf8proc.so.3
ffi.load: blitbuffer
ffi.load: inkview
05/06/24-16:00:12 INFO  SoftwareVersion:  W624.4.4.1739 
ffi.load: inkview
Atached mp shm: id 0 addr 40027000 size 17864
----------------> USING A2PLUS MODE <-----------------
attach_shm: mtfb key=251330669 size=518336
Atached mtfb shm: id 40008 addr 40895000 size 518336
-------------------------
The task - koreader.app have
 xres=600 yres=800 bpp=4 vdepth=8
-------------------------
ndepth:4 hqdepth:4 orientation:0
attach_shm: ref key=2130378752 size=480000
Atached ref shm: id 8001 addr 40961000 size 480000
OpenTheme: /ebrmain/themes/Contrast.pbt
ts: loading default calibration values
attach_shm: mtfb key=251330669 size=518336
Atached mtfb shm: id 40008 addr 40b4c000 size 518336
ffi.load: librt.so
ffi.load: inkview
ffi.load: inkview-compat
ffi.load: inkview
05/06/24-16:00:12 INFO  initializing for device PBBasicTouch 
05/06/24-16:00:12 INFO  framebuffer resolution: {
  h = 800,
  w = 600
} --[[table: 0x40174e98]] 
ffi.load: libs/libmupdf.so
ffi.load: libs/libwrap-mupdf.so
ffi.load: sqlite3
ffi.load: libs/libfreetype.so.6
ffi.load: libs/libharfbuzz.so.0
ffi.load: libs/libzstd.so.1
05/06/24-16:00:13 INFO  opening file /mnt/ext1/Books/en/Monnappa, K. A. - Learning Malware Analysis Explore the concepts, tools, and techniques to analyze and investigate Windows malware.pdf 
ffi.load: libs/liblept.so.5
ffi.load: libs/libk2pdfopt.so.2
05/06/24-16:00:14 INFO  Inhibiting user input 
05/06/24-16:00:14 INFO  Loading plugins from directory: plugins 
05/06/24-16:00:15 INFO  setting zoom mode to pagewidth 
05/06/24-16:00:15 INFO  setting zoom mode to contentwidth 
ffi.load: libs/libturbojpeg.so
Atached mqueue: id 8001
05/06/24-16:00:17 INFO  Restoring user input handling 
05/06/24-16:00:20 INFO  Inhibiting user input 
05/06/24-16:01:33 INFO  Restoring user input handling 
05/06/24-16:01:33 INFO  opening file /mnt/ext1/Books/en/Foster Wendy, Christensen Paulina, Fox Anne - German All-in-one for Dummies.pdf 
05/06/24-16:01:34 INFO  Inhibiting user input 
05/06/24-16:01:34 INFO  setting zoom mode to pagewidth 
05/06/24-16:01:34 INFO  setting zoom mode to contentwidth 
05/06/24-16:01:36 INFO  Restoring user input handling 
05/06/24-16:03:29 ERROR failed to register crengine font: cannot register font </mnt/ext1/system/fonts/opendyslexic.otf> 
CRE: font Symbol Std regular: updated weight from 500 to 400
CRE: font Courier Std regular: updated weight from 500 to 400
CRE: font Courier Std regular italic: updated weight from 500 to 400
05/06/24-16:03:30 INFO  opening file /mnt/ext1/applications/koreader/crash.log 
05/06/24-16:03:31 ERROR failed to register crengine font: cannot register font </mnt/ext1/system/fonts/opendyslexic.otf> 
CRE: font Symbol Std regular: updated weight from 500 to 400
CRE: font Courier Std regular: updated weight from 500 to 400
CRE: font Courier Std regular italic: updated weight from 500 to 400
05/06/24-16:03:31 INFO  Inhibiting user input 
05/06/24-16:03:32 INFO  Restoring user input handling 
05/06/24-16:06:54 INFO  Inhibiting user input 

If I remember correctly, the first book opened fine, but the second didn't. For more context, I don't think I have the OpenDyslexic font in question installed on the other reader (which doesn't have this issue), but on this reader I had the font installed since before I downloaded KOreader and I never experienced anything similar to this when opening books directly from KOreader's file browser.

@sdasda7777
Copy link
Contributor Author

sdasda7777 commented May 6, 2024

I do seem to have access to OpenDyslexic on the other reader, but I don't see it in the location mentioned above. Is is possible that KOreader comes with OpenDyslexic, and the error stems from the name clash, or something like that? Doesn't explain why it works some of the time, though.

@Frenzie
Copy link
Member

Frenzie commented May 6, 2024

I don't get any message in the UI, but there does in fact seem to be a crash.log entry in applications/koreader:

A slightly misleading name. There's always a little bit of info written there (device, version, etc.) but it's where you should look in case there's a crash.

In this case I'm not seeing any issues. The font thing is just a warning/diagnostic message.

@sdasda7777
Copy link
Contributor Author

You're right, I removed the font files and no longer see the "error", but the behaviour prevails. Any other ideas?

I'm thinking whether I could write into the crash.log myself to trace whether the koreader.app is even launched or where approximately it crashes.

@Frenzie
Copy link
Member

Frenzie commented May 6, 2024

This stuff indicates the launch:

05/06/24-16:00:12 INFO  initializing for device PBBasicTouch 
05/06/24-16:00:12 INFO  framebuffer resolution: {

@sdasda7777
Copy link
Contributor Author

sdasda7777 commented May 6, 2024

Yes, but me opening the first file, which is in the log after this line, was without issues. I'm not even sure me trying to open the second file is in the log, because the mention in the log might be from when I opened the KOreader manually.

@Frenzie
Copy link
Member

Frenzie commented May 6, 2024

I don't know what the PB lifecycle is supposed to be like. Pinging @rjd22 @pazos

@sdasda7777
Copy link
Contributor Author

It seems I can completely avoid the behaviour in question by always killing currently running KOreader instance beforehand. That does kind of sound like a new instance begins the start up, notices the one that is already running, passes on the arguments and quits, but does not switch the old instance to the foreground? Also when I trigger this behaviour, then kill the instance and open a different book, first the new book loads completely, and after that the book with which the behaviour was triggered starts loading, but I don't think that is very relevant.

@Frenzie
Copy link
Member

Frenzie commented May 6, 2024

A look around suggests #6620 and #6808.

@sdasda7777
Copy link
Contributor Author

sdasda7777 commented May 6, 2024

If I were to guess at the moment, my money would be on API for switching tasks changing somewhere between Touch Basic's 4.4 firmware and Aqua 2's 5.20 firmware, and KOreader's code being updated for or written for the newer API. I don't have any other hypothesis that would explain why the exact same configuration works on the newer reader but not on the older one.

If that were the case, I think the line in question would be line 18:

if [ "${INSTANCE_PID}" != "" ] && [ -e "/proc/${INSTANCE_PID}" ]; then
echo "$@" >"${KO_PATH_OPEN_BOOK}"
exec /usr/bin/iv2sh SetActiveTask "${INSTANCE_PID}" 0
fi

@sdasda7777
Copy link
Contributor Author

sdasda7777 commented May 6, 2024

It seems to me the Pocketbook Basic Touch does not have the /usr/bin/iv2sh program, nor the /usr/bin directory. Running find / -name "iv2sh" 2> /dev/null revealed that two files of this name do exist, one in /ebrmain/bin/ and one in /ebrmain/cramfs/bin/. The same is true for the newer reader, therefore I assume the /usr/bin/iv2sh is a symlink which is not present on the older version?

@sdasda7777
Copy link
Contributor Author

sdasda7777 commented May 6, 2024

No, it seems like /usr/bin is actually itself a symlink to /ebrmain/bin. In fact, replacing the former with the latter in the koreader.app line mentioned above seems to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment