![]() |
#1 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Adding Lua support to KUAL-system
Very, very long past due, an update to the KUAL-system layout.
(Note: The BitBucket repository is still several years out-of-date.) The new public repository is at: https://github.com/janetizzy/KUAL-buttons Background This adds the ability to use the series 5 device's built-in Lua with our own scripts and add-in modules. Lua is a 'mid-level' scripting language, used in many situations where both scripting ability and performance is required (such as in games, WoW for one), see: https://www.lua.org/about.html The Timm Müller mentioned there is also one of the authors of the tekUI graphics package. (Which has been adapted to the Kindles and is ready for testing, see: https://www.mobileread.com/forums/sho...9&postcount=15 and following. The series 5 devices have Lua included within the factory image because the Kindle's window manager is Awesome, which is configured and programed in Lua, see: https://awesome.naquadah.org/ There is now a KUAL menu extension which uses Lua scripting that can serve as a working, worked, example, see: https://www.mobileread.com/forums/sho...d.php?t=271929 One of the things demonstrated there is the writing of the report in HTML that is compatible with the Kindle's native reader. ![]() KOreader is also scripted in Lua, but it provides its own, embedded, just-in-time compiler rather than use the system provided interpreter. Usage for script authors: To make this work along with the factory supplied Lua and Lua modules requires two things: *) In your 'button directory', along side the config.xml and menu.json files, add a copy of the esys.lua file attached below. (This directory is the 'current working directory' while your scripts are running.) *) As the top line of your script(s) that are being called from menu.json write: Code:
#!/usr/bin/lua -lesys -- Whatever you would otherwise write follows Ignore the esys.lua thing, the script author will include it with their button extension. The other three, just un-zip the contents into the top of visible USB storage. Installation (general): Un-archive the three lua-base-* archives to the topmost level of visible USB storage. If writing anything for this Kindle/Lua include the esys.lua file in whatever is the current working directory of your scripting and the splat-bang line as shown above as the first line of your script. Attachments The archives *.tar.gz and *.zip of the same basename, contain the same files. Both formats are provided to ease the installation when using a PC to un-archive them. The Kindle itself, has the software de-compressors installed to handle either format. Just be sure that the un-archive tool you use: *) Does not do EoL conversions *) Un-archives to the directory structure contained in the archive (the usual default) *) That the tool is set to 'update' existing directories and files (the usual default) Last edited by knc1; 04-15-2016 at 03:19 AM. |
![]() |
![]() |
![]() |
#2 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Well the time has come - I need to put this post to work.
The 'spoilered' details from the first post: Spoiler:
Last edited by knc1; 04-03-2016 at 01:26 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
BLAM!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,506
Karma: 26047190
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
Nice!
For those crazy people who actually like the Lua syntax... ;p. |
![]() |
![]() |
![]() |
#4 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
|
![]() |
![]() |
![]() |
#5 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
People want an updated firewall for Big Brother - That takes WireShark - WireShark is scriptable - The scripting language is Lua. Plus, its outputs are text files, sometimes structured text files. So there really is a reason to my current madness. ![]() |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
Adding the PinLight loader (all PinLight functions are 'load on demand'), then extending the standard string library: PHP Code:
Last edited by knc1; 03-22-2016 at 08:13 PM. |
|
![]() |
![]() |
![]() |
#7 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Did I really post above (in post #1) that lua-filesystem was working?
PHP Code:
(Which is crazy, lfs has been around longer than 5.1.0, even though the public repo. doesn't show it. I just need a really old, lfs build. Its the public repo. that is too new.) I had to have been looking at a terminal open into my PC rather than into my test Kindle when I checked it before. Because there is just no way it can work without the code written into the sources. There are also a lot of hits in doc/manual for those queries, so I guess it is time somebody (me or at Debian) to RTFM. Last edited by knc1; 03-23-2016 at 04:27 AM. |
![]() |
![]() |
![]() |
#8 |
BLAM!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,506
Karma: 26047190
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
We're using it in KOReader w/ LuaJIT, which is mostly 5.1, so check that?
|
![]() |
![]() |
![]() |
#9 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
LuaJIT(.org) has promised their user community to continue 5.1 support. That decision was made based on: "there is so much code written for 5.1 that it will take forever to update all of it". Well, forever has come. ![]() Meanwhile, I have a plan - First rule out PEBCAK - the debian archive I used contains lfs for both 5.1 and 5.2 : Make sure that I just didn't click on the wrong *.so when moving things to the Kindle/Lua layout. Then, find a copy of lfs (lua-filesystem-1.5.?) that builds against lua-5.1, then backport the function entries from lua-filesystem-1.6.?. Meanwhile, keeping my own lfs repo that **does** span the changes from 5.1 -> 5.2 such is this morning's plan - as I drown in the Debian source archives from the turn of the century. I suppose the Python community is facing similar issues in the 2.7 -> 3.0 change. Whoot! Debian-3.0 has (had) Lua-4.0 available (but no lfs), so the chances of my finding lua-5.1 has just increased. Debian-4.0 introduced lua-expat, lua-curl, and lua-filesystem for lua-5.1 Now to find those sources. ![]() At the worst, I should have them on one of my computers or backup disks. Got'em: Code:
core2quad lua-filesystem $ ls -1 *.orig.* lua-filesystem_1.2.orig.tar.gz lua-filesystem_1.4.1.orig.tar.gz lua-filesystem_1.4.2.orig.tar.gz lua-filesystem_1.5.0+16+g84f1af5.orig.tar.gz lua-filesystem_1.6.2.orig.tar.gz lua-filesystem_1.6.3.orig.tar.gz ![]() New home is at: https://github.com/janetizzy/lua51-filesystem Now I just have to figure out where support for lua-5.1 went to between lfs-1.6.2 and lfs-1.6.3 ![]() At least that is what the README says happened. Update: I reverted to lfs-1.6.2 for our Kindle/Lua and now: Code:
[root@kindle testme]# lua -lesys Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio > lfs = require'lfs' > os.exit() Last edited by knc1; 03-23-2016 at 02:15 PM. |
|
![]() |
![]() |
![]() |
#10 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Posted an updated (downdated?) lua-base-PenLight archive using lfs-1.6.2 rather than lfs-1.6.3
No change in archive name, but .... There was only one copy downloaded (google?), so no harm, no foul. |
![]() |
![]() |
![]() |
#11 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Progress - the script reads:
Code:
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors PHP Code:
Which will look like this in the final page: Scaling Available Governors
Last edited by knc1; 03-24-2016 at 09:55 PM. |
![]() |
![]() |
![]() |
#12 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
The scripting for the 'cpu report' button's script is done.
No telling what it looks like on **your** browser (the file doesn't define its own CSS), but it looks decent on the Kindle: http://kaynine.info/pw3/cpu_report.html It has one error (an excess character in a status value) and one layout error (since the script can not properly report name:value pairs). But its 99 44/100 % done In fact, it may be as done as this script will ever get. |
![]() |
![]() |
![]() |
#13 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Next -
Make a set of buttons to enable/disable the search-bar shortcuts for the factory's system reports. |
![]() |
![]() |
![]() |
#14 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Updated the first post attachments to include both *.tar.gz and *.zip format archives.
Updated the first post attachments to include a 3rd 'lua-base-' archive, lua-base-md5.* - this addition will be required by the next release version of the cpuReport file generator. |
![]() |
![]() |
![]() |
#15 |
pikachu
![]() Posts: 6
Karma: 10
Join Date: Apr 2016
Device: k3, kt2
|
Lua GUI lib tekUI
hi knc1
attached the Lua lib tekUI for GUI. It's compiled on kt2 with default options. All its external dependencies are already on the kindle. There are 2 changes made: 1. fontsizes (variable) in tek/ui/class/display.lua have all values doubled. 2. src/display_x11/display_x11_api.c (attached) only add 1 line: else { XStoreName(..) } As the installed path is different from the paths in your esys.lua , I update the esys.lua to add the new paths. (attached) |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to Host Multiple Virtual Libraries On Single System With Reverse Proxy Support | bzowk | Related Tools | 1 | 08-04-2015 07:38 PM |
support for IBM/360/370/S-390 code on the Kindles (KUAL) | knc1 | Kindle Developer's Corner | 63 | 01-08-2014 06:02 PM |
PRS-300 Chinese support in Prs+ system | snoo | Sony Reader Dev Corner | 0 | 08-17-2012 08:13 AM |
iLiad Lua: scripting for Iliad | hansel | iRex Developer's Corner | 3 | 12-14-2008 06:51 PM |