Quantcast
Channel: MobileRead Forums - Kobo Developer's Corner
Viewing all articles
Browse latest Browse all 1563

Clara HD REMARKABLE RMKIT TOOLKIT AND SIMPLE -DEVELOP CROSSPLATFORM WITHOUT COMPILING

$
0
0
***

REMARKABLE RMKIT TOOLKIT AND SIMPLE -DEVELOP CROSSPLATFORM WITHOUT COMPILING

"The BHAG that I have for the reMarkable community, is to create an ecosystem that is simple for end users. This includes developers. I want the ecosystem to solve all the hard problems, so that developers and power users can focus on creating user focused applications, or simplifying their workflow."
https://eeems.website/toltec/


rmkit is the second public framework for developing applications with native refresh support for the Remarkable Tablet
PS: rmkit also supports some Kobo devices like the Clara and Libra H20
https://rmkit.dev/
rmkit is just getting started but comes with many nice primitives for interacting with the remarkable tablet, including:
input & event handling
framebuffer management
super low latency drawing
a simple widget system
a simple simulator for developing apps locally
why rmkit?
most remarkable apps seem to be written using QT, but we consciously decided to explore what it would take to write an app from scratch: handling input, drawing directly to framebuffer, writing a widget system, etc.
https://rmkit.dev/apps/rmkit

sas: simple app script
simple is a simple app script for remarkable that lets developers write apps without needing to compile code.
https://rmkit.dev/apps/sas
https://eeems.website/writing-a-simp...e-application/


***

RUNNING RMKIT APPS

rmkit-dev/rmkit
https://github.com/rmkit-dev/rmkit

$ wget https://build.rmkit.dev/master/latest/kobo/KoboRoot.tgz

Install to .kobo/

After unmounting power cycling my Kobo reader, I swiped up the verry right OR left edge of my Clara HD, straddling the display and the bezel. I swiped all the way bottom to top. Maybe tap and swipe if you have troubles.

The menu comes up with:
Nickel
animation_demo
dumbskull
input_demo
mines
rpncalc
wordlet

E.g. click to select the mines app.

Swipe up to return to the menu.

Click the menu usage stat to the right of the mines entry to kill the app.

Click the Nickel entry to return to Nickel.

Attempt to install additional packages manually:

Index of /master/latest/kobo/
https://build.rmkit.dev/master/latest/kobo/

$ wget https://build.rmkit.dev/master/lates...release.tar.gz

$ tar zxvf release.tar.gz
apps/
apps/eclear
apps/drawing_demo
apps/mines
apps/rpncalc
apps/sharenote
apps/dumbskull
apps/sha256sum.txt
apps/animation_demo
apps/proc
apps/remux
apps/wordlet
apps/ls.txt
apps/harmony
apps/remux.service
apps/simple
apps/genie
apps/dithering_demo
apps/input_demo
apps/stb.arm.o
apps/lamp
apps/iago
apps/nao.sh
apps/rmkit.h
apps/bufshot


Copied apps/drawing_demo to /mnt/onboard/.adds/rmkit/bin/apps/ on my kobo.
Also copied harmony, lamp, nao.sh, and simple.

The only one of that bunch that appeared to do anything was harmony, which presented a nice menu of tools,etc at bottom.
But when I tried to use ...->new, it froze!

It's seems like it has potential if it gets more developed:
sas: simple app script
https://rmkit.dev/apps/sas
simple is a simple app script for remarkable that lets developers write apps without needing to compile code.
an example layout:
button 50 50 200 50 I'm a button
button 50 150 400 50 I'm a different button
label 50 100 300 50 I'm some text
image 50 200 200 200 /home/root/bomb-solid.png


...

BUILDING RMKIT APPS

rmkit/docs/BUILDING.md
https://github.com/rmkit-dev/rmkit/b...cs/BUILDING.md says:

Individual Projects
You can compile an individual project by running make <project> or make <project>_docker to build the project inside a docker container.

You can change whether you are compiling for the remarkable or a PC by adjusting the TARGET environment variable. See src/actions.make for the list of targets, which include (but is not limited to) dev and arm

Linux
install okp: pip install okp
install resim viewer: pip install rmkit-sim
compile with DEV mode: ARCH=dev make harmony
run harmony with resim ./src/build/harmony

Remarkable
install okp: sudo pip install okp
install arm toolchain
on ubuntu: sudo apt install g++-arm-linux-gnueabihf


***

But in fact, using my distro's g++-arm-linux-gnueabihf cross-platform build environment resulted in a GLIBC that was too new for my venerable Kobo Clara HD.

And trying an older Linaro release like I had done here resulted in a compiler that was too old.

