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

Koreader doesn't work on Pocketbook Inkpad 3 / 740 #3687

Closed
Vaanen opened this issue Feb 20, 2018 · 41 comments
Closed

Koreader doesn't work on Pocketbook Inkpad 3 / 740 #3687

Vaanen opened this issue Feb 20, 2018 · 41 comments

Comments

@Vaanen
Copy link

Vaanen commented Feb 20, 2018

  • KOReader version: 20180212
  • Device: Pocketbook Inkpad 3

Issue

I tried to install koreader but it just doesnt open anything on my new pocketbook Inkpad 3. It seems the issue is similar to this one #3312, meaning it' because the device is not recognized. I tried to replace with the files provided though but it doesnt work unfortunately

Steps to reproduce

try to use the app

crash.log

@Frenzie
Copy link
Member

Frenzie commented Feb 20, 2018

@Vaanen

What's the DPI of the PB740? I assume the rest is probably pretty similar to the PocketBook InkPad for example.

@mk-f I've been thinking that perhaps instead of error (i.e., exit) we should attempt to fall back to a generic definition?

@Vaanen
Copy link
Author

Vaanen commented Feb 20, 2018

I believe the dpi is 300. It is indeed very similar, i think there is an added color temperature control but that's it.

@ersi-dnd
Copy link

I don't have an Inkpad 3, but I would suspect issues similar to Touch HD rather #2276

@Frenzie
Copy link
Member

Frenzie commented Feb 21, 2018

In this case the program is just exiting prematurely because the device is not explicitly defined.

In https://github.com/koreader/koreader/blob/ca6a4868069c2ddb58bedf8497690440d1440d1f/frontend/device/pocketbook/device.lua

At the bottom, add something like this before the final else.

elseif codename == "PocketBook 740" then
    return PocketBook740

Somewhere above it (doesn't really matter where for testing), add:

-- PocketBook InkPad 3
local PocketBook740 = PocketBook:new{
    isTouchDevice = yes,
    hasKeys = yes,
    hasFrontlight = yes,
    display_dpi = 300,
    emu_events_dev = "/var/dev/shm/emu_events",
}

@Vaanen Would it be possible to test if those modifications work?

@Vaanen
Copy link
Author

Vaanen commented Feb 21, 2018

Just tried, doesn't work
crash.log

device.lua.txt

@Frenzie
Copy link
Member

Frenzie commented Feb 21, 2018

My bad, the codename is of course PB740, so

elseif codename == "PB740" then
    return PocketBook740

PS Of course in the sense that the error message says unrecognized PocketBook model PB740, not in the sense of naming consistency.

@Vaanen
Copy link
Author

Vaanen commented Feb 24, 2018

Hey, just tried i : it does work. However... xD

Well, the interface is all upside down. like a 180° rotation. Wouldn't be dealbreaker at first, but then the issue is that the touch seems to not be rotated, so that makes for a really weird issue, meaning if i want to touch the panel showing on top, i have to blindly touch it at the bottom... yeah kinda weird to explain

@Frenzie
Copy link
Member

Frenzie commented Feb 24, 2018

We have a function to help with that, not used anywhere I think:

function Input:adjustTouchMirrorY(ev, height)
if ev.type == EV_ABS
and (ev.code == ABS_Y or ev.code == ABS_MT_POSITION_Y) then
ev.value = height - ev.value
end
end

You'd need to call self.input:registerEventAdjustHook(self.input.adjustTouchMirrorY) somewhere.

For testing just adding it below this line should do:

Although I just noticed this disclaimer so it might not work:

-- in contrast to kobo/kindle, pocketbook-devices do not use linux/input
-- events directly. To be able to use input.lua nevertheless, we make
-- inkview-events look like linux/input events or handle them directly
-- here.
-- Unhandled events will leave Input:waitEvent() as "GenericInput"

Only changing the visuals would be better but I don't think there are any existing ways of easily doing that (even if it shouldn't be too hard).

I don't see anything about rotation in any of the existing Pocketbook stuff, weird.

