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

Does not start on Kobo Touch (attempt to call field 'isKindle') #5717

Closed
RenaKunisaki opened this issue Jan 1, 2020 · 6 comments · Fixed by #5727
Closed

Does not start on Kobo Touch (attempt to call field 'isKindle') #5717

RenaKunisaki opened this issue Jan 1, 2020 · 6 comments · Fixed by #5727
Milestone

Comments

@RenaKunisaki
Copy link
Contributor

  • KOReader version: koreader-kobo-v2019.12
  • Device: Kobo Touch model N905C

Issue

Koreader crashes immediately at startup.

Steps to reproduce

  1. Install KSM 09
  2. Install Koreader
  3. Boot
  4. Select "start koreader"
crash.log (if applicable)

crash.log

@RenaKunisaki
Copy link
Contributor Author

Quick and dirty patch to fontlist.lua to get it working:

63c63,64
<     return CanvasContext.isKindle() and kindle_fonts_blacklist[f]
---
>     --return CanvasContext.isKindle() and kindle_fonts_blacklist[f]
>       return false
67,69c68,70
<     if CanvasContext.isAndroid() or CanvasContext.isDesktop() then
<         return require("frontend/ui/elements/font_settings"):getPath()
<     else
---
>     --if CanvasContext.isAndroid() or CanvasContext.isDesktop() then
>     --    return require("frontend/ui/elements/font_settings"):getPath()
>     --else
71c72
<     end
---
>     --end

@poire-z
Copy link
Contributor

poire-z commented Jan 1, 2020

./luajit: frontend/fontlist.lua:63: attempt to call field 'isKindle' (a nil value)
stack traceback:
    frontend/fontlist.lua:63: in function 'isInFontsBlacklist'
    frontend/fontlist.lua:87: in function '_readList'
    frontend/fontlist.lua:81: in function '_readList'
    frontend/fontlist.lua:98: in function 'getFontList'
    frontend/ui/font.lua:247: in function 'getFace'
    ./tools/kobo_touch_probe.lua:76: in function 'init'
    frontend/ui/widget/widget.lua:48: in function 'new'
    frontend/device/kobo/device.lua:375: in function 'touchScreenProbe'
    ./reader.lua:141: in main chunk

The crash is similar to the one we investigated in #5688, but not the reason.

koreader/reader.lua

Lines 139 to 158 in d647c62

-- Touch screen
if Device:needsTouchScreenProbe() then
Device:touchScreenProbe()
end
-- Handle global settings migration
local SettingsMigration = require("ui/data/settings_migration")
SettingsMigration:migrateSettings(G_reader_settings)
-- Document renderers canvas
local CanvasContext = require("document/canvascontext")
CanvasContext:init(Device)
-- UI mirroring for RTL languages, and text shaping configuration
local Bidi = require("ui/bidi")
Bidi.setup(lang_locale)
-- Avoid loading UIManager and widgets before here, as they may
-- cache Bidi mirroring settings. Check that with:
-- for name, _ in pairs(package.loaded) do print(name) end

I think the real fix is moving lines 139-142 after line 158, as Device:touchScreenProbe() may do UIManager:show(TouchProbe:new{}).
Can you revert your quick and dirty patch, and try it, and tell us if it works and you don't see other bad things?

Although I know nothing about that tools/kobo_touch_probe.lua. Is that supposed to be a one-time thingy? Would it be too late to have that done on line 158?
Was that a first/fresh install, without any config/settings that would have been carried from a previous version?

@NiLuJe
Copy link
Member

NiLuJe commented Jan 1, 2020

The probe is done on Device init, IIRC. Possibly once only, I can't recall.

EDIT: Or it's its result that's used on Device init, which would explain the current order... :/.

@Frenzie
Copy link
Member

Frenzie commented Jan 1, 2020

Should be only once because it stores the result.

@poire-z
Copy link
Contributor

poire-z commented Jan 1, 2020

OK, so it should be an issue only on first install on Kobo touch (so, hopefully no real need to release a 2019-12.2...)
So, the logical change would be this (even if language/bidi would be english & LTR on first launch after fresh install):

--- a/reader.lua
+++ b/reader.lua
@@ -134,23 +134,26 @@ if Device:hasEinkScreen() then
     end
     if Device.screen.sw_dithering and G_reader_settings:isTrue("dev_no_sw_dither") then
         Device.screen:toggleSWDithering()
     end
 end
--- Touch screen
-if Device:needsTouchScreenProbe() then
-    Device:touchScreenProbe()
-end

 -- Handle global settings migration
 local SettingsMigration = require("ui/data/settings_migration")
 SettingsMigration:migrateSettings(G_reader_settings)

 -- Document renderers canvas
 local CanvasContext = require("document/canvascontext")
 CanvasContext:init(Device)

+-- Touch screen (this may display some widget, on first install on Kobo Touch,
+-- so have it done after CanvasContext:init() but before Bidi.setup() to not
+-- have mirroring mess x/y probing).
+if Device:needsTouchScreenProbe() then
+    Device:touchScreenProbe()
+end
+
 -- UI mirroring for RTL languages, and text shaping configuration
 local Bidi = require("ui/bidi")
 Bidi.setup(lang_locale)
 -- Avoid loading UIManager and widgets before here, as they may
 -- cache Bidi mirroring settings. Check that with:

@RenaKunisaki : can you try by just replacing koreader/reader.lua with this one: reader.lua.txt
(after removing your quick & dirty patch, and backuping/removing any settings.reader.lua).
Testing a first launch (if you see some touch screen probe widget), and subsequent launches (you shouldn't see it anymore).

@RenaKunisaki
Copy link
Contributor Author

@RenaKunisaki : can you try by just replacing koreader/reader.lua with this one: reader.lua.txt
(after removing your quick & dirty patch, and backuping/removing any settings.reader.lua).
Testing a first launch (if you see some touch screen probe widget), and subsequent launches (you shouldn't see it anymore).

Yep, that seems to have done it.

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

Successfully merging a pull request may close this issue.

4 participants