Thankfully, KOReader's koxtoolchain, , like a nice bowl of porridge like you might find in a cabin in the woods , was just right.


We start by trying to build the input_demo app, the same one whose prebuilt binary we tried above.

rmkit-dev/rmkit
https://github.com/rmkit-dev/rmkit

$ mkdir rmkit-build

$ cd rmkit-build/

$ pip install okp

$ pip install rmkit-sim

$ source ~/koxtoolchain/refs/x-compile.sh kobo env bare

$ sudo apt install python3-tk

$ sudo apt install python3-pil.imagetk

$ wget https://github.com/rmkit-dev/rmkit/a...ads/master.zip

$ mv master.zip rmkit-master.zip

$ unzip rmkit-master.zip

$ cd rmkit-master/

$ nano -l src/input_demo/main.cpy
Code:

76    ds->add_options({"foo", "ba", "baz"})
...
201    ds->add_options({"foot", "bat", "baz"})

$ nano -l src/common.make
Code:

3 CXX_BIN?=arm-kobo-linux-gnueabihf-g++
 4 CC_BIN?=arm-kobo-linux-gnueabihf-gcc
 5 STRIP_BIN?=arm-kobo-linux-gnueabihf-strip

$ nano -l scripts/build/build_kobo_root.sh
Code:

25  arm-kobo-linux-gnueabihf-strip *
$ ARCH=kobo make input_demo
rmkit.h:19622:14: error: 'ABS_MT_SLOT' was not declared in this scope
rmkit.h:19663:14: error: 'ABS_MT_DISTANCE' was not declared in this scope
rmkit.h:20554:34: error: 'SYN_DROPPED' was not declared in this scope