@Vaanen
Copy link
Author

Vaanen commented Feb 24, 2018

I tried it, now the app doesnt work anymore
crash.log

@Frenzie
Copy link
Member

Frenzie commented Feb 24, 2018

What if you place it directly after the definition of self.input instead? (Line 81)

self.input = require("device/input"):new{
device = self,
event_map = {
[KEY_MENU] = "Menu",
[KEY_PREV] = "LPgBack",
[KEY_NEXT] = "LPgFwd",
},
handleMiscEv = function(this, ev)
if ev.code == EVT_BACKGROUND then
self.isInBackGround = true
return "Suspend"
elseif ev.code == EVT_FOREGROUND then
if self.isInBackGround then
self.isInBackGround = false
return "Resume"
end
end
end,
}

@Vaanen
Copy link
Author

Vaanen commented Feb 24, 2018

Still doesnt work
crash.log

@Frenzie
Copy link
Member

Frenzie commented Feb 24, 2018

Just to be clear, that results from adding this line?

self.input:registerEventAdjustHook(self.input.adjustTouchMirrorY)

@Vaanen
Copy link
Author

Vaanen commented Feb 24, 2018

sorry, i completely misunderstood the directions. I was adding the function Input:adjustTouchMirrorY(ev, height) function.

I tried to add self.input:registerEventAdjustHook(self.input.adjustTouchMirrorY) as you explained. It makes it worse to without, meaning it is still upside down but now any touch just makes me go back to the menu

@Frenzie
Copy link
Member

Frenzie commented Feb 24, 2018

Sorry, that was intended to clarify what was going on but I guess I made it harder to understand. ;-)

I forgot the height argument:

self.input:registerEventAdjustHook(self.input.adjustTouchMirrorY, self.screen:getHeight())

You can also play around with something like:

self.screen:setRotationMode(2) -- reverse portrait

I'm not sure if that needs to be combined with the touch thing. Note that switching to landscape and back will mess things up with that one without writing some extra code in the backend.

@Vaanen
Copy link
Author

Vaanen commented Feb 24, 2018 via email

@Frenzie
Copy link
Member

Frenzie commented Feb 24, 2018

the touch is also weirdly reversed

Yes, that's more or less what I was referring to with the portrait/landscape thing, although I forgot it'd also happen when entering the reader.

I'm a little confused about the touch vertical mirroring not working as expected though. I figured we could just do that and leave the visual aspect for later since it's less severe.

@Vaanen
Copy link
Author

Vaanen commented Feb 24, 2018 via email

@aceflor
Copy link

aceflor commented Mar 9, 2018

Sorry to bother you guys but any update on this issue ?

@Frenzie
Copy link
Member

Frenzie commented Mar 9, 2018

Not on my end.

@mk-f Do you know if this would be best solved from Lua (possibly calling something in inkview) or maybe something in the launch script?

https://github.com/koreader/koreader/blob/fdb8dfd29509b872d86fdc7696d25fe749a4f7cb/platform/pocketbook/koreader.app

@mk-f
Copy link
Contributor

mk-f commented Mar 9, 2018

Not without knowing what to underlying cause is. As you said, Vertical mirroring should have done the trick. I am afraid somebody with the device in question needs to debug this.

@aceflor
Copy link

aceflor commented Mar 11, 2018

Hi again. On a german blog, papierlos-lesen, which has been very useful for the installation and use of coolreader on PB devices, there is an interesting point which I am pasting below. It refers to the same problem we seem to have with KOReader on the inkpad 3. I don't know if this is of any help for you (as I have no idea at all about programming, I am just a dumb user) but in doubt, here it is (I left it in German in order to not lose any sense in translation)

" Hinweis:
PocketBook hat beim Inkpad 3 die interne Verarbeitung der Bildschirmausrichtung geändert. So erkennt der Cool Reader den automatischen Wechsel ins Querfomat nicht, was ansich nicht weiter schlimm wäre, da man diese Automatik abschalten kann. Doch leider werden auch die Symbole für die Ausrichtung im Cool Reader nicht angezeigt. Man kann die Ausrichtung zwar auch über die Einstellungen des Cool Readers unter „Bildschirmeinstellungen > Seitenausrichtung“ ändern, aber nach dem Schließen des eBooks startet der Cool Reader kurz im Querformat, um sich gleich wieder zu beenden. Erst eine Änderungen des Wertes „cr3.pocketbook.orientation“ auf 0 in der „cr3.ini“, die sich auf dem Reader unter „system/config/cr3/“ befindet, setzt die Ausrichtung zurück und öffnet den Cool Reader wieder.
Wer trotzdem mit dem Cool Reader lesen will, kann sich bis zu einer neuen Version nur damit behelfen, erst alle gewünschten Einstellungen im Cool Reader zu setzen und danach die Konfigurationsdatei „cr3.ini“ mit einem Schreibschutz zu versehen. Danach startet der Cool Reader immer mit diesen Einstellungen und im Hochformat.

Ein weiteres Problem ist, dass der Cool Reader — warum auch immer — die Icons im Kontextmenü des PocketBook-Readers entfernt. Dadurch sind die dahinterliegenden Funktionen nicht mehr nutzbar. "

@Frenzie
Copy link
Member

Frenzie commented Mar 11, 2018

@aceflor You could also play around with the stuff I mentioned, like self.input:registerEventAdjustHook(self.input.adjustTouchMirrorY, self.screen:getHeight()).

@aceflor
Copy link

aceflor commented Mar 11, 2018

I did, but without success.. (as mentioned, I am just a user, not an ounce of talent nor knowledge of programming).

@trekk2810
Copy link

The first message-box, which tells you about the book loading, is rotated 90° to the right, the text of the book itself is rotated 180°. Very weird ...

@mk-f
Copy link
Contributor

mk-f commented Mar 15, 2018

As in the german article talks about the Inkpad 3 auto-rotate function: Does the behavior change, if this function is disabled in the native PB config-menu?

@trekk2810
Copy link

Auto-rotate has been disabled.

@aceflor
Copy link

aceflor commented Mar 16, 2018

I always disable the auto-rotate because I never use it, so yep, even with the auto rotate function disabled, KOReader does not work properly. As trekk2810 points it, KOReader starts in landscape format (the message saying it is opening the book) and then the book opens upside down. but the functions are still in their original place, if this makes any sense..

@Maradar
Copy link

Maradar commented Apr 3, 2018

Is there any concrete solution to this one?

@Frenzie
Copy link
Member

Frenzie commented Apr 3, 2018

@Maradar It would help if you could try the things I already wrote down to continue from there.

@Maradar
Copy link

Maradar commented Apr 4, 2018

@Frenzie
I tried and it initially went from not launching app at all to launching app (after updating koreader/frontend/device/pocketbook/device.lua)

--PocketBook InkPad 3
local PocketBook740 = PocketBook:new{
    isTouchDevice = yes,
    hasKeys = yes,
    hasFrontlight = yes,
    display_dpi = 300,
    emu_events_dev = "/var/dev/shm/emu_events",
}
elseif codename == "PB740" then
    return PocketBook740

As for showing book correctly I tried:
self.input:registerEventAdjustHook(self.input.adjustTouchMirrorY, self.screen:getHeight())
but it did not help as still the book opens in 180' and touch screen seems like it is not calibrated and nothing reacts as it should with the exception of turning pages

after adding:
self.screen:setRotationMode(2) -- reverse portrait
opening file popup that shows up when opening book shows up in correctly position but book still opens up side down.

I added those two lines bollow
Generic.init(self)

device.lua.txt

@Frenzie
Copy link
Member

Frenzie commented Apr 4, 2018

but it did not help as still the book opens in 180'

Well yes, it's an input adjust. The idea being that it's a lot simpler to simply reverse touch input than to figure out why it's upside down in the first place. ;-)

What direction is the input wrong in? That is, is you tap an edge, what makes the top menu pop up?

after adding:
self.screen:setRotationMode(2) -- reverse portrait
opening file popup that shows up when opening book shows up in correctly position but book still opens up side down.

What if you just open the file manager? This is intended for debugging (i.e., figuring if it's a route to pursue further). The reader messes with this stuff.

What about other values? (like 0 for regular portrait, 1 for landscape, 3 for reverse landscape)

@Maradar
Copy link

Maradar commented Apr 4, 2018

@Frenzie
ok change of self.screen:setRotationMode() value:
0 - open file popup 180'
1 - open file popup 90'
2 - open file popup opens correctly
3 - open file popup 270'
but this does not have any effect on the way how book is opened it self as it is still opened 180'

As for the level of touch calibration check the screenshot bello:
img_20180404_160022
when I press/touch the Music folder it opens Applications folder

@Frenzie
Copy link
Member

Frenzie commented Apr 4, 2018

but this does not have any effect on the way how book is opened it self as it is still opened 180'

But is the filemanager working correctly or not? Without opening any documents. Sorry, never mind that. ;-P

when I press/touch the Music folder it opens Applications folder

Is it 90° turned then? Please try tapping the Music folder on the very left of the screen and the very right of the screen. Not somewhere in the middle.

If it is then you can use adjustTouchSwitchXY instead of adjustTouchMirrorY.

@Maradar
Copy link

Maradar commented Apr 4, 2018

ok when I use adjustTouchSwitchXY it starts behaving completely unpredictably and it completely reverse where I touch so I set it back to adjustTouchMirrorY.

As for corners once I set the device lua back to adjustTouchMirrorY they work like this:
img_20180404_163105
when I press Sym key it is pressing P key and when I press enter it is pressing Q key

But is the filemanager working correctly or not? Without opening any documents.

no it does not as you can see on the screenshot it opens up side down
only the initial popup (like file opening) is shown correctly

@Frenzie
Copy link
Member

Frenzie commented Apr 4, 2018

Could you please first tell me what's going on without any adjustments? The other stuff is just some stepping stones that you can play around with and look up in the source to see what they do. If there's something wrong about the adjustment it completely obscures what's going on.

It looks like the device is confused about width and height. Is that normal on Pocketbook?

02/24/18-15:02:06 INFO  framebuffer resolution: {
    ["h"] = 1404,
    ["w"] = 1872
}

You could try isAlwaysPortrait to see what happens.

-- PocketBook InkPad 3
local PocketBook740 = PocketBook:new{
    isTouchDevice = yes,
    hasKeys = yes,
    hasFrontlight = yes,
    isAlwaysPortrait = yes,
    display_dpi = 300,
    emu_events_dev = "/var/dev/shm/emu_events",
}

Also try sticking getWidth() in the adjustment instead of getHeight.

Note that we can add as many adjustments as we want (if desired).

self.input:registerEventAdjustHook(self.input.adjustTouchMirrorY, self.screen:getWidth())
self.input:registerEventAdjustHook(self.input.adjustTouchSwitchXY)
-- for example

@Maradar
Copy link

Maradar commented Apr 4, 2018

@Frenzie

ok

-- PocketBook InkPad 3
local PocketBook740 = PocketBook:new{
    isTouchDevice = yes,
    hasKeys = yes,
    hasFrontlight = yes,
    isAlwaysPortrait = yes,
    display_dpi = 300,
    emu_events_dev = "/var/dev/shm/emu_events",
}

solved the whole issue

nothing else is required (check the attached file)

device.lua.txt

@Frenzie
Copy link
Member

Frenzie commented Apr 4, 2018

Excellent! Do you want to stick it in a PR?

@Maradar
Copy link

Maradar commented Apr 4, 2018

No you solved it you do it :-D I am just glad that it works

@aceflor
Copy link

aceflor commented Apr 4, 2018

Many many many thanks guys (did I say Thanks.. ?)

@trekk2810
Copy link

Kudos to you both! 👍

@rfog
Copy link

rfog commented Apr 4, 2018 via email

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

No branches or pull requests

8 participants