Skip to content

feat(device.lua): add custom options for tolino#9503

Closed
hasezoey wants to merge 6 commits into
koreader:masterfrom
hasezoey:addTolinoButtons
Closed

feat(device.lua): add custom options for tolino#9503
hasezoey wants to merge 6 commits into
koreader:masterfrom
hasezoey:addTolinoButtons

Conversation

@hasezoey

@hasezoey hasezoey commented Sep 10, 2022

Copy link
Copy Markdown
Contributor

This PR adds a device/tolino directory with device.lua and event_map.lua and for now only detects and uses custom event_map configuration for model E70K00, uses android as base and fallback if model is not detected

fixes #9175

requires koreader/android-luajit-launcher#381 (this is why this PR is a DRAFT)


This change is Reviewable

@NiLuJe

NiLuJe commented Sep 10, 2022

Copy link
Copy Markdown
Member

I'd possibly reduce and clarify the mapping by just loading the android table in... a table; and just overriding the few fields you need in there, and return that.

It'll make the file smaller, and the intent much clearer ;).

Comment thread frontend/device/tolino/device.lua Outdated
@hasezoey

Copy link
Copy Markdown
Contributor Author

I'd possibly reduce and clarify the mapping by just loading the android table in... a table; and just overriding the few fields you need in there, and return that.

It'll make the file smaller, and the intent much clearer ;).

i am still quite new to lua (and java for that matter), so i dont quite know to consolidate what to where
if you mean putting the changed buttons into device/android/device_map, then it is not really possible without overwriting the existing mappings for these values (values used are 21 and 22)

@NiLuJe

NiLuJe commented Sep 10, 2022

Copy link
Copy Markdown
Member

I simply meant that your new event map should essentially be something to the effect of

local keymap = require("blah/blah/android/event_map")
keymap.ChangedKeyCode = "New_Event"

return keymap

(Obviously, fix the path first, I don't remember 'em by rote ;p).

@hasezoey

Copy link
Copy Markdown
Contributor Author

I simply meant that your new event map should essentially be something to the effect of

fixed with b7df2ee

this is because there is not actual indication of full name, only hardwaretype
@hasezoey

Copy link
Copy Markdown
Contributor Author

in cf207b2 i changed the name from TolinoVision5 (including property model) to rather be based on ro.product.hardwareType (or Build.HARDWARE) because there is no actual indication in android itself that it is a Vision 5

@hasezoey

Copy link
Copy Markdown
Contributor Author

with c7bf69c i added property frontlight_settings for TolinoE70K00 because those leds exists and i could figure out what is what (thanks to the base tolino app), but i think it will not have any effect because those files are not writeable

for context that is what the following values are at 25% color temp (what the tolino app reports as 25 in logcat):

$ cat /sys/class/backlight/lm3630a_led/brightness
15
$ cat /sys/class/backlight/lm3630a_leda/brightness
133
$ cat /sys/class/backlight/lm3630a_ledb/brightness
87

also assuming it is RGB because of

$ cat /sys/class/backlight/lm3630a_led/max_brightness
255