$ grep -r -n ABS_MT_SLOT
src/.rmkit.h_cpp/input/events.h:251: case ABS_MT_SLOT: {
src/build/rmkit.h:19622: case ABS_MT_SLOT: {
src/rmkit/input/events.cpy:241: case ABS_MT_SLOT:

$ nano -l src/.rmkit.h_cpp/input/events.h
Code:

251 //        case ABS_MT_SLOT: {
252 //          slot = data.value;
253 //          break; }

$ nano -l src/build/rmkit.h
Code:

19622 //        case ABS_MT_SLOT: {
19623 //          slot = data.value;
19624 //          break; }

$ nano -l src/rmkit/input/events.cpy
Code:

241 //        case ABS_MT_SLOT:
242 //          slot = data.value;
243 //          break

$ grep -r -n SYN_DROPPED
src/.rmkit.h_cpp/input/input.h:75: if (ev_data[i].code == SYN_DROPPED) {
src/build/rmkit.h:20554: if (ev_data[i].code == SYN_DROPPED) {
src/rmkit/input/input.cpy:69: if ev_data[i].code == SYN_DROPPED:

$ nano -l src/.rmkit.h_cpp/input/input.h
Code:

75 //          if (ev_data[i].code == SYN_DROPPED) {
 76 //            syn_dropped = true;
 77 //            event.handle_drop(fd);
 78 //            continue; }

$ nano -l src/build/rmkit.h
Code:

20554 //          if (ev_data[i].code == SYN_DROPPED) {
20555 //            syn_dropped = true;
20556 //            event.handle_drop(fd);
20557 //            continue; }

$ nano -l src/rmkit/input/input.cpy
Code:

69 //          if ev_data[i].code == SYN_DROPPED:
 70 //            syn_dropped = true
 71 //            event.handle_drop(fd)
 72 //            continue

$ grep -r -n ABS_MT_DISTANCE
src/.rmkit.h_cpp/input/events.h:292: case ABS_MT_DISTANCE: {
src/remux/launcher.cpy:31:#define TOUCH_FLOOD_EVENT ABS_MT_DISTANCE
src/build/rmkit.h:19663: case ABS_MT_DISTANCE: {
src/rmkit/input/events.cpy:282: case ABS_MT_DISTANCE:

$ nano -l src/.rmkit.h_cpp/input/events.h
Code:

292 //        case ABS_MT_DISTANCE: {
293 //          slots[slot].distance = this->distance = data.value;
294 //          if (this->distance > 0) {
295 //            this->left = 0; }
296 //          break; }

$ nano -l src/remux/launcher.cpy
Code:

31 #define TOUCH_FLOOD_EVENT ABS_DISTANCE
$ nano -l src/build/rmkit.h
Code:

19663 //        case ABS_MT_DISTANCE: {
19664 //          slots[slot].distance = this->distance = data.value;
19665 //          if (this->distance > 0) {
19666 //            this->left = 0; }
19667 //          break; }

$ nano -l src/rmkit/input/events.cpy
Code:

282 //        case ABS_MT_DISTANCE:
283 //          slots[slot].distance = self.distance = data.value
284 //          if self.distance > 0:
285 //            self.left = 0
286 //          break


$ grep -r -n NotoMono-Regular.ttf
Binary file src/.input_demo_cpp/main.o matches
src/.rmkit.h_cpp/fb/stb_text.h:37: filename = "/usr/share/fonts/ttf/noto/NotoMono-Regular.ttf";
src/build/rmkit.h:19247: filename = "/usr/share/fonts/ttf/noto/NotoMono-Regular.ttf";
Binary file src/build/input_demo matches
src/rmkit/fb/stb_text.cpy:33: filename = "/usr/share/fonts/ttf/noto/NotoMono-Regular.ttf";


$ nano -l src/.rmkit.h_cpp/fb/stb_text.h
Code:

37        filename = "/mnt/onboard/.adds/koreader/fonts/noto/NotoSans-Regular.ttf";

$ nano -l src/build/rmkit.h
Code:

19247        filename = "/mnt/onboard/.adds/koreader/fonts/noto/NotoSans-Regular.ttf";
$ nano -l src/rmkit/fb/stb_text.cpy
Code:

33        filename = "/mnt/onboard/.adds/koreader/fonts/noto/NotoSans-Regular.ttf";

$ nano -l src/common.make
Code:

2 TARGET?=kobo

$ nano -l src/rmkit/input/events.cpy
Code:

181      invert_y = true
182      invert_x = true
183      swap_xy = false
184      switch version:
185        case util::KOBO_DEVICE_ID_E::DEVICE_KOBO_CLARA_HD:
186          // rotation++
187          rotation %= 4
188          invert_x = true
189          swap_xy = false
190          break



$ ARCH=kobo make input_demo

$ cd ..


Make a backup to your PC of /mnt/onboard/.adds/rmkit/bin/apps/input_demo on your kobo.

Copy input_demo and stb.arm.o from rmkit-master/src/build/ on your PC to /mnt/onboard/.adds/rmkit/bin/apps/ on your kobo.


Swipe all the way up the edge (right or left) of your Kobo and select the input_demo app.

(Click and swipe inside the box and see the cursor move.)

(Click the Menu, Pager, Overlay, and Options items.)

(Click in the top text entry and type using the onscreen keyboard.)


Swipe up to return to the menu.

Click the menu usage stat to the right of the input_demo entry to kill the app.

Click the Nickel entry to return to Nickel.



***

Now we try to build the Simple framework.


$ source ~/koxtoolchain/refs/x-compile.sh kobo env bare

$ cd rmkit-master/

$ ARCH=kobo make simple


Copy simple from rmkit-master/src/build/ and menu.sh from rmkit-master/src/simple/apps/ on your PC to /mnt/onboard/.adds/rmkit/bin/apps/ on your kobo.

Swipe up the right edge of your Kobo and select the menu.sh app.

(Click the option items.)

Swipe up to return to the menu.

Click the menu usage stat to the right of the menu.sh and simple entries to kill the app.

Click the Nickel entry to return to Nickel.

Now edit the menu.sh without recompiling.

$ nano -l src/simple/apps/menu.sh
Code:

  5 label 0 500 200 50 you pressed: ${option}
  6 [paragraph 0 600 500 500 ${output}]
...
 10  option=`echo "${app}" | /mnt/onboard/.adds/rmkit/bin/apps/simple | grep 'selected:' | sed 's/selected: //'`
 11  output=`cat /mnt/onboard/.kobo/version`


Copy menu.sh from rmkit-master/src/simple/apps/ on your PC to /mnt/onboard/.adds/rmkit/bin/apps/ on your kobo.

Swipe up the right edge of your Kobo and select the menu.sh app.

(Click the option items.)

Swipe up to return to the menu.

Click the menu usage stat to the right of the menu.sh and simple entries to kill the app.

Click the menu usage stat to the right of the input_demo entry to kill the app.

Click the Nickel entry to return to Nickel.


So we have just modified, without recompiling, an app that works on both Remarkable and Kobo devices.
* Edit - Technically, fbink can do this too, say with lua, if I ever get around to learning lua!
https://github.com/NiLuJe/FBInk

I may now die in peace...

***

Attached Files
File Type: gz input_demo.gz (775.8 KB)
File Type: gz stb.arm.o.gz (79.0 KB)
File Type: gz simple.gz (772.3 KB)
File Type: gz menu.sh.gz (254 Bytes)

Viewing all articles
Browse latest Browse all 1563

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>