Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > KOReader

Notices

Reply
 
Thread Tools Search this Thread
Old 03-22-2023, 03:18 AM   #1
cherusker
Junior Member
cherusker began at the beginning.
 
cherusker's Avatar
 
Posts: 3
Karma: 10
Join Date: Mar 2023
Device: Pocketbook Touch HD 3
Question input.lua permanent changes

Hello,

on my Pocketbook Touch HD 3 I want my Back button to behave like my Forward button, so I usually edit my input.lua file and replace
Code:
 [framebuffer.DEVICE_ROTATED_UPRIGHT] = {},
with
Code:
 [framebuffer.DEVICE_ROTATED_UPRIGHT] = { LPgBack = "LPgFwd", RPgBack = "RPgFwd" },
This works great, but it gets overwritten with every update of KOreader.
Is there a way to make this change permanent? Can I maybe use a DEFAULTS file for that which I'm not aware of?

Thanks for your help!
cherusker is offline   Reply With Quote
Old 03-22-2023, 12:19 PM   #2
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,496
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
There's a builtin setting to invert page buttons (can't quite remember where in the top menus, though, and the device I have on hand right now doesn't have buttons; use the menu search from the hamburger menu. It *might* only be visible in a document) .

Barring that, it *should* be doable in a user-patch (it will need to run *after* Device's init, though).
NiLuJe is offline   Reply With Quote
Advert
Old 03-23-2023, 01:49 PM   #3
cherusker
Junior Member
cherusker began at the beginning.
 
cherusker's Avatar
 
Posts: 3
Karma: 10
Join Date: Mar 2023
Device: Pocketbook Touch HD 3
I'm familiar with the built in "buttons swap function", but this is not what I want, unfortunately (this will simply swap the left and right buttons' functionality, but I want both to do "forward").

Thanks for pointing me towards the patches, I was not aware of those! I tried my best and came up with:

Code:
    local fn = '/mnt/ext1/applications/koreader/frontend/device/input.lua'

    local fp = io.open( fn, "r" )
    local str = fp:read( "*all" )
    str = string.gsub( str, "[framebuffer.DEVICE_ROTATED_UPRIGHT]           = {}", "[framebuffer.DEVICE_ROTATED_UPRIGHT] = { LPgBack = \"LPgFwd\", RPgBack = \"RPgFwd\" }" )
    fp:close()

    fp = io.open( fn, "w+" )
    fp:write( str )
    fp:close()
But this does not work yet. I'm not familiar with the lua script language at all. The patch does seem to get applied when opening KOreader:

Code:
03/23/23-18:27:35 INFO  Applying patch: ./patches/1-Buttons.lua
But input.lua doesn't get changed yet. Maybe a kind soul can help me out here? Thanks!
cherusker is offline   Reply With Quote
Old 03-23-2023, 02:29 PM   #4
cherusker
Junior Member
cherusker began at the beginning.
 
cherusker's Avatar
 
Posts: 3
Karma: 10
Join Date: Mar 2023
Device: Pocketbook Touch HD 3
OK, now it's working!!
I had to write my patch like this:

Code:
    local fn = '/mnt/ext1/applications/koreader/frontend/device/input.lua'

    local fp = io.open( fn, "r" )
    local str = fp:read( "*all" )
    str = string.gsub( str, "%[framebuffer.DEVICE_ROTATED_UPRIGHT%]           = %{%}", "%[framebuffer.DEVICE_ROTATED_UPRIGHT%] = %{ LPgBack = \"LPgFwd\", RPgBack = \"RPgFwd\" %}" )
    fp:close()

    fp = io.open( fn, "w+" )
    fp:write( str )
    fp:close()
So the brackets need the percentage sign in front of them. Cool!
cherusker is offline   Reply With Quote
Old 03-23-2023, 02:58 PM   #5
hius07
Wizard
hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.
 
Posts: 1,083
Karma: 3581333
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
It's not the way KOReader user patches are intended to work.

https://github.com/koreader/koreader/wiki/User-patches
hius07 is offline   Reply With Quote
Advert
Old 03-24-2023, 04:28 PM   #6
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,496
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
c.f., https://github.com/koreader/koreader...ent-1325997517 for a very strong hint about the right way to do this .
NiLuJe is offline   Reply With Quote
Old 03-24-2023, 04:29 PM   #7
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,496
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Wrong button, yay double post ;p.

----

Said patch will require a priority prefix >= 2
NiLuJe is offline   Reply With Quote
Reply

Tags
config, input.lua, key, mapping, permanent


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Conversion Input] Microsoft Doc Input Plugin igi Plugins 76 06-28-2019 04:47 AM
REQ: input on Database Structure and testing a workaround input jecilop Library Management 15 12-17-2015 12:10 AM
DR800 Lua 5.1 MegaPackage for DR800 Iñigo iRex 25 10-05-2011 04:11 PM
iLiad Lua: scripting for Iliad hansel iRex Developer's Corner 3 12-14-2008 06:51 PM


All times are GMT -4. The time now is 01:33 PM.


MobileRead.com is a privately owned, operated and funded community.