-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 page turn buttons do not switch with rotation #9223
Comments
Anyone can help on this? |
This problem also exists in the newly released 2022.06 version |
We rely on motivated contributors. Hopefully somebody will do it. If not you can do it. That's how every contributor started :)
And will exist in every version until this ticket is closed and hence the problem solved ;) |
I intended to resolve this problem by changing some config file or so, but unfortunately I don't know much about Android and those .lua files... will dig deeper to see how/what I can do about it. |
I found the key code of my Android e-ink reader (by running
So is there any way to return the above values when I'm holding the device with my right hand, and return |
Looks like there is already some code that should deal with that (and your keys): koreader/frontend/device/input.lua Lines 175 to 181 in 6e647a6
koreader/frontend/device/input.lua Lines 491 to 494 in 6e647a6
|
Thanks @poire-z, but I'm not able to access koreader/frontend folder without root on my device, so I'm trying to find a way to deal with this problem without hacking it. Is there a way to make rotation_map and the codes work without accessing/editing files in koreader/frontend? |
I don't mean you should hack these files. I'm mentionning that support for switching buttons when the device is rotated is already there, and that your use case should already be supported. |
Indeed, the bits of logic are there and should work at least for devices that start in portrait mode. android's |
I understand, by "hacking" I mean to get root privilege of the Android device, since I'm not able to access koreader/frontend folder without root privilege, neither with Android file explorer nor with adb. It seems that if I can get my hands on koreader/frontend folder and the files it SHOULD work. |
Are you sure there's a folder named "frontend" under "sdcard/koreader" in Android? I can't see folder "frontend" and I tried to create a folder named "frontend" in folder "koreader" and succeeded. |
/sdcard/koreader is just the settings. The program itself usually lives in /data/app/etc. |
Oh... so "koreader/frontend" is not the "koreader" folder I can see under "sdcard" but rather in /data/app/etc. then it's another story of Android, sadly to say that it's probably not what I can resolve regarding this device's os. |
More or less. In principle it's not excessively hard to take the APK file on your PC, change a few files and then sign it, though it's quite awkward. |
Many thanks Frenzie, maybe awkward as it seems but it's probably the easiest way for me to resolve this problem, will try. |
I noticed this issue on the Onyx Leaf 2 Android device which has hardware page turn buttons. What happens is that the framework does the rotation for the buttons automatically, which works for all the system and third-party apps. KOReader is too smart, detests that the screen is rotated and does it again, reversing what the framework did. I replaced the code with What we need is a setting that will disable automatic rotation for hardware buttons in KOReader (easy) or a special Quirk for devices that do the rotation automatically (harder, needs verifying on real hardware). I also tested with the patched framework which disables framework processing of the hardware buttons, and KOReader works just fine without any modifications to |
That's great to know @CrazyCoder, however since I'm not able to "root" my device I cannot touch input.lua, do you know if there's any other way to change this setting? |
@wxletter If you don't have root, you can build your own copy of KOReader from sources with this modification, sign it with your own keys, uninstall the official KOReader and install your modded version instead. I did exactly that. The build guide is a bit outdated in some places, and you will likely face several issues not covered in the guide, but it's doable with some googling. |
@NiLuJe Yes, we need something like that for Android devices in general. Maybe add a developer/advanced option to disable it so that we don't have to patch KOReader until the proper fix is available? |
Also see https://github.com/koreader/koreader/wiki/User-patches (which should work on Android) for this kind of quick hacking or replacing some existing property. |
^ This. (You can |
I've made a patch and it works! Thanks for the tips. Place the file inside |
I placed 2-disable-hw-button-rotation.lua under sdcard/koreader/patches and it's still the same, do I need to add/edit other files that'll be referenced by this .lua file? |
You need to update to a current release ;). |
I forgot to mention that I uninstalled 2022.5.1, installed 2022.10 and then placed 2-disable-hw-button-rotation.lua under sdcard/koreader/patches, and the keys still work as before, couldn't figure it out. |
You will need to figure out what happens with adb. First check that the patch is applied without errors. If that's the case then double check the key events your device produces. See #5761 (comment) |
I poked around the code and found that the patch actually didn't work, at least in the latest version. Because the patch just does koreader/frontend/device/input.lua Lines 264 to 271 in 1c42641
Instead, I just remapped it to be entirely blank and it works beautifully on my Boox Leaf 2. local logger = require("logger")
local Device = require("device")
Device.input.rotation_map = {
[0] = {},
[1] = {},
[2] = {},
[3] = {},
}
logger.info("Hardware button rotation disabled by user patch") |
I did mention that the patch would have to run after Device's init (it's the only codepath instantiating Input, and both are singletons). |
With all respect to you as a project member on this wonderful software, there are no simple documentation as to which patch number run before or after Device init, and whether there even is one for after Device init. My intention of posting the alternative patch is to help other people with the same problem who may stumbled upon this issue :) |
https://github.com/koreader/koreader/wiki/User-patches#installation :? (i.e., 2-). The |
That page mention nothing of where Device is initialised. I would guess you know since, well, you are a project member, but we (the one who isn't familiar with koreader but want to use them properly) don't. Also am I missing something or when someone ask that the aforementioned patch (with nil) doesn't work, you suggested them to update to the current version, which is 2022.10, which you also know doesn't fix said problem? |
True enough, although process of elimination and common sense would get you there anyway since "not early" was kind of the point ;).
Yup, I possibly thought it made it in 2022.10 in my original answer, which is why I clarified here. |
Thanks so much @innocenat , this saved my world. |
@wxletter: c.f., the keymapping section of https://github.com/koreader/koreader/wiki/Android-tips-and-tricks |
I read this thread but couldn't figure out how/what to do due to my poor knowledge of .lua and how KOerader works... |
Hope this can be fixed with future releases, or I'm not sure for how long the patch file will survive :) |
There's nothing to fix. Please use the patch and comment here if some day it stops working. |
I'm a bit confused on how I can get this to work. I also have the Onyx Leaf 2 with KOreader version v2022.11 Placing 2-disable-hw-button-rotation.lua under Do I need to make a folder |
The patch should behave, although only on 2022.11; the latest nightlies would require a different patch (c.f., my latest merge). |
I re-installed the latest APK from Github, it's working now! |
And now that I'm back home, for nightlies post-#9935 or releases >= 2022.12, this patch becomes local logger = require("logger")
local Device = require("device")
Device.input:disableRotationMap()
logger.info("Hardware button rotation disabled by user patch") Barring any future API changes, the variant posted in #9223 (comment) will still work, too (because it's essentially what the new method does ;p)! |
I don't think I understood post-#9935 fully. You do need root access and modify the files below right?
Not just make a folder The current patch doesn't work with v2022.11 from F-Droid only with the one from GitHub. Thanks for checking! |
User-patches are disabled in the F-Droid flavor (per F-Droid restrictions about "no runtime code modification") ;). No, the post above was just a heads-up for patch users that this would need a different patch starting with the next release (or current nightlies). You don't have access to the actual app code on Android (barring root access), and even if you do, that wouldn't survive an update, and is generally a terrible idea unless you know what you're doing, hence the patches ;). |
This patch is still valid for Onyx Boox Leaf on version 2023.03. |
for the Pocketbook Era I had to use the following patch (the others did not work correctly):
it could probably be simplified with empty |
Is this possible to included in the future released? Because I installed KOreader from F-Droid, I cannot install this patch. My device is Boox Leaf 2 on firmware 2023-11-29_16-54_3.5_c3a890b73. |
Never mind. I've just download KOReader 2024.01 "Snowy Summit" directly and install plugin from @NiLuJe
And it valid for Boox Leaf 2 on firmware 2023-11-29_16-54_3.5_c3a890b73. |
Issue
I enabled page turn with volume control buttons in Koreader and it works but for one problem. When I hold MIX7 with my right hand I can turn page forward with upper button and turn page backward with lower button which is fine. When I hold MIX7 with my left hand, the page rotates automatically but the page turn buttons "reversed" - page turn forward with lower button and backward with upper button, i.e. the button functions do not switch with device and page rotation.
It seems that turn page forward/backward is fixed to the volume up/down button and do not switch with rotation. I tried with some other apps (like Kindle app) without this problem.
I found this thread (#6842) about adding "rotation_map" config in koreader/frontend/device/input.lua, but unfortunately I'm not able to access koreader/frontend folder - at least this folder is not accessible without root on MIX7
Steps to reproduce
crash.log
crash.log
The text was updated successfully, but these errors were encountered: