Skip to content

fix(Makefile): add "luajit" binary to android zip file#9511

Closed
hasezoey wants to merge 1 commit into
koreader:masterfrom
hasezoey:addLuaJIT
Closed

fix(Makefile): add "luajit" binary to android zip file#9511
hasezoey wants to merge 1 commit into
koreader:masterfrom
hasezoey:addLuaJIT

Conversation

@hasezoey

@hasezoey hasezoey commented Sep 11, 2022

Copy link
Copy Markdown
Contributor

This PR adds the luajit binary to the android output, required for running ntx_io.lua in TolinoWarmthController.kt

required for koreader/android-luajit-launcher#382

Note: this PR adds the generated luajit binary to the 7z package, because it was not there before, i dont know if this is the proper way, but for now it worked for me


This change is Reviewable

@Frenzie

Frenzie commented Sep 11, 2022

Copy link
Copy Markdown
Member

This is missing a lot of context. Are you referring to the slightly hackish approach we use to send ioctls via shellscripts? If so, why would you want to run that from Kotlin instead of just some native ioctl call?

@hasezoey

Copy link
Copy Markdown
Contributor Author

This is missing a lot of context. Are you referring to the slightly hackish approach we use to send ioctls via shellscripts? If so, why would you want to run that from Kotlin instead of just some native ioctl call?

i dont understand what you mean, i include the luajit binary because i require it to run ntx_io.lua like in the kobo scripts, i have not done JNI or native C because i have no clue how to set it up or how to use it and from what i know without JNI there is no ioctl in java

@Frenzie

Frenzie commented Sep 11, 2022

Copy link
Copy Markdown
Member

You'll have to show that import platform.posix.ioctl or something equivalent isn't available. This is incredibly convoluted.

@hasezoey

hasezoey commented Sep 11, 2022

Copy link
Copy Markdown
Contributor Author

You'll have to show that import platform.posix.ioctl or something equivalent isn't available

i dont quite know what you mean, like i had said in earlier PR's / issues i am still new to android / java / kotlin (and for that matter C / lua), and from what i could tell from some searching around i could not find a way to call ioctl without JNI (Java Native Interface / Java ffi with C) and because i have no clue about JNI but the Lua ffi for C already was in place, i just used that like in kobo scripts

@hasezoey

hasezoey commented Sep 11, 2022

Copy link
Copy Markdown
Contributor Author

You'll have to show that import platform.posix.ioctl or something equivalent isn't available. This is incredibly convoluted.

import platform.posix.*
results in TolinoWarmthController.kt: (10, 8): Unresolved reference: platform

@Frenzie

Frenzie commented Sep 11, 2022

Copy link
Copy Markdown
Member

Pinging @pazos, but according to the docs this should work.

https://kotlinlang.org/docs/native-platform-libs.html#posix-bindings

For all Unix- or Windows-based targets (including Android and iOS targets) we provide the POSIX platform lib. It contains bindings to platform's implementation of the POSIX standard.

@NiLuJe

NiLuJe commented Sep 11, 2022

Copy link
Copy Markdown
Member

That also probably won't work on newer Android platforms anyway, so, yeah, probably not a good example to follow, my bad, forgot that Android is pain ;).

@pazos

pazos commented Sep 11, 2022

Copy link
Copy Markdown
Member

ioctl isn't going to work on non rooted android. It is a dead end.

You must check first that your non privilegied user has access to the /dev/ntx_io device. Then check that your ioctl system call against this device doesn't fail.

If you're are able to get that working without gaining root first then no matter how you coded that, we can write it properly to not include luajit (again) in android.

But it is a dead end.

I don't have the device but my comment in #8429 (comment) still stands:

If they wanted to avoid 3rd party apps to use that feature (and implemented it well) it won't be possible without root.

So please consider one of these routes instead:

  • Create a new driver with just brightness for your device (to avoid non working sliders) and use the system dialog to set warmth.

  • Figure out a way to call the system dialog via an intent. Use that instead of calling our own frontlight widget for your particular device (this is kind of advanced as you need to tweak code on a few different places and nuke KO brightness/warmth gestures)

  • Root your device and enjoy current implementation (or write your own writting directly to sysfs nodes if current doesn't work on your device).

@hasezoey

hasezoey commented Sep 11, 2022

Copy link
Copy Markdown
Contributor Author

You must check first that your non privilegied user has access to the /dev/ntx_io device

my ntx_io file permissions are 777

Then check that your ioctl system call against this device doesn't fail.

already done https://github.com/koreader/android-luajit-launcher/pull/382/files#diff-dbf7978ad18431f6b8c290abda12b27d3c61b7c968d7599d3769e65784e1e406R134-R136

Figure out a way to call the system dialog via an intent. Use that instead of calling our own frontlight widget for your particular device (this is kind of advanced as you need to tweak code on a few different places and nuke KO brightness/warmth gestures)

from what i can tell, this is not possible on Tolino because it is in the Tolino App, not a separate (or i just dont know enough about android)

Root your device and enjoy current implementation (or write your own writting directly to sysfs nodes if current doesn't work on your device).

like i had said, /dev/ntx_io is possible to interface with without root

@hasezoey

Copy link
Copy Markdown
Contributor Author

This PR is not needed anymore thanks to https://github.com/hasezoey/android-luajit-launcher/pull/1

@hasezoey hasezoey closed this Sep 14, 2022
@hasezoey hasezoey deleted the addLuaJIT branch September 14, 2022 14:43
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.

4 participants