and that the color in a color picker looks similar enough to the color displayed on device (for quick reference #85570f is the hex color)

For Reference a Color Picker with the values put in

color_picker

@NiLuJe

NiLuJe commented Sep 10, 2022

Copy link
Copy Markdown
Member

The lights stuff is indeed going to be useless without root, but, for curiosity's sake, take a look at how this is handled on Kobo, because that's the same controller (although I'm pretty sure we use the kernel's tables for those instead of setting each led individually).

@hasezoey

Copy link
Copy Markdown
Contributor Author

The lights stuff is indeed going to be useless without root, but, for curiosity's sake, take a look at how this is handled on Kobo, because that's the same controller (although I'm pretty sure we use the kernel's tables for those instead of setting each led individually).

from what i can tell in Onxy*Controller.kt files in /sys/class/backlight/(white/warm) are used to set the warmth, which dont exist in tolino
and in device/kobo/device.lua frontlight_settings are also set with leds(sysfs), which in the tolino are not writeable
and device/kobo/powerd.lua uses the nickel_conf, which has a path of /mnt/onboard/.kobo/Kobo/Kobo eReader.conf, but does not exist in tolino
and from what i can tell, kobo does not use ntx_io to set any light stuff, though that thing exists in tolino, but i dont know what to poke to try if light would work

@hasezoey

Copy link
Copy Markdown
Contributor Author

Update to my previous search for setting the warmth on Tolino, ref: koreader/android-luajit-launcher#351 (comment)

TL;DR: it is possible with /dev/ntx_io id 248 (scale 0-10)

@pazos pazos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please:

  1. Do not touch frontend/device.lua
  2. Do not add frontend/device/tolino files

The only change I see is in a couple of key remaps. If you want to do that just do it in frontend/android/device.lua.

Something along the lines of:

-- generic android event map
local android_event_map = require("device/android/event_map")

-- my tolino does that
if condition then
    android_event_map[21] = "LPgBack"
    android_event_map[22] = "LPgFwd"
end

self.input.event_map = android.event_map

please use android.product to check your condition.

-- Tolino Vision 5, hardware model "E70K00"
local TolinoE70K00 = TolinoDevice:new{
model = "Tolino_E70K00",
hasEinkScreen = yes,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid this doesn't work that way.

Here you're saying: hey I'm a eink screen. Let me refresh myself, but you didn't specify the driver kind, the type of waveforms you support....

With that option alone you won't get proper refreshes. Only a handful of messages on the log buffer saying that FakeEPDController issued some updates.

local TolinoE70K00 = TolinoDevice:new{
model = "Tolino_E70K00",
hasEinkScreen = yes,
frontlight_settings = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even if that works, the proper abstraction is in android-luajit-launcher, for both epd and lights driver. Please do that there so you won't break other widgets (ie: the native frontlight widget doesn't understand your code here)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even if that works, the proper abstraction is in android-luajit-launcher

i basically copied it from device/kobo/device for future reference

@hasezoey

Copy link
Copy Markdown
Contributor Author

please use android.product to check your condition.

i dont know if this would be correct, because that would report ntx_6sl,which would also match for Tolino Shine 3 but having a different hardwareType (Vision5 is E70K00 where as Shine3 is e60k00) - i dont know if the other models use the same mapping

@pazos

pazos commented Sep 11, 2022

Copy link
Copy Markdown
Member

please use android.product to check your condition.

i dont know if this would be correct, because that would report ntx_6sl,which would also match for Tolino Shine 3 but having a different hardwareType (Vision5 is E70K00 where as Shine3 is e60k00) - i dont know if the other models use the same mapping

They're using the same mapping.

IMHO this PR can be replaced with a simple user keymapping, as already covered in the wiki.

https://github.com/koreader/koreader/wiki/Android-tips-and-tricks#example-2-add-support-for-the-custom-keys-used-on-the-tolino-epos-2

If you want to workaround this without the need for user specific keymappings then please add an IS_TOLINO in android-luajit-launcher's DeviceInfo that includes current TOLINO definition and your own TOLINO_VISION5 (in case your vision isn't recognized already as a TOLINO) and just do a generic check here.

@hasezoey

Copy link
Copy Markdown
Contributor Author

If you want to workaround this without the need for user specific keymappings then please add an IS_TOLINO in android-luajit-launcher's DeviceInfo that includes current TOLINO definition and your own TOLINO_VISION5 (in case your vision isn't recognized already as a TOLINO) and just do a generic check here.

from what i can tell all tolinos have android.prop.model as tolino, i am just unsure to add it for all tolinos not knowing if they use the same buttons and events


also thanks for linking me to the wiki, i kinda forgot github has this because other projects either dont have it or are just template or are way too outdated

@hasezoey

Copy link
Copy Markdown
Contributor Author

@pazos is #9509 better? when yes, i will close this PR

@hasezoey

Copy link
Copy Markdown
Contributor Author

closing in favor of #9509 and koreader/android-luajit-launcher#382

@hasezoey hasezoey closed this Sep 14, 2022
@hasezoey hasezoey deleted the addTolinoButtons branch September 14, 2022 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: Tolino Vision 5 buttons dont invert based on rotation

3 participants