Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 11-04-2022, 07:58 PM   #1
elinkser
Zealot
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 125
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
*** SECURITY REMINDER ***
You are browsing as root on an outdated kernel that is not likely to see timely security patches.
You should at least create a non-root user (e.g. using adduser), but they would need permission to use the framebuffer i.e. FBInk, if they want to use the graphical image viewer feature.

To create a user 'fbuser' with framebuffer access you can do the following:
adduser fbuser
addgroup fbgroup
adduser fbuser fbgroup
chgrp fbgroup /dev/fb0
But it looks like you have to redo that last chgrp command each session.
Furthermore, Kobo seems to have disallowed write access to /mnt/onboard to anyone but root, so other users cannot save bookmarks to .elinks/ but they can at least save downloads to the /tmp directory (of course you then have to copy them as root to a more permanent location).

*NOTE*
You can edit the "umask 002" line in /etc/init.d/rcS to "umask 000" allow all user write access to the /mnt/onboard partition, but that would defeat the security objective.
You can't have fine-grained access permission because it is a vfat format.
When you create a user with "adduser bla", a /home/bla directory is created on the root partition, which DOES have fine-grained access controls, as you can see by running "ls -l /home".
But the root partition doesn't have much free space, only about 60MB, as you can see by running "df".
So you may prefer "adduser bla -d /mnt/onboard/.adds/koreader/home/bla" to put the home directory on the /mnt/onboard partition which has many GB of free space, which the user won't be able to write to, but at least it doesn't use up valuable root partition space.
In retrospect I should have crosscompiled using "--prefix=/mnt/onboard/.adds/koreader/templib" on my desktop instead of "--prefix=$HOME/Downloads/mykobossh/templib", so I wouldn't have to use up valuable root partition space with all the certificates, as you will see.

The links near the bottom of this post point to an alternative approach using a chroot. Clara HD owners also have the option to pull out the SD card and shrink the /mnt/onboard partition with a disk utility, then creating a new /home partition that is writable by non-root users. But non-Clara owners can still create a /home partition in an image file, as was done here, (but no need to create root file system - just format it and mount it.)


**EDIT - Comment #3 has another way to get elinks by copying and may be easier.


Otherwise:
1.Back up your SD card.
2.Don't use your Kobo for sensitive info including passwords.
3.Don't browse to unsafe sites.
Or just use Firefox on your desktop to save complete webpage with image folder, or print to pdf on your cellphone, these can be webserved to your Kobo for secure graphic browsing using KOReader!
As mentioned here
***



HOW TO CROSSCOMPILE ELINKS AND WGET FOR THE KOBO CLARA HD (using linux desktop).
---
First, follow the instructions here to determine the crosscompile tool for your device. For the Kobo Clara HD, it is gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz.
Download this and source packages for openssl, elinks, and wget to $HOME/Downloads/mykobossh/.
---
To build OPENSSL:
(see also)
cd
cd Downloads/mykobossh/
tar xJf gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz
export PATH=$PWD/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin:$PATH
tar zxvf openssl-1.1.1s.tar.gz
cd openssl-1.1.1s/
mkdir $HOME/Downloads/mykobossh/templib
./Configure gcc -static -no-shared --prefix=$HOME/Downloads/mykobossh/templib --cross-compile-prefix=arm-linux-gnueabihf-
make
make install
cd ..
---
To build ELINKS:
(see also)
tar zxvf elinks-0.15.1.tar.gz
cd elinks-0.15.1/
./autogen.sh
./configure --help
./configure --host=arm-linux-gnueabihf --enable-own-libc --enable-sm-scripting --disable-nls --disable-xbel --disable-ipv6 --disable-leds --disable-backtrace --with-static --without-zlib --without-bzlib --without-gnutls --with-openssl=$HOME/Downloads/mykobossh/templib CPPFLAGS="-I$HOME/Downloads/mykobossh/templib/include" LDFLAGS="-L$HOME/Downloads/mykobossh/templib/lib"
make
cp src/elinks ../elinks111s
cd ..
---
DEVICE:
Copy elinks111s to .adds/koreader/scripts directory on Kobo Clara HD.
Run KOReader and connect to WIFI on Clara HD.
Open Terminal Emulator and you will see elinks111s in working directory (/mnt/onboard/.adds/koreader/scripts).
chmod +x elinks111s
elinks111s
(enter "mobileread.mobi/forums/")
(keep pressing return key if get ssl error message)


***EDIT***
It helps to copy certificates to a $HOME/Downloads/mykobossh/templib/ssl/certs directory that you must create on your Kobo, where $HOME is /home/user, or whatever your desktop home directory was.
I got certificates from my desktop /usr/share/ca-certificates/mozilla directory, but your case may differ. Also, a heavy page like amazon might stall, but I press q then cancel and it seems to get going again!

*Update-wget seems to handle certs differently. A workaround might be to copy the ca-certificates.crt file from your desktop (mine was in /etc/ssl/certs) to the above directory, and let wget know by creating a .wgetrc file in /mnt/onboard/.adds/koreader with the single line:
ca_certificate=/home/user/Downloads/mykobossh/templib/ssl/certs/ca-certificates.crt

(or wherever you saved it).

** Update-Courtesy of qkqw's post, here is another source of Mozilla CA certificates from the Curl website.

***


Press Esc key and down arrow key to get menu and key codes.
Use spacebar for pagedown and 'b' for pageup, 'g' followed by '.' to browse local filesystem.
Press q (followed by return key) to quit
---
NiLuJe's FBInk can be configured as an image viewer for elinks, except the image gets quickly overwritten.
But it is there long enough to decide if you want to download it.
Turns out I had to not use the FBInk that came with my installed KOReader but to download it separately from here.
EDIT elinks.conf FILE IN .elinks/ (TO CONFIGURE fbink AS IMAGE VIEWER):
set document.browse.images.display_style = 1
set document.browse.images.filename_maxlen = 50
set document.browse.images.image_link_tagging = 2
set document.browse.images.show_as_links = 1
set mime.extension.jpg="image/jpeg"
set mime.extension.jpeg="image/jpeg"
set mime.extension.png="image/png"
set mime.extension.gif="image/gif"
set mime.extension.bmp="image/bmp"
set mime.extension.pnm="image/pnm"
set mime.handler.image_viewer.unix.ask = 1
set mime.handler.image_viewer.unix-xwin.ask = 0
set mime.handler.image_viewer.unix.block = 1
set mime.handler.image_viewer.unix-xwin.block = 0
set mime.handler.image_viewer.unix.program = "/mnt/onboard/.adds/koreader/scripts/fbink -g file=%"
set mime.handler.image_viewer.unix-xwin.program = "/mnt/onboard/.adds/koreader/scripts/fbink -g file=%"
set mime.type.image.jpg = "image_viewer"
set mime.type.image.jpeg = "image_viewer"
set mime.type.image.png = "image_viewer"
set mime.type.image.gif = "image_viewer"
set mime.type.image.bmp = "image_viewer"
set mime.type.image.pnm = "image_viewer"
---

*EDIT*
Actually "fbink -G -g file=% ;sleep 2" keeps the image longer. I tried appending 2>/dev/null but that only helps outside of elinks.
*You need that space between "%" and ";" for some reason.
Another option is:
"fbink -G -y 30 -g file=% ;sleep 2"
Which keeps the image to the lower part of the display, so it doesn't get overwritten.
---
To build WGET:
(see also)
tar zxvf wget-1.21.tar.gz
cd wget-1.21/
./configure --help
env CPPFLAGS="-I$HOME/Downloads/mykobossh/templib/include" LDFLAGS="-L$HOME/Downloads/mykobossh/templib/lib" ./configure --with-ssl=openssl --with-libssl-prefix=$HOME/Downloads/mykobossh/templib --target=arm-linux-gnueabihf --host=arm-linux-gnueabihf --disable-nls --disable-ipv6 --without-zlib
make CPPFLAGS="-I$HOME/Downloads/mykobossh/templib/include" LDFLAGS="-L/$HOME/Downloads/mykobossh/templib/lib -static"
cp src/wget ../wget111s
DEVICE:
Copy wget111s to .adds/koreader/scripts directory on Kobo Clara HD.
Run KOReader and connect to WIFI on Clara HD.
Open Terminal Emulator and you will see wget111s in working directory (/mnt/onboard/.adds/koreader/scripts).
chmod +x wget111s
wget111s google.com
ls index.html
Here is a more sophisticated use:
***NOTE THE VERY IMPORTANT OPTION '-Q50M' WHICH LIMITS DOWNLOAD TO 50MB !!!***
(this is to keep you from inadvertently "downloading the internet")
wget111s --no-check-certificate --no-parent -k -nd -D www.mobileread.mobi -E -r -A jpg,jpeg,png,gif,htm.html -l1 -Q50M -P ./mywgets/ www.mobileread.mobi/forums/
------


THE NEXT SECTIONS ARE OPTIONAL, IF YOU WANT AN ASCIIVIEW IMAGE VIEWER.
*It is for ascii images - not high resolution images, from when I could not get NiLuJe's FBInk to work within elinks. So this is mostly just a fun substitute!

Spoiler:


To build NCURSES:
(see also)
tar zxvf ncurses-6.3.tar.gz
cd ncurses-6.3/
mkdir $HOME/Downloads/mykobossh/curselib
./configure --help
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ ./configure --with-static --with-shared --with-cxx-shared --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --host=i686-pc-linux --without-ada --without-gpm --without-sysmouse --enable-widec --disable-big-core --with-build-cc=gcc --prefix=$HOME/Downloads/mykobossh/curselib
make
make install
copy libncurses.so.6.3 to libncurses.so and libncurses.so.6.
copy libncursesw.so.6.3 to libncursesw.so and libncursesw.so.6.
Copy libs to .adds/koreader/libs directory on Kobo Clara HD.
cd ..
---
To build AALIB:
tar zxvf aalib-1.4rc4.tar.gz
cd aalib-1.4.0/
mkdir $HOME/Downloads/mykobossh/aalib
./configure --help
CC="arm-linux-gnueabihf-gcc" CPPFLAGS="-I$HOME/Downloads/mykobossh/curselib/include/ncurses" LDFLAGS="-L$HOME/Downloads/mykobossh/curselib/lib" ./configure --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --with-x11-driver=no --with-slang-driver=no --with-curses-driver=yes --with-ncurses=$HOME/Downloads/mykobossh/curselib --prefix=$HOME/Downloads/mykobossh/aalib
make
make install
Copy aafire, aaflip, aainfo,and aatest to .adds/koreader/scripts directory on Kobo Clara HD.
copy libaa.so.1.0.4 to libaa.so, libaa.so.1, and libaa.so.1.0.
Copy libs to .adds/koreader/libs directory on Kobo Clara HD.
cd ..
---
To build ASCIIVIEW:
tar zxvf aview-1.3.0rc1.tar.gz
cd aview-1.3.0/
./configure --help
CC="arm-linux-gnueabihf-gcc" CPPFLAGS="-I$HOME/Downloads/mykobossh/curselib/include/ncurses" LDFLAGS="-L$HOME/Downloads/mykobossh/curselib/lib" ./configure --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --with-aalib-prefix=$HOME/Downloads/mykobossh/aalib
make
Copy aview and asciiview to .adds/koreader/scripts directory on Kobo Clara HD.
cd ..
---
To extract NETPBM:
From http://archive.debian.org/debian-arc...ian/pool/main/, download and rename extension from .deb to .tgz the following:
/x/xz-utils/liblzma5_5.1.1alpha+20120614-2_armhf.deb
/j/jbigkit/libjbig0_2.1-3.1_armhf.deb
/t/tiff/libtiff5_4.0.3-12.3+deb8u5_armhf.deb
/libp/libpng/libpng12-0_1.2.50-2+deb8u3_armhf.deb
/libj/libjpeg-turbo/libjpeg62-turbo_1.3.1-12_armhf.deb
/z/zlib/zlib1g_1.2.8.dfsg-2+b1_armhf.deb
/n/netpbm-free/libnetpbm10_10.0-15.2_armhf.deb
/n/netpbm-free/netpbm_10.0-15.2_armhf.deb
From the .tgz files, extract the following libs (replacing symlinks with actual copies of the symlinked file as in aalib example) , and copy all libs to .adds/koreader/libs directory on Kobo Clara HD:
libjbig.so.0
libjpeg.so.62, libjpeg.so.62.1.0
liblzma.so.5, liblzma.so.5.0.0
libnetpbm.so.10,libnetpbm.so.10.0
libpng12.so.0, libpng12.so.0.50.0
libtiff.so.5, libtiff.so.5.2.0
libz.so.1, libz.so.1.2.8
From the .tgz files, extract the following bins/scripts , and copy all files to .adds/koreader/scripts directory on Kobo Clara HD:
anytopnm, bmptopnm, giftopnm. jpegtopnm, pngtopnm, pnmtojpeg, pnmtopng, pnmtotiff, tifftopnm
---
EDIT elinks.conf FILE IN .elinks/ (TO CONFIGURE asciiview instead of fbink AS IMAGE VIEWER). Modify only these lines:
set mime.handler.image_viewer.unix.program = "sh /mnt/onboard/.adds/koreader/scripts/asciiview %"
set mime.handler.image_viewer.unix-xwin.program = "sh /mnt/onboard/.adds/koreader/scripts/asciiview %"
---
Dependencies requirements were obtained from:
http://archive.debian.org/debian-arc...hf/Packages.xz
***YOU MUST ALSO CREATE .terminfo/ DIRECTORY IN .adds/koreader/ AND COPY TERMINFO FILES FROM /n/ncurses/ncurses-base_5.9+20140913-1+deb8u3_all.deb***
(Rename to .tgz extension and extract as before. Copy the /v directory to your .terminfo/ directory on your Kobo, or the asciiview program will abort with "Error opening terminal: vt52.")

---



Finally, if you have gotten this far and said, whew, that was a lot, then "HOWTO Create your own native development environment on your Kobo!" might be making a lot more sense now!

*EDIT:Looks like graphical browser with Xorg is also available via chroot. Extra Clara HD config steps on post #46..

So there you have an almost graphical browser.
*Actually, if you use wget (the real one you compiled above, or maybe the cURL binary installed from NiLuJe's kobostuff package - not the stripped-down one that comes with KOReader) you can with a little practice download a page WITH images and that can be opened WITH IMAGES(if they are local, like saved as complete webpage by Firefox) in KOReader for a graphical view!

Last edited by elinkser; 04-24-2023 at 03:51 PM. Reason: alt install
elinkser is offline   Reply With Quote
Old 12-07-2022, 08:26 PM   #2
elinkser
Zealot
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 125
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
***TO DOWNLOAD "COMPLETE" WEB PAGE (Firefox-style)***
Follow instructions at this link to add uri passing to our cross-compiled wget111s command from above, except name the entry "wgets", use the command "wget111s --no-check-certificate --show-progress -nd -E -k -p -Q20M %c", and assign keybinding "Ctrl-W".
Press ENTER key and save by tabbing to the "SAVE" button and pressing ENTER, then ESC to get back to current page.
Now, if you press g, then "g" for google, followed by ENTER, elinks will take you to the google search page.
Enter "Ctl-w" and complete web page is saved to current directory.
To verify, press g, then "." for current local directory, followed by ENTER, then maybe "Ctrl-r" to refresh cache, and a few down-arrow presses to scroll, and voila, your complete web page with images!
Now if you want to browse this page in the luxury of the KOReader environment, turn off networking to be sure you are looking at locally saved files, and browse to your download directory in KOReader to see the "complete" web page with images displayed.
*Note-this option was done while running elinks111s as root, so that the change would be written to the elinks.conf file.


*LONG INSTRUCTIONS FROM LINK:
Spoiler:

Start elinks, and go to the "Options manager" by pressing o or through the menu (press Escape) in Setup > Options manager.
Select the category "Document" and press + to show all the options.
At the very end of the the list (just before the next section, ECMAScript) there is an subsection called "URI passing".
Navigate to that section and press a to add an entry, and give it an appropriate name (I called mine "wgets").
Select the newly created entry and press e to edit it.
Add the command "wget111s --no-check- certificate --show-progress -nd -E -k -p -Q20M %c" into the "Value" field as in the above picture, press Enter, and save the new settings.
Now you need to assign a keybinding to this script, so that you can tell Elinks to launch it when you want to download the complete current page.
Close the Options manager if you haven't done so already (press c) and open the "Keybindings manager" (press k or go to "Setup > Keybindings manager" in the menu).
Open the first section called "Main mapping" with the + key.
To assign a keybinding to download the current page, select the "Pass URI of current tab to external command" and press a to add a keybinding, and enter the keybinding you want to use in the "Keystroke" field.
I used "Ctl-W" for the current page or tab.
Once all the above is done, you're all set to download complete web pages using wget.
Simply press "Ctl-W" to download the the current page.

Last edited by elinkser; 01-16-2023 at 01:06 PM. Reason: remove link dependency
elinkser is offline   Reply With Quote
Old 03-25-2023, 08:44 PM   #3
elinkser
Zealot
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 125
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
***PLS SEE SECURITY REMINDER ON TOP POST***

COPYING ELINKS BINARY TO KOBO CLARA HD WITHOUT COMPILING OR CHROOT:
(Some may find this an easier way to get the elinks browser.)

You can see dependencies of elinks from here.

Depends (6)
libbz2
libcrypto3
libexpat
libssl3
musl
zlib

You can get the packages from here.

You can get a CA certificate store from here.


DOWNLOAD THE REQUIRED PACKAGES:

$ wget https://dl-cdn.alpinelinux.org/alpin...-0.15.1-r1.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...2-1.0.8-r4.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...3-3.0.8-r1.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...t-2.5.0-r0.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...3-3.0.8-r1.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...l-1.2.3-r4.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...-1.2.13-r0.apk

$ wget https://curl.se/ca/cacert.pem


RUN THESE COMMANDS FROM LINUX DESKTOP OR ENVIRONMENT(really just need to unarchive and copy some files, but the tar command fails if you try it on the vfat filesystem /mnt/onboard of the Kobo because of vfat not supporting symlinks. I didn't try on the root filesystem partition e.g. /opt):

$ mkdir myalpine

$ cd myalpine/

$ tar zxvf elinks-0.15.1-r1.apk

$ tar zxvf libbz2-1.0.8-r4.apk

$ tar zxvf libcrypto3-3.0.8-r1.apk

$ tar zxvf libexpat-2.5.0-r0.apk

$ tar zxvf libssl3-3.0.8-r1.apk

$ tar zxvf musl-1.2.3-r4.apk

$ tar zxvf zlib-1.2.13-r0.apk

$ mkdir scripts

$ mv usr/bin/elinks scripts/

$ ls -l scripts/
-rwxr-xr-x 923356 elinks

$ mkdir libs

$ mv usr/lib/libbz2.so.1.0.8 libs/libbz2.so.1

$ mv lib/libcrypto.so.3 libs/

$ mv usr/lib/libexpat.so.1.8.10 libs/libexpat.so.1

$ mv lib/libssl.so.3 libs/

$ cp lib/ld-musl-armhf.so.1 libs/libc.musl-armv7.so.1

$ mv lib/ld-musl-armhf.so.1 libs/

$ mv lib/libz.so.1.2.13 libs/libz.so.1

$ ls -l libs
-rwxr-xr-x 525980 ld-musl-armhf.so.1
-rwxr-xr-x 69772 libbz2.so.1
-rwxr-xr-x 525980 libc.musl-armv7.so.1
-rwxr-xr-x 2233828 libcrypto.so.3
-rwxr-xr-x 132444 libexpat.so.1
-rwxr-xr-x 405904 libssl.so.3
-rwxr-xr-x 66856 libz.so.1

$ cp cacert.pem cert.pm
$ mkdir certs
$ cp cacert.pem certs/ca-certificates.crt


NOW CONNECT YOUR KOBO TO YOUR PC:

Note the contents of /mnt/onboard/.adds/koreader/scripts/ does not have any elinks binary.
Copy your elinks binary from the scripts/ folder on the PC to the /mnt/onboard/.adds/koreader/scripts/ folder on the kobo.

Note the contents of /mnt/onboard/.adds/koreader/libs/ already has a libz.so.1 lib.
Copy all libs except libz.so.1 from the libs/ folder on the PC to the /mnt/onboard/.adds/koreader/libs/ folder on the kobo.
Note that these new libs all have a different date than the default pre-existing libs.

Copy your cert.pm and certs/ca-certificates.crt to the /etc/ssl/ directory.(You may notice there is already one in the /mnt/onboard/.adds/koreader/data/ folder anyway.)



RUN THESE COMMANDS IN KOREADER TERMINAL, OR FROM A TELNET/SSH CLIENT CONNECTION:

***SECURITY REMINDER***
Telnet sessions are in cleartext INCLUDING LOGIN SESSIONS, so only use on a private network, if at all!
If you always have DEVMODE set to ON for whatever reasons , that means Telnet is on by default, unless you toggle it off , e.g. using NickelMenu.

You can install KOReader to get the more secure SSH option, and NiLuJe's kobostuff provides a package that includes an SSH binary.

You can start the KOReader SSH server via NickelMenu.

**********************************

IF RUNNING FROM KOREADER TERMINAL:

# elinks

IF RUNNING FROM A TELNET/SSH CLIENT CONNECTION:

# cd /mnt/onboard/.adds/koreader/
# export LD_LIBRARY_PATH=/mnt/onboard/.adds/koreader/libs/
# echo $LD_LIBRARY_PATH
# ./scripts/elinks


You then enter '.' to see current working directory, or enter a web address
(just keep pressing return if you get SSL errors).
Up and Down arrows to traverse the links.
Left and Right arrows to follow link or go back.
Space and 'b' to page forward and back.
'[' and ']' to go left and right.
Enter to edit a text field, 'd' to download link.
'a' to add a bookmark, 's' to see them, TAB to move through options.
ESC followed by Down arrow and Left/Right arrows to see menus.
'g' to enter a new address, 'q' to quit.


ALL THIS WORKED FOR ME, BUT I AM UNSURE IF IT IS BECAUSE OF SOMETHING I INSTALLED PREVIOUSLY!

YMMVVVVVVVVVVVVVV.....





***


***ADDENDUM - NANO AND WGET***

The nano editor has only the following dependencies:

Depends (2)
musl*
ncurses-libs


And it's not much additional effort to add wget .

Depends (6)
libcrypto3*
libidn2
libssl3*
musl*
pcre2
zlib*

*already got these from elinks install.


DOWNLOAD THE REQUIRED PACKAGES:

$ wget https://dl-cdn.alpinelinux.org/alpin...ano-7.0-r0.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...0221119-r0.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...0221119-r0.apk
(a dependency of ncurses-libs)

$ wget https://dl-cdn.alpinelinux.org/alpin...-1.21.3-r2.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...2-2.3.4-r0.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...ing-1.1-r0.apk
(a dependency of libidn2)

$ wget https://dl-cdn.alpinelinux.org/alpin...2-10.42-r0.apk



RUN THESE COMMANDS FROM LINUX DESKTOP:

$ cd myalpine/

$ tar zxvf nano-7.0-r0.apk

$ tar zxvf ncurses-libs-6.3_p20221119-r0.apk

$ tar zxvf ncurses-terminfo-base-6.3_p20221119-r0.apk

$ tar zxvf wget-1.21.3-r2.apk

$ tar zxvf libidn2-2.3.4-r0.apk

$ tar zxvf libunistring-1.1-r0.apk

$ tar zxvf pcre2-10.42-r0.apk

$ mv usr/bin/nano scripts/

$ mv usr/lib/libformw.so.6.3 libs/libformw.so.6

$ mv usr/lib/libmenuw.so.6.3 libs/libmenuw.so.6

$ mv usr/lib/libncursesw.so.6.3 libs/libncursesw.so.6

$ mv usr/lib/libpanelw.so.6.3 libs/libpanelw.so.6

$ mv usr/bin/wget scripts/wgets

$ mv usr/lib/libidn2.so.0.3.8 libs/libidn2.so.0

$ mv usr/lib/libunistring.so.5.0.0 libs/libunistring.so.5

$ mv usr/lib/libpcre2-8.so.0.11.2 libs/libpcre2-8.so.0

$ mv usr/lib/libpcre2-posix.so.3.0.4 libs/libpcre2-posix.so.3


NOW CONNECT YOUR KOBO TO YOUR PC:

Copy your nano/wgets binaries from the scripts/ folder on the PC to the /mnt/onboard/.adds/koreader/scripts/ folder on the kobo.

Copy new libs from the libs/ folder on the PC to the /mnt/onboard/.adds/koreader/libs/ folder on the kobo:
libformw.so.6
libmenuw.so.6
libncursesw.so.6
libpanelw.so.6
libidn2.so.0
libunistring.so.5
libpcre2-8.so.0
libpcre2-posix.so.3

Copy your etc/terminfo directory to the /etc/ directory.


RUN THESE FROM KOREADER TERMINAL:

# nano
(Ctrl-x to exit)

# /usr/bin/wget
BusyBox v1.31.1.kobo (2020-04-22 11:41:43 EDT) multi-call binary.
...

# wgets -V
GNU Wget 1.21.3 built on linux-musleabihf.
...

# wgets -O mr.html https://www.mobileread.com/forums/sh...91&postcount=3
(Ctrl-c if it hangs)

# elinks mr.html
(q to exit)




IF RUNNING FROM A TELNET/SSH CLIENT CONNECTION:


CREATE THE FILE "/korenv.sh":
#!/bin/sh
export PATH=/mnt/onboard/.adds/koreader/scripts:/mnt/onboard/.adds/koreader/plugins/terminal.koplugin/:$PATH
export LD_LIBRARY_PATH=/mnt/onboard/.adds/koreader/libs:$LD_LIBRARY_PATH
export TERM=xterm
export HOME=/mnt/onboard/.adds/koreader/
cd $HOME

Run the command " . ./korenv.sh"

Then run the commands from above.

(You will also be able to run the KOReader file manager as just "shfm", as listed here .


***




TRY THE W3M BROWSER AS AN ALTERNATIVE TO ELINKS:

The w3m web browser has only the following dependencies:

Depends (6)
gc
libcrypto3*
libssl3*
musl*
ncurses-libs*
zlib*

*already got these from elinks and nano installs.


$ wget https://dl-cdn.alpinelinux.org/alpin...0220429-r3.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...c-8.2.2-r0.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...0220924-r4.apk
(a dependency of gc)

$ wget https://dl-cdn.alpinelinux.org/alpin...0220924-r4.apk
(a dependency of gc)


$ tar zxvf w3m-0.5.3.20220429-r3.apk

$ tar zxvf gc-8.2.2-r0.apk

$ tar zxvf libgcc-12.2.1_git20220924-r4.apk

$ tar zxvf libstdc++-12.2.1_git20220924-r4.apk


$ mv usr/bin/w3m scripts/

$ cp -r usr/lib/w3m libs/

$ mv usr/share/w3m/w3mhelp.html libs/w3m/

$ mv usr/lib/libcord.so.1.5.0 libs/libcord.so.1

$ mv usr/lib/libgc.so.1.5.1 libs/libgc.so.1

$ mv usr/lib/libgctba.so.1.5.0 libs/libgctba.so.1

$ mv usr/lib/libgcc_s.so.1 libs/libgcc_s.so.1

$ mv usr/lib/libstdc++.so.6.0.30 libs/libstdc++.so.6


NOW CONNECT YOUR KOBO TO YOUR PC:

Copy your w3m binary from the scripts/ folder on the PC to the /mnt/onboard/.adds/koreader/scripts/ folder on the kobo.

Copy new libs from the libs/ folder on the PC to the /mnt/onboard/.adds/koreader/libs/ folder on the kobo:
w3m/
libcord.so.1
libgc.so.1
libgctba.so.1
libgcc_s.so.1
libstdc++.so.6


RUN THESE FROM KOREADER TERMINAL:

# cp -r libs/w3m/ /usr/lib/
# w3m -v
('U' to open link,e.g. http://w3m.sourceforge.net/ or https://github.com/tats/w3m , 'q' to quit)
('o' to get option list
Space down to Color Settings->Display with color
Tab to No
Enter
Space down to bottom of options page
Tab or Esc-Tab to OK
Enter
'q' , 'y' to quit)




***

When upgrading to OCP-KOReader-v2023.06 and copying libs from my old KOReader setup, KOReader would crash when opening pdf files.

The crash was because of libs installed for the w3m browser.

w3m libs not needed:
libgcc_s.so.1
libgctba.so.1
* this lib would crash KOReader when opening pdf files *

Ironically, if I don't copy those two libs to the new KOReader installation, w3m seems to work fine anyway.


***




ABBREVIATED OUTPUT OF "elinks -dump libs/w3m/w3mhelp.html":

Spoiler:



Page/Cursor motion

SPC,C-v Forward page
b,ESC v Backward page
l,C-f Cursor right
h,C-b Cursor left
j,C-n Cursor down
k,C-p Cursor up
J Roll up one line
K Roll down one line
^,C-a Go to the beginning of line
$,C-e Go to the end of line
w Go to next word
W Go to previous word
> Shift screen right
< Shift screen left
. Shift screen one column right
, Shift screen one column left
g,M-< Go to the first line
G,M-> Go to the last line
ESC g Go to specified line
Z Move to the center line
z Move to the center column
TAB Move to next hyperlink
C-u,ESC TAB Move to previous hyperlink
[ Go to the first link
] Go to the last link


Hyperlink operation

RET Follow hyperlink
a, ESC RET Save link to file
u Peek at link URL
i Peek at image URL
I View inline image
ESC I Save inline image to file
: Mark URL-like strings as links
ESC : Mark Message-ID-like strings as links
c Peek at current URL
= Display information about current document
C-g Show current line number
C-h View browser history
F Render frames
M Browse current document using external browser (prefix 2, 3,
..., or 9 to invoke alternate configured browsers, e.g. 3 M)
ESC M Browse link using external browser (prefixed as above, e.g. 3ESC M)


File/Stream operation

U Open URL
V View new file
@ Execute shell command and load
# Execute shell command and browse


Buffer operation

B Back to the previous buffer
v View HTML source
s Select buffer
E Edit buffer source
C-l Redraw screen
R Reload buffer
S Save buffer
ESC s Save source
ESC e Edit buffer image


Buffer selection mode

k, C-p Select previous buffer
j, C-n Select next buffer
D Delete current buffer
RET Go to the selected buffer


Bookmark operation

ESC b Load bookmark
ESC a Add current to bookmark


Search

/,C-s Search forward
?,C-r Search backward
n Search next
N Search previous
C-w Toggle search wrap mode


Miscellany

! Execute shell command
H Help (load this file)
o Set option
C-k Show cookie jar
C-c Stop
C-z Suspend
q Quit (with confirmation, if you like)
Q Quit without confirmation










***ADD A COUPLE OF GAMES***


The moon-buggy arcade shooting game has only the following dependencies:

Depends (2)
libncursesw**
musl*

* Already got it from the Elinks/Nano install above.
** Already got the equivalent from the Nano install above.


The ttyper typing test game has only the following dependencies:

Depends (2)
libgcc**
musl*

* Already got it from the Elinks/Nano install above.
** Already got it as a gc subdependency from the W3m install above.


DOWNLOAD THE REQUIRED PACKAGES:

wget https://dl-cdn.alpinelinux.org/alpin...-1.0.51-r1.apk

wget https://dl-cdn.alpinelinux.org/alpin...r-1.2.0-r1.apk


RUN THESE COMMANDS FROM LINUX DESKTOP:

$ cd myalpine/

$ tar zxvf moon-buggy-1.0.51-r1.apk

$ mv usr/bin/moon-buggy scripts/

$ tar zxvf ttyper-1.2.0-r1.apk

$ mv usr/bin/ttyper scripts/


NOW CONNECT YOUR KOBO TO YOUR PC:

Copy your moon-buggy/ttyper binaries from the scripts/ folder on the PC to the /mnt/onboard/.adds/koreader/scripts/ folder on the kobo.


RUN THESE FROM KOREADER TERMINAL:

# moon-buggy
(Space to jump, 'a' to fire, 'q' to quit)

# ttyper -w 5
(type any letter followed by backspace to see 5-word list, then type each word followed by a space. Slide up the right scrollbar to see score.)


***


***NOTE***

The links provided were valid at the time, and should be good for a while, especially if they are all from the same branch, i.e. 3.17 in this case.

But if you download packages from the edge branch, as was the case for moon-buggy, its dependencies will keep changing as the rolling edge branch keeps updating.

So at some point the provided links will be out of date, and you would have to search for the package yourself in the edge branch or the latest branch(e.g. 3.18):
https://pkgs.alpinelinux.org/packages?arch=armv7
This would list the up-to-date dependencies.

Then download the required binary the from the appropriate repository:
https://dl-cdn.alpinelinux.org/alpine/


***

Last edited by elinkser; 09-18-2023 at 07:28 PM. Reason: nano wgets + games + w3m libs not needed + edge note
elinkser is offline   Reply With Quote
Old 07-18-2023, 07:25 PM   #4
elinkser
Zealot
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 125
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
Fbpad

Fbpad and Inkvt

There was a framebuffer-based terminal emulator that runs on the Clara HD (you have to compile it), which you can control from your phone or PC keyboard:
https://www.mobileread.com/forums/sh...d.php?t=298877


These are the build directions if you have a couple of hours to kill (binary attached for your convenience.)


***

On a debian PC:

koreader/koxtoolchain
https://github.com/koreader/koxtoolchain

$ git clone https://github.com/koreader/koxtoolchain.git

$ cd koxtoolchain/

$ sudo apt-get install build-essential autoconf automake bison flex gawk libtool libtool-bin libncurses-dev curl file git gperf help2man texinfo unzip wget

$ ./gen-tc.sh kobo


(2 hours build time on an Acer Chromebook 11 converted to an MX Linux workstation)


$ cd ..


***


$ mkdir fbpad-build

$ cd fbpad-build/


JulianDroske/fbpads
https://github.com/JulianDroske/fbpads
forked from aligrudi/fbpad

$ wget https://github.com/JulianDroske/fbpa...ads/master.zip

$ unzip fbpads-master.zip

$ cd fbpads-master/

$ make

$ cd fbpad_mkfn/

$ make

$ nano -l gen.sh
5 OP="-h34 -w19"
6 SZ="18h135v135"
7 # OP="-h26 -w14"
8 # SZ="18h100v100"

$ ./gen.sh

$ cd ..

$ cd ..



***


NiLuJe/FBInk

https://github.com/NiLuJe/FBInk/releases

$ wget https://github.com/NiLuJe/FBInk/rele...v1.25.0.tar.xz

$ tar xJf FBInk-v1.25.0.tar.xz

$ cd FBInk-v1.25.0/

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

$ make static stripped

$ cd ..


ddvk / fbpad-eink
forked from kisonecat/fbpad-eink
https://github.com/ddvk/fbpad-eink

$ wget https://github.com/ddvk/fbpad-eink/a...ads/master.zip

$ unzip fbpad-eink-master.zip

$ cd fbpad-eink-master/

$ cp -r ../FBInk-v1.25.0/Release FBInk/

$ cp ../FBInk-v1.25.0/fbink.h FBInk/

$ cp ../fbpads-master/fbpad_mkfn/ar.tf fonts/
$ cp ../fbpads-master/fbpad_mkfn/ai.tf fonts/
$ cp ../fbpads-master/fbpad_mkfn/ab.tf fonts/

$ nano -l conf.h
17 typedef int fbval_t;
...
20 #define FR "ab.tf"
21 #define FI "ab.tf"
22 #define FB "ab.tf"

$ nano -l Makefile
3 CC := arm-kobo-linux-gnueabihf-gcc
...
10 xxd -i fonts/ab.tf > font.h

$ nano -l font.c
40 memcpy(&head, fonts_ab_tf, sizeof(head));
...
46 font->glyphs = (int*)(fonts_ab_tf + sizeof(head));
47 font->data =(char*) (fonts_ab_tf + sizeof(head) + font->n * sizeof(int));

$ xxd -i fonts/ab.tf > font.h

$ make

$ file fbpad
fbpad: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.33, with debug_info, not stripped

$ cd ..


***

Copy the fbpad binary to the /mnt/onboard/.adds/koreader/scripts/ directory on your Kobo.

On a ssh session to your Kobo (from phone or PC):
$ ssh root@192.168.2.2 -p 2222

# . /korenv.sh

# fbpad /bin/sh

# pwd

Works in landscape too.
(Try elinks if you have good eyesight.)UPDATE- Fixed font size - now very readable.
Hit the lower right corner of the screen and the nickel menu comes up.

Ctl-Alt-q to quit

If that doesn't work, try "pkill fbpad".

***

How about let's change the default elinks keybindings to allow normal use of arrow keys:

The hard way (see below for the easier way):
In elinks, press 'k' to bring up Keybinding manager.
Press Space to expand [+]- Main mapping.
Use Right arrow to move focus to Delete tab.
Use Down arrow to scroll to and delete the following:
[-]- Move to the next frame: Tab
[-]- Move to the previous frame: Shift-Tab
[-]- Return to the previous document in history: Left
[-]- Go forward in history: u
[-]- Follow the current link: Right
[-]- Follow the current link, forcing reload...: Ctrl-Right
[-]- Open a lua Console: ,
[-]- Move to the next link: Down
[-]- Move to the previous link: Up
[-]- Move downwards by a page: Ctrl-F
[-]- Move upwards by a page: Ctrl-B
[-]- Search link text by typing ahead: #
[-]- Toggle displaying of links numbers: .
Use Right arrow to move focus to Save tab.
Save and Close.

Press 'k' to bring up Keybinding manager again.
Press Space to expand [+]- Main mapping, or Up arrow to scroll to the top if already expanded.
Use Left/Right arrow to focus on Add tab.
Use Down arrow to scroll to and add the following:
[-]- Move to the next frame: Ctrl-f
[-]- Move to the previous frame: Ctrl-b
[-]- Return to the previous document in history: ,
[-]- Go forward in history: .
[-]- Show information about current link: u
[-]- Open a lua Console: Alt-l
[-]- Move cursor down: Down
[-]- Move cursor left: Left
[-]- Move cursor right: Right
[-]- Move cursor up: Up
[-]- Move to the next link: Tab
[-]- Move to the previous link: Shift-Tab
[-]- Toggle displaying of links numbers: #
Use Right arrow to move focus to Save tab.
Save and Close.

The easier way:
Or you could just append to the end of the config file:
$ vi .elinks/elinks.conf
Code:
##################################
# Automatically saved keybindings
#

bind "main" "Ctrl-F" = "frame-next"
bind "main" "Ctrl-B" = "frame-prev"
bind "main" "," = "history-move-back"
bind "main" "." = "history-move-forward"
bind "main" "u" = "link-info"
bind "main" "Alt-l" = "lua-console"
bind "main" "Down" = "move-cursor-down"
bind "main" "Left" = "move-cursor-left"
bind "main" "Right" = "move-cursor-right"
bind "main" "Up" = "move-cursor-up"
bind "main" "Tab" = "move-link-next"
bind "main" "Shift-Tab" = "move-link-prev"
bind "main" "#" = "toggle-numbered-links"
bind "main" "Ctrl-Right" = "none"

So the new way of navigating in elinks would be:

On startup, enter '.' to see current working directory, or enter a web address.
Tab and Shift-Tab to traverse the links.
Enter to follow link or '.' and ',' to go forward and back.
Space and 'b' to page forward and back.
'[' and ']' to go left and right.
Enter to edit a text field, 'd' to download link.
'a' to add a bookmark, 's' to see them, TAB to move through options.
ESC followed by Down arrow and Left/Right arrows to see menus.
'g' to enter a new address, 'q' to quit.

Main difference being now able to move around the page with arrows keys.
Old Down/Up link travelling replaced by Tab/Shift-Tab, and old Left/Right history traversing replaced by ','/'.'.

***

Also get rid of the colors in the ls command by appending this to the /korenv.sh file:

# vi /korenv.sh
Code:
#!/bin/sh

export PATH=$PATH:/mnt/onboard/.adds/koreader/scripts:/mnt/onboard/.adds/koreader/plugins/terminal.k
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/onboard/.adds/koreader/libs
export TERM=xterm
export HOME=/mnt/onboard/.adds/koreader/
cd $HOME

alias ls='ls --color=never'
Now if you run ". /korenv.sh", then "ls" it is in mono.
But it seems you have to run it again after running fbpad.

***

To get rid of the colors in the w3m browser:

In w3m, normally press 'o' to bring up the Option Setting Panel.
Scroll down to the second group, Color Settings.
Put the cursor on the first entry: Display with color.
Tab to the ()NO option and press enter.
Scroll to the end of the section, tab to the [OK], and press enter.

Or just edit the config file:
$ nano -l .w3m/config
38 color 0

But w3m doesn't handle very well fbpad with large font/low number of columns.
Or at all, as you can see with the small-font "fbpads" that I reuploaded.
Note: the "fbpads" I uploaded means "fbpad with Small font", not because it is the above JulianDroske/fbpads that I exploited earlier in the post for its font setup.
Sorry for any confusion.

***


Networking note:
In Quitting Telnet Habit , I said that I wanted to quit telnet and turn off devmode ( Go to the Discover tab and search the store for "devmodeoff"). meaning I lost the "ForceWifiOn=true" option in [DeveloperSettings] in the /mnt/onboard/.kobo/Kobo/Kobo eReader.conf file.
Unfortunately I now find the WiFi connection cutting out.
Others have said leaving the Wifi applet dialog open helps, so I am trying that.

***

Here's one with keyboard:


NiLuJe/inkvt
forked from llandsmeer/inkvt
https://github.com/NiLuJe/inkvt


$ mkdir inkpad-build

$ cd inkpad-build/

$ wget http://http.us.debian.org/debian/poo....1.1-1_all.deb
$ sudo dpkg -i libcxxopts-dev_3.1.1-1_all.deb
OR
$ sudo apt install libcxxopts-dev

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

$ cp ../fbpad-build/FBInk-v1.25.0.tar.xz .

$ tar xJf FBInk-v1.25.0.tar.xz

$ wget https://github.com/NiLuJe/inkvt/arch...ads/master.zip

$ unzip master.zip

$ mv master.zip inkvt-master.zip

$ cd inkvt-master/

$ mv ../FBInk-v1.25.0/* FBInk/

$ mkdir cxxopts/include

$ cp /usr/include/cxxopts.hpp cxxopts/include/

$ make release

Extract InkVT-.zip to Kobo.

InkVT erminal comes up, elinks working great, until screen froze.
Update: Crashed my device, and somehow an update was triggered even though SideloadedMode=true.
Note developer's warning on inkVT github page:
Warning: this project is very experimental! It might brick your device. Only install this if you know what you are doing.

Happy with just fbpad for now.
Attached Files
File Type: bin fbpad.bin (1,000.0 KB, 31 views)
File Type: bin fbpads.bin (168.3 KB, 36 views)

Last edited by elinkser; 08-05-2023 at 03:33 PM. Reason: UPDATE- Fixed font size - fbpad big font, fbpads small, inkvt
elinkser is offline   Reply With Quote
Old 08-30-2023, 05:12 PM   #5
elinkser
Zealot
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 125
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
Fbpad & USB

It seems there is somewhat flaky support for USB keyboard for fbpad on the Kobo, if you have some productive time to fritter away...
* requires USB host support:
https://www.mobileread.com/forums/sh...d.php?t=340418


DOWNLOAD THE AGETTY PACKAGE:

$ cd myalpine/

$ wget https://dl-cdn.alpinelinux.org/alpin...-2.38.1-r1.apk

RUN THESE COMMANDS FROM LINUX DESKTOP:

$ tar zxvf agetty-2.38.1-r1.apk

$ mv sbin/agetty scripts/

NOW CONNECT YOUR KOBO TO YOUR PC:

Copy your agetty binary from the scripts/ folder on the PC to the sbin/ folder on the kobo.


***UPDATE***
CRITICAL STEP (or agetty won't run):
# cp /mnt/onboard/.adds/koreader/libs/ld-musl-armhf.so.1 /lib/
***

Edit system file on your Kobo at your own risk (may blow up your device - just kidding, but type carefully) :

EDIT /sbin/kobo_getty.sh
Code:
#!/bin/sh
[ -e /dev/ttymxc0 ] && /sbin/getty -L ttymxc0 115200 vt100 &
[ -e /dev/ttyS0 ] && /sbin/getty -L ttyS0 0 vt100 &
[ -e /dev/tty1 ] && /sbin/agetty -s 38400 -t 600 tty1 vt100
* I wouldn't want anyone modifying their system files just because I did.
If I may paraphrase NiLuJe, "Here Be Dragons", where "Dragons" be a metaphor for messing up core system functionality possibly leading to failure to startup or connect, or even mysterious application malfunctions that manifest later on.
These system files were put there by folks with comprehensive system level understanding, to be modified by folks who have invested many person-hours code-grokking/reverse engineering to achieve comparable understanding.
Since I am neither, what is my excuse?
Well on my Clara HD the first two lines are exactly the same except I added the "&" at the end.
I then added the third line which I have researched the meaning of.
Also I have multiple backups and contingency plans for connecting to and/or re-establishing my Clara.
Also, it only cost 99 US$, is not used for work, and contains no important data.
So non-expert readers, please make your own risk assessment.


Edit NickelMenu config file:

EDIT /mnt/onboard/.adds/nm/config.txt
Code:
menu_item :main :fbpad :cmd_spawn :quiet:/mnt/onboard/.adds/koreader/scripts/fbpad /bin/sh 0</dev/tty1
    chain_success                      :dbg_toast          :Started fbpad                           
    chain_failure                      :dbg_toast          :Error                                   
menu_item :main :Stop fbpad :cmd_spawn :quiet:/usr/bin/pkill fbpad                                
    chain_success                      :dbg_toast          :Stopped fbpad                           
    chain_failure                      :dbg_toast          :Error

Power off your Kobo.
When you restart it, set USB host mode, plug in your powered USB connected keyboard, run fbpad from NickelMenu, and type (may stall).




*****


CORRECTION FOR MORE STABLE OPERATION:

DO NOT EDIT /sbin/kobo_getty.sh. RETURN IT TO ORIGINAL STATE, e.g.:
Code:
#!/bin/sh
[ -e /dev/ttymxc0 ] && /sbin/getty -L ttymxc0 115200 vt100
[ -e /dev/ttyS0 ] && /sbin/getty -L ttyS0 0 vt100
#[ -e /dev/tty1 ] && /sbin/agetty -s 38400 -t 600 tty1 vt100

INSTEAD EDIT /etc/inittab to add the agetty line only:
Code:
::sysinit:/etc/init.d/rcS
::respawn:/sbin/kobo_getty.sh
::once:/sbin/agetty -s 38400 -t 600 tty1 vt100
::ctrlaltdel:/sbin/reboot
::shutdown:/etc/init.d/rcK
::restart:/sbin/init
***
***UPDATE***
See POST #7 for a better way of doing this.
Avoids the most system file meddling, but you will have to kill agetty again each time you return to Nickel after exiting KOReader.
***


Edit NickelMenu config file to add Stop agetty command:

EDIT /mnt/onboard/.adds/nm/config.txt
Code:
menu_item :main :fbpad :cmd_spawn :quiet:/mnt/onboard/.adds/koreader/scripts/fbpad /bin/sh 0</dev/tty1
    chain_success                      :dbg_toast          :Started fbpad                           
    chain_failure                      :dbg_toast          :Error                                   
menu_item :main :Stop fbpad :cmd_spawn :quiet:/usr/bin/pkill fbpad                                
    chain_success                      :dbg_toast          :Stopped fbpad                           
    chain_failure                      :dbg_toast          :Error  
menu_item :main :Stop agetty :cmd_spawn :quiet:/usr/bin/pkill agetty                                
    chain_success                      :dbg_toast          :Stopped agetty                           
    chain_failure                      :dbg_toast          :Error


Power off your Kobo.
When you restart it, set USB host mode, plug in your powered USB connected keyboard, run Stop agetty, then fbpad from NickelMenu, and type (shouldn't stall).

Last edited by elinkser; 10-22-2023 at 01:33 PM. Reason: risk notice, cd, corrected stability,better hack,ld-musl-armhf.so.1
elinkser is offline   Reply With Quote
Old 09-06-2023, 07:43 PM   #6
elinkser
Zealot
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 125
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
OSCREEN KEYBOARD

MAKING AN ONSCREEN KEYBOARD FOR OUR TERMINAL:

Fbkeyboard is a framebuffer keyboard that we can port to Kobo's fbink library, following the fbpad-eink example.


$ mkdir fbkeyboard-build

$ cd fbkeyboard-build/


***

First we build fbpad as in the previous post, except we leave some rows empty at the bottom of the screen for the keyboard.

Assuming you have already built KOReader's koxtoolchain, NiLuJe's FBInk library, and Aligrudi/Droske's fbpads as before:

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

$ unzip fbpad-eink-master.zip

$ cd fbpad-eink-master/

$ cp -r ../FBInk-v1.25.0/Release FBInk/

$ cp ../FBInk-v1.25.0/fbink.h FBInk/

(First make fbpadkbS, the small font version of fbpad for onscreen keyboard.)

$ nano -l conf.h
Code:
17 typedef int fbval_t;
$ nano -l Makefile
Code:
 3 CC := arm-kobo-linux-gnueabihf-gcc
 4 all: fbpadkbS
...
11 fbpadkbS: fbpad.o term.o pad.o draw.o font.o isdw.o scrsnap.o FBInk/Release/libfbink.a
...
15         rm -f *.o fbpadkbS
$ nano -l pad.c
Code:
 25         rows = fb_rows() * 29 / 51 / fnrows;
$ make

Copy the fbpadkbS binary to the /mnt/onboard/.adds/koreader/scripts/ folder on your Kobo.


(Now make fbpadkb, the large font version of fbpad for onscreen keyboard.)

$ cp ../fbpads-master/fbpad_mkfn/ar.tf fonts/
$ cp ../fbpads-master/fbpad_mkfn/ai.tf fonts/
$ cp ../fbpads-master/fbpad_mkfn/ab.tf fonts/

$ nano -l conf.h
Code:
20 #define FR              "ab.tf"
21 #define FI              "ab.tf"
22 #define FB              "ab.tf"
$ nano -l Makefile
Code:
 4 all: fbpadkb
10         xxd -i fonts/ab.tf > font.h
11 fbpadkb: fbpad.o term.o pad.o draw.o font.o isdw.o scrsnap.o FBInk/Release/libfbink.a
...
15         rm -f *.o fbpadkb
$ nano -l font.c
Code:
40     memcpy(&head, fonts_ab_tf, sizeof(head));
...
46         font->glyphs = (int*)(fonts_ab_tf + sizeof(head));
47         font->data =(char*) (fonts_ab_tf + sizeof(head) + font->n * sizeof(int));
$ xxd -i fonts/ab.tf > font.h

$ nano -l pad.c
Code:
 25         rows = fb_rows() * 25 / 42 / fnrows;
$ make

Copy the fbpadkb binary to the /mnt/onboard/.adds/koreader/scripts/ folder on your Kobo.

$ cd ..


Add the following entries to /mnt/onboard/.adds/nm/config.txt:
Code:
...
menu_item :main :fbpadkb :cmd_spawn :quiet:/mnt/onboard/.adds/koreader/scripts/fbpadkb /bin/sh 0</dev/tty1
    chain_success                      :dbg_toast          :Started fbpadkb       
    chain_failure                      :dbg_toast          :Error                                   
menu_item :main :Stop fbpadkb :cmd_spawn :quiet:/usr/bin/pkill fbpadkb 
    chain_success                      :dbg_toast          :Stopped fbpadkb                        
    chain_failure                      :dbg_toast          :Error
...


***

Freetype is a dependency of Fbkeyboard:

Freetype
https://freetype.org/download.html

Download from:
https://sourceforge.net/projects/fre...etype2/2.13.1/

$ tar zxvf freetype-2.13.1.tar.gz

$ cd freetype-2.13.1/

$ ./configure --host=arm-kobo-linux-gnueabihf

$ make

$ cd ..


***

bakonyiferenc/fbkeyboard
forked from julianwi/fbkeyboard
https://github.com/bakonyiferenc/fbkeyboard

$ wget https://github.com/bakonyiferenc/fbk...ads/master.zip

$ mv master.zip fbkeyboard-master.zip

$ unzip fbkeyboard-master.zip

$ cd fbkeyboard-master/

$ nano -l fbkeyboard.c
Code:
...
 18 */
 19
 20 #include <stdlib.h>
 21 #include <signal.h>
 22 #include <fcntl.h>
 23 #include <string.h>
 24 #include <unistd.h>
 25 #include <dirent.h>
 26 #include <errno.h>
 27 #include <linux/fb.h>
 28 #include <linux/input.h>
 29 #include <linux/uinput.h>
 30 #include <linux/vt.h>
 31 #include <ft2build.h>
 32 #include FT_FREETYPE_H
 33 #include "conf.h"
 34 #include "draw.h"
 35 volatile sig_atomic_t done = 0;
 36 char *font = "/mnt/onboard/.adds/koreader/fonts/noto/NotoSans-Bold.ttf";
...
 38 char *special[][7] = {
 39         { "Esc", "Tab", "Up ", "Dn ", "Lt ", "Rt ", "PgD" },
...
53 __u16 keys[][26] = {
 54         { KEY_ESC, KEY_TAB, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_PAGEDOWN },
......
 88 FT_Face face;
 89 int advance;    // offset to the next glyph
 90 int fduinput;
 91 struct input_event ie;
 92 int oldrow = 0, oldpressed = 0;
 93 struct timeval oldstamp, newstamp, diffstamp;
 94 int theight;    // of touchscreen
 95 int twidth;     // of touchscreen
 96 int trowh;      // heigth of one keyboard row on touchscreen
 97 
 98 void fill_rect(int x, int y, int w, int h, int color)
...
299 void show_fbkeyboard(int fbfd)
300 {
301         switch (rotate) {
302                 case FB_ROTATE_UR:
303                         lseek(fbfd, fblinelength * (fbheight - height * 6), SEEK_SET);
304                         write(fbfd, buf, buflen);
305                         keyb_refresh(fbfd, fbheight - height * 6, 0, width, fbheight);
306                         break;
307                 case FB_ROTATE_UD:
308                         lseek(fbfd, 0, SEEK_SET);
309                         write(fbfd, buf, buflen);
310                         keyb_refresh(fbfd, 0, 0, width, height * 5);
311                         break;
312                 case FB_ROTATE_CW:
313                         for (int i = 0; i < width; i++) {
314                                 lseek(fbfd, fblinelength * i, SEEK_SET);
315                                 write(fbfd, (int32_t *) (buf + linelength * i), linelength);
316                         }
317                         keyb_refresh(fbfd, 0, 0, height * 5, width);
318                         break;
319                 case FB_ROTATE_CCW:
320                         for (int i = 0; i < width; i++) {
321                                 lseek(fbfd, fblinelength * i + (fbwidth - height * 5) * 4, SEEK_SET);
322                                 write(fbfd, (int32_t *) (buf + linelength * i), linelength);
323                         }
324                         keyb_refresh(fbfd, 0, fbwidth - height * 5, fbwidth, width);
325                         break;
326         }
327 }
328 /*  Waits for a relevant input event. Returns 0 if touched, 1 if released. */
329 int check_input_events(int fdinput, int *x, int *y) 
330 {
331         int released = 0;
332         int key = 1;
333         int absolute_x = -1, absolute_y = -1;
334         while (!done && !released && (absolute_x == -1 || absolute_y == -1))
335                 while (read(fdinput, &ie, sizeof(struct input_event))
336                        && !(ie.type == EV_SYN && ie.code == SYN_REPORT)) {
337                         if (ie.type == EV_ABS) {
338                                 switch (ie.code) {
339                                         case ABS_MT_POSITION_X:
340                                                 absolute_x = ie.value;
341                                                 released = 0;
342                                                 key = 0;
343                                                 break;
344                                         case ABS_MT_POSITION_Y:
345                                                 absolute_y = ie.value;
346                                                 released = 0;
347                                                 key = 0;
348                                                 break;
349                                         case ABS_MT_TRACKING_ID:
350                                                 if (ie.value == -1) {
351                                                         released = 1;
352                                                 }
353                                                 break;
354                                 }
355                         }
...
356                         if (ie.type == EV_SYN && ie.code == SYN_MT_REPORT) {
...
357                                 released = 1;
358                         }
359                 }
360         switch (rotate) {
361                 case FB_ROTATE_UR:
362                         *x = 0x10000 - absolute_y * 0x10000 / theight;
363                         *y = absolute_x * 0x10000 / twidth;
364                         break;
365                 case FB_ROTATE_UD:
366                         *x = 0x10000 - absolute_x * 0x10000 / twidth;
367                         *y = 0x10000 - absolute_y * 0x10000 / theight;
368                         break;
369                 case FB_ROTATE_CW:
370                         *x = absolute_y * 0x10000 / theight;
371                         *y = 0x10000 - absolute_x * 0x10000 / twidth;
372                         break;
373                 case FB_ROTATE_CCW:
374                         *x = 0x10000 - absolute_y * 0x10000 / theight;
375                         *y = absolute_x * 0x10000 / twidth;
376                         break;
377         }
378         oldstamp.tv_sec = newstamp.tv_sec;
379         oldstamp.tv_usec = newstamp.tv_usec;
380         newstamp.tv_sec  = ie.time.tv_sec;
381         newstamp.tv_usec  = ie.time.tv_usec;
382         timersub(&newstamp,&oldstamp,&diffstamp);
383         return released;
384 }
385 /* x, y and trowh are scaled to 2^16 (e.g. min x = 0, max x = 65535) */
386 void identify_touched_key(int x, int y, int *row, int *pressed) 
387 {
388         switch ((0x10000 - y) / trowh) {
389                 case 5:
390                         *row = 0;               // Esc, Tab, F10, etc
391                         *pressed = x * 7 / 0x10000;
392                         break;
393                 case 4:
394                         *row = 1;               // q - p
395                         *pressed = x * 10 / 0x10000;
396                         break;
397                 case 3:
398                         *row = 1;               // a - l
399                         if (x > 0x10000 / 20 && x < 0x10000 * 19 / 20)
400                                 *pressed = 10 + (x * 10 - 0x10000 / 2) / 0x10000;
401                         break;
402                 case 2:
403                         if (x < 0x10000 * 3 / 20) {
404                                 *row = 3;
405                                 *pressed = 0;   // Left Shift
406                         } else if (x < 0x10000 * 17 / 20) {
407                                 *row = 1;       // z - m
408                                 *pressed = 19 + (x * 10 - 0x10000 * 3 / 2) / 0x10000;
409                         } else {
410                                 *row = 3;
411                                 *pressed = 1;   // Bcksp
412                         }
413                         break;
414                 case 1:
415                         *row = 4;
416                         if (x < 0x10000 * 3 / 20)
417                                 *pressed = 99;  // 123!@
418                         else if (x < 0x10000 * 5 / 20)
419                                 *pressed = 0;   // Left Alt
420                         else if (x < 0x10000 * 15 / 20)
421                                 *pressed = 1;   // Space
422                         else if (x < 0x10000 * 17 / 20)
423                                 *pressed = 2;   // Right Ctrl
424                         else
425                                 *pressed = 3;   // Enter
426                         break;
427                 default:
428                         *row = 5;               // cursor, Enter, Home, PgDn, etc
429                         *pressed = 3 * y / (0x10000 - trowh * 6);
430                         *pressed *= 3;
431                         *pressed += 3 * x / 0x10000;
432                         break;
433         }
434 }
435
...
489         } else {
490                 send_key(keys[row][pressed]);
491         }
492         oldrow = row;
493         oldpressed = pressed;
494 }
495 /* return max of rows  */
496 int reset_window_size(int fd)
...
559
560 /*      fdcons = open("/dev/tty1", O_RDWR | O_NOCTTY);
561         if (fdcons < 0) {
562                 perror("Error opening /dev/tty1");
563                 exit(-1);
564         } */
565
...
599
600         if (fb_init(FBDEV)) {
601                 fprintf(stderr, "fbkeyboard: failed to initialize the framebuffer\n");
602                 return 1;
603         }
604         if (sizeof(fbval_t) != FBM_BPP(fb_mode())) {
605                 fprintf(stderr, "fbkeyboard: fbval_t does not match framebuffer depth (%d bytes$
606                 return 1;
607         }
608         
609         timerclear(&oldstamp);
610         timerclear(&newstamp);
611         timerclear(&diffstamp);
612         fbfd = fb_fd();
613         fbwidth = fb_cols();
614         fbheight = fb_rows();
615         fblinelength = fb_length();
616         switch (rotate) {
617                 case FB_ROTATE_UR:
...
724
725         while (!done) {
726         /*      if (!ioctl(fdcons, VT_GETSTATE, &ttyinfo)) {
727                         if (tty != ttyinfo.v_active) {
728                                 tty = ttyinfo.v_active;
729                                 close(fdcons);
730                                 fdcons = open("/dev/tty1", O_RDWR | O_NOCTTY);
731                                 set_window_size(fdcons);
732                                 resized[tty] = 1;
733                         }
734                 } else {
735                         perror("VT_GETSTATE ioctl failed");
736                 } */
737
738                 draw_keyboard(row, pressed);
739                 show_fbkeyboard(fbfd);
740                 released = check_input_events(fdinput, &x, &y);
741
742                 if (released)
743                         identify_touched_key(x, y, &row, &pressed);
744                 if (pressed != -1 && (pressed != oldpressed || (long)diffstamp.tv_usec > 50000))
745                         send_uinput_event(row, pressed);
746                 pressed = -1;
747         }
748
...
760                         reset_window_size(fdcons);
761                 }
762         }
763         fb_free();
764 }
765
...

$ mkdir FBInk

$ cp -r ../FBInk-v1.25.0/Release FBInk/

$ cp ../FBInk-v1.25.0/fbink.h FBInk/

$ cp ../fbpad-eink-master/draw.c .

$ cp ../fbpad-eink-master/draw.h .

$ cp ../fbpad-eink-master/conf.h .

$ cp ../freetype-2.13.1/objs/.libs/libfreetype.so* .


$ nano -l draw.c
Code:
...
160
161 int fb_length(void) 
162 { 
163         return finfo.line_length; 
164 }
165
166 void keyb_refresh(int fd, int invalid_top, int invalid_left, int invalid_right, int invalid_bot$
167   fbink_refresh( fb_fd(),
168                  invalid_top,
169                  invalid_left,
170                  invalid_right - invalid_left,
171                  invalid_bottom - invalid_top,
172                  cfg() );
173 /*  invalid_nonempty = 0; */
174   invalid_top = invalid_bottom = invalid_left = invalid_right = 0;
175 }
176

$ nano -l draw.h
Code:
 19 int fb_length(void);
 20 void  keyb_refresh(int fd, int invalid_top, int invalid_left, int invalid_right, int invalid_bottom);
$ cp ../freetype-2.13.1/objs/.libs/libfreetype.a .

$ arm-kobo-linux-gnueabihf-gcc -o fbkeyboard -I../freetype-2.13.1/include/ fbkeyboard.c draw.c libfreetype.a FBInk/Release/libfbink.a


Copy the fbkeyboard binary to the /mnt/onboard/.adds/koreader/scripts/ folder on your Kobo.

$ cd ..


Add the following entries to /mnt/onboard/.adds/nm/config.txt:
Code:
...

          
menu_item :main :fbkeyboard :cmd_spawn :quiet:/mnt/onboard/.adds/koreader/scripts/fbkeyboard
    chain_success                      :dbg_toast          :Started fbkeyboard     
    chain_failure                      :dbg_toast          :Error                                   
menu_item :main :Stop fbkeyboard :cmd_spawn :quiet:/usr/bin/pkill fbkeyboard 
    chain_success                      :dbg_toast          :Stopped fbkeyboard                            
    chain_failure                      :dbg_toast          :Error
...

From MyBooks, go to the Activity page on your Kobo (second tab from left at bottom of screen.)

***UPDATE***
If you are not in SideloadedMode=true (in [ApplicationPreferences] in /mnt/onboard/.kobo/Kobo/Kobo eReader.conf) then you go to More (second tab from RIGHT at bottom of screen, then select Activity.)
***


From NickelMenu select Stop Agetty, fbpadkb, and fbkeyboard entries. (i.e. requires that you implemented the USB keyboard hack of the previous post.)

Unfortunately too slow for practical use right now.
Hopefully something can be tweaked to optimize it.

Can exit with Stop fbkeyboard and Stop fbpadkb entries.

***


EDIT: Added arrow keys to lines 39, 40 and 54 of fbkeyboard.c:
Code:
 38 char *special[][7] = {
 39         { "Esc", "Tab", " ^ ", " v ", " < ", " > ", ">>⇓" },
 40         { "Esc", "Tab", " ^ ", " v ", " < ", " > ", ">>⇓" },
 41 }; 
...
 53 __u16 keys[][26] = {
 54         { KEY_ESC, KEY_TAB, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_PAGEDOWN },
...

EDIT: Added non-blocking IO to fbkeyboard.c to get faster response:
Code:
...
334         while (!done && !released && (absolute_x == -1 || absolute_y == -1))
335                 while ((read(fdinput, &ie, sizeof(struct input_event)) > 0)
336                     /*   && !(ie.type == EV_SYN && ie.code == SYN_REPORT) */ ) {
337                         if (ie.type == EV_ABS) {
338                                 switch (ie.code) {
339                                         case ABS_MT_POSITION_X:
340                                                 absolute_x = ie.value;
341                                                 released = 0;
342                                                 key = 0;
343                                                 break;
344                                         case ABS_MT_POSITION_Y:
345                                                 absolute_y = ie.value;
346                                                 released = 0;
347                                                 key = 0;
348                                                 break;
349                                         case ABS_MT_TRACKING_ID:
350                                                 if (ie.value == -1) {
351                                                         released = 1;
352                                                 }
353                                                 break;
354                                 }
355                         }
356                         if (ie.type == EV_SYN && ie.code == SYN_REPORT) {
357                                 released = 1;
358                         }
359                 }
360         switch (rotate) {
'''
659                 while ((dptr = readdir(inputdevs))) {
660                         if ((fdinput =
661                              openat(dirfd(inputdevs), dptr->d_name,
662                                     O_RDONLY | O_NONBLOCK)) != -1
663                             && ioctl(fdinput, EVIOCGBIT(0, sizeof(key)),
664                                      &key) != -1 && key >> EV_ABS & 1)
665                                 break;
...
742                 if (released)
743                         identify_touched_key(x, y, &row, &pressed);
744                 if (pressed != -1 && (pressed != oldpressed || (long)diffstamp.tv_usec > 200000))
745                         send_uinput_event(row, pressed);
746                 pressed = -1;
747                 usleep(50000);
748         }
749         int i;
...



Unicode Character 21d3 (PageDown arrow on line 39) was entered while holding Ctrl-Sh-u.
https://en.wikipedia.org/wiki/Arrow_(symbol)



***

This code is probably in need of cleanup.
Feel free to jump in!





***
***UPDATE***
See POST #7 - Need WiFi ON (or USB networking) to avoid freezing.
***



***UPDATE***
CRITICAL STEP (or agetty won't run):
# cp /mnt/onboard/.adds/koreader/libs/ld-musl-armhf.so.1 /lib/
***
Attached Files
File Type: bin fbpadkb.bin (1,000.0 KB, 25 views)
File Type: bin fbpadkbS.bin (168.3 KB, 22 views)
File Type: bin fbkeyboard.bin (575.2 KB, 30 views)

Last edited by elinkser; 10-22-2023 at 01:20 PM. Reason: EDIT: Added arrow keys,nonblock,need wifi on,More tab,ld lib
elinkser is offline   Reply With Quote
Old 09-15-2023, 10:17 PM   #7
elinkser
Zealot
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 125
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
SAVING SPACE IN NICKELMENU WITH "SUBMENUS" USING NICKELDBUS

***



SAVING SPACE IN NICKELMENU WITH "SUBMENUS" USING NICKELDBUS


Your NickelMenu might be getting crowded if you have added all the following entries:


Code:
menu_item :main :stop agetty+fbpad+fbkeyboard :cmd_spawn :quiet:/usr/bin/pkill agetty                          
    chain_success                      :cmd_spawn          :quiet :/usr/bin/pkill fbpad
    chain_failure                      :cmd_spawn          :quiet :/usr/bin/pkill fbpad 
    chain_success                      :cmd_spawn          :quiet :/usr/bin/pkill fbkeyboard 
    chain_failure                      :cmd_spawn          :quiet :/usr/bin/pkill fbkeyboard 

menu_item :main    :fbpadkb+fbkeyboard :cmd_spawn          :quiet :/mnt/onboard/.adds/koreader/scripts/fbpadkb /bin/sh 0</dev/tty1
    chain_success                      :cmd_spawn          :quiet :/mnt/onboard/.adds/koreader/scripts/fbkeyboard
    chain_success                      :dbg_toast          :Started fbpadkb and fbkeyboard
    chain_failure                      :dbg_toast          :Error starting fbpadkb or fbkeyboard

menu_item :main    :fbpadkbS+fbkeyboard :cmd_spawn          :quiet :/mnt/onboard/.adds/koreader/scripts/fbpadkbS /bin/sh 0</dev/tty1
    chain_success                      :cmd_spawn          :quiet :/mnt/onboard/.adds/koreader/scripts/fbkeyboard
    chain_success                      :dbg_toast          :Started fbpadkbS and fbkeyboard
    chain_failure                      :dbg_toast          :Error starting fbpadkbS or fbkeyboard   

menu_item :main    :fbpad (toggle):cmd_output         :500:quiet :/usr/bin/pkill -f "fbpad"
    chain_success:skip:4
    chain_failure                      :cmd_spawn          :quiet :/mnt/onboard/.adds/koreader/scripts/fbpad /bin/sh 0</dev/tty1
    chain_success                      :dbg_toast          :Started fbpad
    chain_failure                      :dbg_toast          :Error starting fbpad
    chain_always:skip:-1
    chain_success                      :dbg_toast          :Stopped fbpad

menu_item :main    :fbpadS (toggle):cmd_output         :500:quiet :/usr/bin/pkill -f "fbpadS"
    chain_success:skip:4
    chain_failure                      :cmd_spawn          :quiet :/mnt/onboard/.adds/koreader/scripts/fbpadS /bin/sh 0</dev/tty1
    chain_success                      :dbg_toast          :Started fbpadS
    chain_failure                      :dbg_toast          :Error starting fbpadS
    chain_always:skip:-1
    chain_success                      :dbg_toast          :Stopped fbpadS

menu_item :main    :fbkeyboard (toggle):cmd_output         :500:quiet :/usr/bin/pkill fbkeyboard
    chain_success:skip:4
    chain_failure                      :cmd_spawn          :quiet :/mnt/onboard/.adds/koreader/scripts/fbkeyboard
    chain_success                      :dbg_toast          :Started fbkeyboard
    chain_failure                      :dbg_toast          :Error starting fbkeyboard
    chain_always:skip:-1
    chain_success                      :dbg_toast          :Stopped fbkeyboard

***

But NickelDBus allows us to condense everything to a single NickelMenu entry (i.e. also need NickelDBus installed):


Code:
menu_item :main :fbmenu :cmd_spawn :quiet:exec /mnt/onboard/.adds/koreader/scripts/fbmenu.sh
    chain_success                      :dbg_toast          :Started fbmenu       
    chain_failure                      :dbg_toast          :Error

Also create script /mnt/onboard/.adds/koreader/scripts/fbmenu.sh:

Code:
#!/bin/sh                                        
# fbmenu - fbpad and fbkeyboard selection menu

num=0                              
qndb -m dlgConfirmCreate true                                       
qndb -m dlgConfirmSetTitle "1-Stop agetty+fb(all); 2-fbpadkb; 3-fbpadkbS; 4-fbpad; 5-fbpadS; 6-fbkeyboard;    Select option (1-6):"
qndb -m dlgConfirmSetLEPlaceholder "1"
qndb -m dlgConfirmShow                           
result=$(qndb -s dlgConfirmTextInput)            
textIn=$(echo $result | sed 's/dlgConfirmTextInput //')
num=$(echo $textIn | sed 's/[^0-9]//g')
num=${num:-1}
if [ "$num" != "$textIn" ]
then
num=1
fi                                                                                                 

if [ "$num" == "1" ]; then
		qndb -m mwcToast 1000 "You selected 1-Stop agetty+fbpad"
		fbcmd="/usr/bin/pkill agetty"
		qndb -m mwcToast 1000 "$fbcmd"
		fberr=$($fbcmd 2>&1)
		fbcmd="/usr/bin/pkill fbpad"
		qndb -m mwcToast 1000 "$fbcmd"
		fberr=$($fbcmd 2>&1)
		fbcmd="/usr/bin/pkill fbkeyboard"
		qndb -m mwcToast 1000 "$fbcmd"
		fberr=$($fbcmd 2>&1)
elif [ "$num" == "2" ]; then
		qndb -m mwcToast 1000 "You selected 2-fbpadkb"
		fbcmd="/mnt/onboard/.adds/koreader/scripts/fbkeyboard"
		qndb -m mwcToast 1000 "$fbcmd"
		fberr=$($fbcmd 2>&1) &
		fbcmd="eval /mnt/onboard/.adds/koreader/scripts/fbpadkb /bin/sh 0</dev/tty1"
		qndb -m mwcToast 1000 "$fbcmd"
		fberr=$($fbcmd 2>&1)
elif [ "$num" == "3" ]; then	
		qndb -m mwcToast 1000 "You selected 3-fbpadkbS"
		fbcmd="/mnt/onboard/.adds/koreader/scripts/fbkeyboard"
		qndb -m mwcToast 1000 "$fbcmd"
		fberr=$($fbcmd 2>&1) &
		fbcmd="eval /mnt/onboard/.adds/koreader/scripts/fbpadkbS /bin/sh 0</dev/tty1"
		qndb -m mwcToast 1000 "$fbcmd"
		fberr=$($fbcmd 2>&1)
elif [ "$num" == "4" ]; then
		qndb -m mwcToast 1000 "You selected 4-fbpad"
		fbcmd="eval /mnt/onboard/.adds/koreader/scripts/fbpad /bin/sh 0</dev/tty1"
		qndb -m mwcToast 1000 "$fbcmd"
		fberr=$($fbcmd 2>&1)
elif [ "$num" == "5" ]; then
		qndb -m mwcToast 1000 "You selected 5-fbpadS"
		fbcmd="eval /mnt/onboard/.adds/koreader/scripts/fbpadS /bin/sh 0</dev/tty1"
		qndb -m mwcToast 1000 "$fbcmd"
		fberr=$($fbcmd 2>&1)
elif [ "$num" == "6" ]; then
		qndb -m mwcToast 1000 "You selected 6-fbkeyboard"
		fbcmd="/mnt/onboard/.adds/koreader/scripts/fbkeyboard"
		qndb -m mwcToast 1000 "$fbcmd"
		fberr=$($fbcmd 2>&1)
else
		qndb -m mwcToast 1000 "You selected an invalid option" 
fi

qndb -m mwcToast 1000 "${fberr:-"Bye!"}"

***

A NEW HACK TO AVOID MESSING WITH SYSTEM FILES LIKE A PRO:

* While messing around with an rmkit install, I saw how they avoided messing with system files like we did in POST #5 above:

Return your /etc/inittab to to the way it was (i.e. remove the "agetty" line you added).

Instead create the following file:

/etc/udev/rules.d/90-fbpad.rules
Code:
# : 90-fbpad.rules 2015-01-10 23:58:00Z NiLuJe $
# Runs early at boot... (onboard *might* be mounted at that point)
KERNEL=="loop0", RUN+="/sbin/agetty -s 38400 tty1 vt100"


It would be nice if we could also kill agetty automatically with the following file, but I tried it and that one doesn't work:

/etc/udev/rules.d/91-fbpad.rules
Code:
# : 91-fbpad.rules 2015-01-10 23:58:00Z NiLuJe $
# Runs early at boot... (onboard *might* be mounted at that point)
KERNEL=="loop0", RUN+="/usr/bin/pkill agetty"

***




IMPORTANT NOTE: ON MY KOBO, EITHER USB OR WIFI NETWORKING (WHETHER CONNECTED TO HOTSPOT OR NOT) HAD TO BE ENABLED OR DEVICE FREEZES. WHO KNOWS WHY?
SORRY FOR ANY FRUSTRATION - I HAD DONE MANY SUCCESSFUL TESTS NOT REALIZING THAT ENABLING WIFI WAS RELEVANT!





****



* NOTE : you have to kill agetty again upon returning to Nickel after exiting KOReader.

Last edited by elinkser; 10-28-2023 at 04:16 PM. Reason: NEEDS USB OR WIFI NETWORKING ENABLED!
elinkser is offline   Reply With Quote
Old 09-18-2023, 06:18 PM   #8
elinkser
Zealot
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 125
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
ADD A CHESS GAME FOR THE TERMINAL

***ADD A CHESS GAME FOR THE TERMINAL***

Here's a chess app to stress test your fbpadkb, and have a little fun at the same time!



The gnuchess game has only the following dependencies:

Depends (3)
libgcc**
libintl
musl*

* Already got it from the Elinks/Nano install above (POST #3 - also got the /korenv.sh script.)
** Do not install libgcc since it would crash OCP-KOReader-v2023.06 when opening pdf files.
Fortunately, gnuchess runs fine without it!


RUN THESE COMMANDS FROM LINUX DESKTOP:

$ cd myalpine/

DOWNLOAD THE REQUIRED PACKAGES:

$ wget https://dl-cdn.alpinelinux.org/alpin...s-6.2.9-r1.apk

$ wget https://dl-cdn.alpinelinux.org/alpin...-0.21.1-r1.apk

$ tar zxvf gnuchess-6.2.9-r1.apk

$ tar zxvf libintl-0.21.1-r1.apk

$ mv usr/bin/gnuchess scripts/

$ mv usr/lib/libintl.so.8.3.0 libs/libintl.so.8


NOW CONNECT YOUR KOBO TO YOUR PC:

Copy your gnuchess binary from the scripts/ folder on the PC to the /mnt/onboard/.adds/koreader/scripts/ folder on the kobo.

Copy new lib from the libs/ folder on the PC to the /mnt/onboard/.adds/koreader/libs/ folder on the kobo:
libintl.so.8

Copy the usr/share/gnuchess folder on the PC to the /usr/share/ folder on the kobo:


PLAY CHESS FROM fbpadkb TERMINAL:

# . /korenv.sh

# gnuchess -e
GNU Chess 6.2.9
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
White (1) :


ENTER YOUR MOVE, E.G.:
White (1) : e2e4

1. e2e4

black KQkq e3

r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . P . . .
. . . . . . . .
P P P P . P P P
R N B Q K B N R

Thinking...

white KQkq d6

r n b q k b n r
p p p . p p p p
. . . . . . . .
. . . p . . . .
. . . . P . . .
. . . . . . . .
P P P P . P P P
R N B Q K B N R


My move is : d5
White (2) :


ENTER YOUR NEXT MOVE, E.G.:
White (2) : e4d5

2. e4d5

black KQkq

r n b q k b n r
p p p . p p p p
. . . . . . . .
. . . P . . . .
. . . . . . . .
. . . . . . . .
P P P P . P P P
R N B Q K B N R

Thinking...

white KQkq

r n b q k b . r
p p p . p p p p
. . . . . n . .
. . . P . . . .
. . . . . . . .
. . . . . . . .
P P P P . P P P
R N B Q K B N R


My move is : Nf6


SAVE YOUR GAME AND QUIT:
White (3) : pgnsave game1.pgn
White (3) : quit
#


PLAY AGAIN:
# gnuchess -e
GNU Chess 6.2.9
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
White (1) :


LOAD YOUR GAME AND QUIT:
White (1) : pgnload game1.pgn

white KQkq

r n b q k b . r
p p p . p p p p
. . . . . n . .
. . . P . . . .
. . . . . . . .
. . . . . . . .
P P P P . P P P
R N B Q K B N R

White (1) : quit
#



With a little command-line labor you can install a GUI chess app in a graphical chroot, thanks to NiMa et al:
https://www.mobileread.com/forums/sh...d.php?t=336210

*Of course there is also Vlasovsoft's app which includes a fine GUI chess program.


Updated setup instructions starting from:
https://www.mobileread.com/forums/sh...4&postcount=53

Then just:
# apk add xboard
# xboard

TIPS FOR GETTING STARTED WITH GRAPHICAL CHROOT:

1) Start with the simpler non-graphical version of the chroot:
https://www.mobileread.com/forums/sh...d.php?t=336175

(You may find a script like the one in section 6 of this comment helpful.):
https://www.mobileread.com/forums/sh...1&postcount=46


***
CAUTION: You know how Nickel does all that background work when you connect USB cable to desktop, click "connect", then later unmount?

Well, there may be a risk of data corruption if you had a loop mounted file, e.g. Alpine chroot.
https://www.mobileread.com/forums/sh...38&postcount=2

So better don't try this. But if you DO connect a USB cable, either exit the chroot and unmount the loop first, OR click "cancel" and use SSH/Telnet networking instead. (I have done this for months.)
***




2) Try this site to get the tldr description of a Linux command e.g. the chroot command:
https://html.duckduckgo.com/html/?q=tldr+chroot

(You can change the "chroot" to some other command, e.g. "pkill"):
https://html.duckduckgo.com/html/?q=tldr+pkill






***ADD NETPBM IMAGE CONVERTER***

Netpbm's pnmscale and pnmtopng help with converting our phone camera images to rmkit's Harmony drawing app png layers.
https://www.mobileread.com/forums/sh...d.php?t=356282
Then you can draw with the photo as a background layer.


The netpbm package has the following dependencies:

Depends (6)
libjpeg-turbo**
libpng
libx11***
musl*
tiff***
zlib**

* Already got it from the Elinks/Nano install above (POST #3 - also got the /korenv.sh script.)
** Already have equivalents from base KOReader install.
*** Don't need tiff or libx11 for our commands


RUN THESE COMMANDS FROM LINUX DESKTOP:

$ cd myalpine/

DOWNLOAD THE REQUIRED PACKAGES:

$ wget https://mirror.math.princeton.edu/pu...0.73.41-r1.apk

$ wget https://mirror.math.princeton.edu/pu...-1.6.39-r0.apk

$ tar zxvf netpbm-10.73.41-r1.apk

$ mv usr/bin/pamscale scripts/pnmscale

$ mv usr/bin/pnmtopng scripts/

$ mv usr/lib/libnetpbm.so.11.73 libs/libnetpbm.so.11

$ tar zxvf libpng-1.6.39-r0.apk

$ mv usr/lib/libpng16.so.16.39.0 libs/


NOW CONNECT YOUR KOBO TO YOUR PC:

Copy the following binaries from the scripts/ folder on the PC to the /mnt/onboard/.adds/koreader/scripts/ folder on the kobo.
pnmscale
pnmtopng

***
* Backup your old libpng16.so.16 from the /mnt/onboard/.adds/koreader/libs/ folder on the kobo.
Then delete it from /mnt/onboard/.adds/koreader/libs/
***

Copy libs from the libs/ folder on the PC to the /mnt/onboard/.adds/koreader/libs/ folder on the kobo:
libnetpbm.so.11
libpng16.so.16.39.0

***
* Now doublecheck that KOReader can read png files with this new libpng16.so.16.39.0
***

Copy camera image s.jpg from your phone to the /mnt/onboard/.adds/rmkit/data/harmony/ folder on the kobo.


TRANSFORM PHOTO S.JPG FROM fbpadkb OR KOReader TERMINAL:

From kobo terminal(or SSH session):
# . /korenv.sh
# cd /mnt/onboard/.adds/rmkit/data/harmony

Convert image to grayscale, rotating if necessary:
# jpegtran -rotate 90 -grayscale s.jpg > s90.jpg

Convert jpg image to pnm:
# djpeg -pnm s90.jpg > sg.pnm

Scale image to your display(1088x1488 for Clara HD):
# pnmscale -width 1088 -height 1488 sg.pnm > bg.pnm

Convert pnm image to png:
# pnmtopng bg.pnm > bg.png

Note: you could have dimmed the image by using itself as an alpha mask:
# pnmtopng -alpha bg.pnm bg.pnm > bgs.png

Or for a less ghostly effect, use a 50% grayscale mask:
# pnmtopng -alpha a50.pgm bg.pnm > bga.png

Run harmony from rmkit, and import the bg.png as a layer.

Tip: You can wirelessly copy the photo from phone to Kobo, e.g. with KOReader's GUI ftp client:
https://www.mobileread.com/forums/sh...25&postcount=6


***


USING SCRIPT AND 50% ALPHA CHANNEL (REQUIRES ATTACHED a50.pgm FILE):

Create script jtop.sh (and jtopr.sh for when image needs to be rotated), to convert a jpg image to png while applying 50% alpha transparency.

$ nano jtop.sh
Code:
jpegtran -grayscale $1 | djpeg -pnm | pnmscale -width 1088 -height 1488 | pnmtopng -alpha a50.pgm > $2
Copy this script to /mnt/onboard/.adds/koreader/scripts/ on your kobo.
Unzip the attached a50.zip file and copy a50.pgm and your phone photo s.jpg to /mnt/onboard/.adds/rmkit/data/harmony.
Tip: you can use KOReader's GUI ftp client to download the photo from your phone to your kobo.
https://www.mobileread.com/forums/sh...25&postcount=6


Run the script with input parameters s.jpg (the photo image from your phone) and bg.png (the name you chose for the output png file).

# jtop.sh s.jpg bg.png

You can then input this png image as a layer to harmony.

Similarly for landscape photos that you need to rotate to portrait:

$ nano jtopr.sh
Code:
jpegtran -rotate 90 -grayscale $1 | djpeg -pnm | pnmscale -width 1088 -height 1488 | pnmtopng -alpha a50.pgm > $2
# jtopr.sh s.jpg bgr.png


* NOTE : you have to kill agetty again upon returning to Nickel after exiting KOReader.

***
Attached Files
File Type: zip a50.zip (1.8 KB, 67 views)

Last edited by elinkser; 10-19-2023 at 11:00 AM. Reason: ADD NETPBM IMAGE CONVERTER+SCRIPT/ALPHA,Vlasovsoft
elinkser is offline   Reply With Quote
Old 10-17-2023, 09:15 AM   #9
elinkser
Zealot
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 125
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
ERRORS SO FAR

ERRORS SO FAR

I think I should dedicate a post to errors since I am so error-prone.
* I do not do this on purpose to torture you - sometimes things work only on my Clara that I discover later, e.g. by clean install on new SD card!

CRITICAL STEP (or /sbin/agetty won't run):
# cp /mnt/onboard/.adds/koreader/libs/ld-musl-armhf.so.1 /lib/
This is the the same loader ld-musl-armhf.so.1 from the elinks install in a previous post.
Obviously if I am running binary from /sbin without the library path of /mnt/onboard/.adds/koreader/libs/, then I need to supply the loader in the base /lib/ directory.
I did not realize that I had done this on my Clara some months ago.
Your fbpad w/USB keyboard and fbkeyboard won't work without starting and pkilling agetty (or equivalent).

IMPORTANT NOTE: ON MY KOBO, EITHER USB OR WIFI NETWORKING (WHETHER CONNECTED TO HOTSPOT OR NOT) HAD TO BE ENABLED OR DEVICE FREEZES (when running fbkeyboard). WHO KNOWS WHY?
SORRY FOR ANY FRUSTRATION - I HAD DONE MANY SUCCESSFUL TESTS NOT REALIZING THAT ENABLING WIFI WAS RELEVANT!

Somewhere I renamed fbpads in my upload to fbpadS in my NickelMenu entries.
That might cause error...


Anything else?Hopefully that's it.



***
CAUTION: You know how Nickel does all that background work when you connect USB cable to desktop, click "connect", then later unmount?

Well, there may be a risk of data corruption if you had a loop mounted file, e.g. Alpine chroot.
https://www.mobileread.com/forums/sh...38&postcount=2

So better don't try this. But if you DO connect a USB cable, either exit the chroot and unmount the loop first, OR click "cancel" and use SSH/Telnet networking instead. (I have done this for months.)
***

Last edited by elinkser; 10-28-2023 at 04:15 PM.
elinkser is offline   Reply With Quote
Old 11-16-2023, 08:31 PM   #10
elinkser
Zealot
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 125
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
OSK, A FASTER & MORE USER-CONFIGURABLE ONSCREEN KEYBOARD

OSK, A FASTER & MORE USER-CONFIGURABLE ONSCREEN KEYBOARD:

(Found this by accident when looking for something else. It's from 2018, but still works great on my Clara HD.)

USBMS Shenanigans...
https://www.mobileread.com/forums/sh...0&postcount=14

https://github.com/shermp/go-kobo-input
shermp/go-kobo-input


$ mkdir osk-build

$ cd osk-build/

$ wget https://golang.org/dl/go1.20.2.linux-amd64.tar.gz

$ sudo tar -C /usr/local -xzf go1.20.2.linux-amd64.tar.gz

$ echo "export PATH=/usr/local/go/bin:${PATH}" | sudo tee -a $HOME/.profile

$ source $HOME/.profile

$ go version
go version go1.20.2 linux/amd64

$ source ~/koxtoolchain/refs/x-compile.sh kobo env bare
Note: This refers to the KOReader toolchain from:
https://www.mobileread.com/forums/sh...16&postcount=4
You could try a different toolchain if you feel lucky.

$ env GO111MODULE=off go get github.com/shermp/go-fbink-v2

$ cd ~/go/src/github.com/shermp/go-fbink-v2/

$ cd gofbink/

$ env GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-kobo-linux-gnueabihf-gcc CXX=arm-kobo-linux-gnueabihf-g++ go build


$ cd ../example/

$ env GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-kobo-linux-gnueabihf-gcc CXX=arm-kobo-linux-gnueabihf-g++ go build


Copy the /go/src/github.com/shermp/go-fbink-v2/example/example binary to the /mnt/onboard/.adds/koreader/scripts/ folder of your Kobo.

Run these commands from an SSH session to the Kobo:
# . /korenv.sh
# example

(Should display some nice text messages on Kobo display.)


***

Now for the keyboard:
Back on your PC run:

$ env GO111MODULE=off go get github.com/fogleman/gg

$ env GO111MODULE=off go get github.com/shermp/go-osk

//$ env GO111MODULE=off go get github.com/shermp/kobo-sim-usb/simusb

$ env GO111MODULE=off go get github.com/shermp/go-kobo-input

$ cd ~/go/src/github.com/shermp/go-kobo-input/

$ cd koboin-osk-sample/

$ nano -l main.go
Code:
 25 //      "fmt"
...
 32 //      "github.com/shermp/kobo-sim-usb/simusb"
...
 57 //      u, err := simusb.New(fb)
 58 //      if err != nil {
 59 //              fmt.Println(err)
 60 //      }
 61 //      err = u.Start(true, true)
 62 //      if err != nil {
 63 //              fmt.Println(err)
 64 //              return
 65 //      }
 66 //      defer u.End(true)
Note: the USBMS did work at one time, but stopped along the way, and I am skipping it for now because it's a pain to debug since USB networking must not be activated in this mode.

$ env GO111MODULE=off GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-kobo-linux-gnueabihf-gcc CXX=arm-kobo-linux-gnueabihf-g++ go build

$ arm-kobo-linux-gnueabihf-strip koboin-osk-sample

$ file koboin-osk-sample
koboin-osk-sample: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.33, Go


Copy the ~/go/src/github.com/shermp/go-kobo-input/koboin-osk-sample/koboin-osk-sample binary to the /mnt/onboard/.adds/koreader/scripts/ folder of your Kobo.

Copy the keymap-en_us.json and Roboto-Medium.ttf files from the ~/go/src/github.com/shermp/go-kobo-input/koboin-osk-sample/ folder to the /mnt/onboard/.adds/koreader/ folder of your Kobo.

To avoid keyboard taps activating a Nickel function:
From More tab (second tab from right at bottom of screen), select Activity.
If you are in SideloadedMode=true, then Activity tab is second from left at bottom of screen.

Run these commands from an SSH session to the Kobo:
# . /korenv.sh
# koboin-osk-sample

Tap the CAP key for uppercase letters.
Tap the RET key to exit.


***

To customize our keyboard, we need to:

1. FIX KEY REPEAT ERRORS
2. CHANGE LAYOUT
3. SEND INPUT TO FBPAD

***

$ cd ~/go/src/github.com/shermp/go-osk/

$ cd osk/

1. FIX KEY REPEAT ERRORS:

$ nano -l osk.go
Code:
27 //      "strings"
...
253                                         kc.DrawStringAnchored(string(k.KeyCode), kmx, kmy, 0.5, 0.5)
'''
273                                         if time.Since(v.debounceStartTm) < (200 * time.Millisecond) {

2. CHANGE LAYOUT:

$ nano -l osk.go
Code:
 41         KTesc            = 7
 42         KTtab            = 8
 43         KTup             = 9
 44         KTdown           = 10
 45         KTleft           = 11
 46         KTright          = 12
 47         KTpgUp           = 13
 48         KTpgDn           = 14
...
198         case KTalt:
199                 return "ALT"
200         case KTbackspace:
201                 return "BKSP"
202         case KTcapsLock:
203                 return "CAP"
204         case KTcarriageReturn:
205                 return "RET"
206         case KTcontrol:
207                 return "CTL"
208         case KTdelete:
209                 return "DEL"
210         case KTesc:
211                 return "ESC"
212         case KTtab:
213                 return "TAB"
214         case KTup:
215                 return "^"
216         case KTdown:
217                 return "V"
218         case KTleft:
219                 return "<"
220         case KTright:
221                 return ">"
222         case KTpgUp:
223                 return "<<"
224         case KTpgDn:
225                 return ">>"
$ cd ~/go/src/github.com/shermp/go-kobo-input/

$ cd koboin-osk-sample/

$ nano -l keymap-en_us.json

Spoiler:


Code:
 79                                         "char": "-"
...
 83                                         "keyType": 0,
 84                                         "keyWidth": 1,
 85                                         "char": "="
...
 93                                         "isPadding": false,
 94                                         "keyType": 7,
 95                                         "keyWidth": 1,
 96                                         "char": ""
...
159                                         "isPadding": false,
160                                         "keyType": 2,
161                                         "keyWidth": 1,
162                                         "char": ""
163                                 } 
164                         ]
...
233                                         "char": ";"
...
239                                         "char": "'"
...
249                 {
250                         "rowHeight": 1,
251                         "keys": [
252                                 {
253                                         "isPadding": false,
254                                         "keyType": 8,
255                                         "keyWidth": 1,
256                                         "char": ""
...
316                                         "char": "/"
...
319                                         "isPadding": false,
320                                         "keyType": 0,
321                                         "keyWidth": 1,
322                                         "char": "|"
...
327                         "rowHeight": 1,
328                         "keys": [
329                                 {
330                                         "isPadding": false,
331                                         "keyType": 9,
332                                         "keyWidth": 1,
333                                         "char": ""
334                                 },
335                                 {
336                                         "isPadding": false,
337                                         "keyType": 10,
338                                         "keyWidth": 1,
339                                         "char": ""
340                                 },
341                                 {
342                                         "isPadding": false,
343                                         "keyType": 11,
344                                         "keyWidth": 1,
345                                         "char": ""
346                                 },
347                                 {
348                                         "isPadding": false,
349                                         "keyType": 12,
350                                         "keyWidth": 1,
351                                         "char": ""
352                                 },
353                                 {
354                                         "isPadding": false,
355                                         "keyType": 0,
356                                         "keyWidth": 2,
357                                         "char": " "
358                                 },
359                                 {
360                                         "isPadding": false,
361                                         "keyType": 0,
362                                         "keyWidth": 1,
363                                         "char": "["
364                                 },
365                                 {
366                                         "isPadding": false,
367                                         "keyType": 0,
368                                         "keyWidth": 1,
369                                         "char": "]"
370                                 },
371                                 {
372                                         "isPadding": false,
373                                         "keyType": 13,
374                                         "keyWidth": 1,
375                                         "char": ""
376                                 },
377                                 {
378                                         "isPadding": false,
379                                         "keyType": 14,
380                                         "keyWidth": 1,
381                                         "char": ""
382                                 },
383                                 {
384                                         "isPadding": false,
385                                         "keyType": 5,
386                                         "keyWidth": 1,
387                                         "char": ""
388                                 },
389                                 {
390                                         "isPadding": false,
391                                         "keyType": 1,
392                                         "keyWidth": 1,
393                                         "char": ""
394                                 }
395                         ]
396                 }
397         ]


$ cp keymap-en_us.json keymap1-en_us.json

$ cp keymap-en_us.json keymap2-en_us.json

$ nano -l keymap2-en_us.json

Spoiler:


Code:
 19                                         "char": "!"
...
 25                                         "char": "@"
...
 31                                         "char": "#"
...
 37                                         "char": "$"
...
 43                                         "char": "%"
...
 49                                         "char": "^"
...
 55                                         "char": "&"
...
 61                                         "char": "*"
...
 67                                         "char": "("
...
 73                                         "char": ")"
...
 79                                         "char": "_"
...
 85                                         "char": "+"
...
102                                         "char": "Q"
...
108                                         "char": "W"
...
114                                         "char": "E"
...
120                                         "char": "R"
...
126                                         "char": "T"
...
132                                         "char": "Y"
...
138                                         "char": "U"
...
144                                         "char": "I"
...
150                                         "char": "O"
...
156                                         "char": "P"
...
179                                         "char": "A"
...
185                                         "char": "S"
...
191                                         "char": "D"
...
197                                         "char": "F"
...
203                                         "char": "G"
...
209                                         "char": "H"
...
215                                         "char": "J"
...
221                                         "char": "K"
...
227                                         "char": "L"
...
233                                         "char": ":"
...
239                                         "char": "\""
...
262                                         "char": "Z"
...
268                                         "char": "X"
...
274                                         "char": "C"
...
280                                         "char": "V"
...
286                                         "char": "B"
...
292                                         "char": "N"
...
298                                         "char": "M"
...
304                                         "char": "<"
...
310                                         "char": ">"
...
316                                         "char": "?"
...
322                                         "char": "\\"
...
363                                         "char": "{"
...
369                                         "char": "}"



$ nano -l main.go

Spoiler:


Code:
 27 //      "unicode"
...
 67         fb.Println("Welcome to the test!")
 68         fb.Println("Have Fun!")
 69         var k osk.Key
 70         var prevType int
 71
 72         // Load a keymap file for the OSK
 73         keymap1JSON, _ := ioutil.ReadFile("./keymap1-en_us.json")
 74         km1 := osk.KeyMap{}
 75         json.Unmarshal(keymap1JSON, &km1)
 76         // Create an OSK
 77         vk1, _ := osk.New(&km1, 1080, 1440)
 78         // Generate an image of the OSK
 79         vk1PNG := "./osk1-en_us.png"
 80         vk1Font := "./Roboto-Medium.ttf"
 81         vk1.CreateIMG(vk1PNG, vk1Font)
 82
 83         // Load a keymap file for the OSK
 84         keymap2JSON, _ := ioutil.ReadFile("./keymap2-en_us.json")
 85         km2 := osk.KeyMap{}
 86         json.Unmarshal(keymap2JSON, &km2)
 87         // Create an OSK
 88         vk2, _ := osk.New(&km2, 1080, 1440)
 89         // Generate an image of the OSK
 90         vk2PNG := "./osk2-en_us.png"
 91         vk2Font := "./Roboto-Medium.ttf"
 92         vk2.CreateIMG(vk2PNG, vk2Font)
 93
 94         // Print the image to the screen. Its position on screen should match that stored
 95         // in the keyboard object
 96         fb.PrintImage(vk1PNG, int16(vk1.StartCoords.X), int16(vk1.StartCoords.Y), &cfg)
 97         runeStr := []rune{}
 98         upperCase := false
 99 //      cfg.Row = 16
100         // Read the input from the touch screen
101 L:
...
104                 if err != nil {
105                         continue
106                 }
107                 if upperCase {
108                         k, err = vk2.GetPressedKey(x, y)
109                 } else {
110                         k, err = vk1.GetPressedKey(x, y)
111                 }
112                 if err != nil {
...
119                 case osk.KTstandardChar:
120                         var key rune
121                         key = k.KeyCode
122                         runeStr = append(runeStr, key)
...
130                 case osk.KTcapsLock:
131                         if prevType != osk.KTcapsLock { 
132                                 upperCase = !upperCase
133                                 if upperCase {
134                                         fb.PrintImage(vk2PNG, int16(vk2.StartCoords.X), int16(vk2.StartCoords.Y), &cfg)
135                                 } else {
136                                         fb.PrintImage(vk1PNG, int16(vk1.StartCoords.X), int16(vk1.StartCoords.Y), &cfg)
137                                 }
138                         }
...
143                 }
144                 prevType = k.KeyType
145         }
146 }
147


$ env GO111MODULE=off GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-kobo-linux-gnueabihf-gcc CXX=arm-kobo-linux-gnueabihf-g++ go build

$ arm-kobo-linux-gnueabihf-strip koboin-osk-sample

Copy the ~/go/src/github.com/shermp/go-kobo-input/koboin-osk-sample/koboin-osk-sample binary to the /mnt/onboard/.adds/koreader/scripts/ folder of your Kobo.

Copy the keymap1-en_us.json and keymap2-en_us.json files from the ~/go/src/github.com/shermp/go-kobo-input/koboin-osk-sample/ folder to the /mnt/onboard/.adds/koreader/ folder of your Kobo.


To avoid keyboard taps activating a Nickel function:
From More tab (second tab from right at bottom of screen), select Activity.
If you are in SideloadedMode=true, then Activity tab is second from left at bottom of screen.

Run these commands from an SSH session to the Kobo:
# . /korenv.sh
# koboin-osk-sample

Tap the CAP key to change layouts.
Tap the RET key to exit.

***


3. SEND INPUT TO FBPAD:

To be able to use our keyboard with fbpad terminal, we will send ANSI codes with IOCTL calls instead of simulating input events with uinput.


$ cd ~/go/src/github.com/shermp/go-kobo-input/

$ cd koboin-osk-sample/

$ nano -l main.go

Spoiler:


Code:
 21 package main
 22
 23 import (
 24         "encoding/json"
 25         "fmt"
 26         "io/ioutil"
 27 //      "unicode"
 28         "os"
 29         "syscall"
 30         "unsafe"
 31         "github.com/shermp/go-fbink-v2/gofbink"
 32         "github.com/shermp/go-kobo-input/koboin"
 33         "github.com/shermp/go-osk/osk"
 34 //      "github.com/shermp/kobo-sim-usb/simusb"
 35 )
 36
 37 var ttyFile *os.File
 38 var eno syscall.Errno
 39 //var key byte
 40 var     upperCase bool
 41 var     ctlState bool
 42 var     altState bool
 43 // sendAnsiSeq sends an ANSI escape string to open tty  
 44 func sendAnsiSeq(ansiSeq string) syscall.Errno {
 45         seqBytes := []byte(ansiSeq)
 46         for i := 0; i < len(seqBytes); i++ { 
 47                 _, _, eno = syscall.Syscall(syscall.SYS_IOCTL,ttyFile.Fd(),syscall.TIOCSTI,uintptr(unsafe.Pointer(&seqBytes[i])),)
 48                 if eno != 0 {
 49                         return eno
 50                 } 
 51         }
 52         return 0
 53 }
 54
 55 func main() {
...
 73         fb.Init(&cfg)
 74         var err error
 75         var tty = "/dev/pts/0"
 76         ttyFile, err = os.Open(tty)
 77         if err != nil {
 78                 fmt.Println(err)
 79                 tty = "/dev/pts/1"
 80                 ttyFile, err = os.Open(tty)
 81                 if err != nil {
 82                         fmt.Println(err)
 83                 }
 84         }
 85         defer ttyFile.Close()
 86
 87         // Use kobo-sim-usb to enter USBMS mode where we can use the
...
126         // Print the image to the screen. Its position on screen should match that stored
127         // in the keyboard object
128         fb.PrintImage(vk1PNG, int16(vk1.StartCoords.X), int16(vk1.StartCoords.Y), &cfg)
129 //      runeStr := []rune{}
130         upperCase = false
131         ctlState = false
132         altState = false
133 //      cfg.Row = 16
134         // Read the input from the touch screen
135 //L:
...
152                 switch k.KeyType {
153                 case osk.KTstandardChar:
154                         key := k.KeyCode
155                         tabSeq := []byte(string(key))
156                         if (ctlState) {
157                                 byteSeq := []byte(tabSeq)
158                                 if      (byteSeq[0] > 64) && (byteSeq[0] < 91) {
159                                         byteSeq[0] -= 64
160                                         seqErr := sendAnsiSeq(string(byteSeq[0])) 
161                                         if seqErr != 0 {
162                                                 fmt.Println(seqErr)
163                                         }
164                                 } else if (byteSeq[0] > 96) && (byteSeq[0] < 123) {
165                                         byteSeq[0] -= 96
166                                         seqErr := sendAnsiSeq(string(byteSeq[0])) 
167                                         if seqErr != 0 {
168                                                 fmt.Println(seqErr)
169                                         }
170                                 }
171                         } else {
172                                 seqErr := sendAnsiSeq(string(tabSeq)) 
173                                 if seqErr != 0 {
174                                         fmt.Println(seqErr)
175                                 }
176                         }
177                 case osk.KTcarriageReturn:
178                         tabSeq := []byte{13}
179                         seqErr := sendAnsiSeq(string(tabSeq)) 
180                         if seqErr != 0 {
181                                 fmt.Println(seqErr)
182                         }
183                 case osk.KTbackspace:
184                         tabSeq := []byte{8}
185                         seqErr := sendAnsiSeq(string(tabSeq)) 
186                         if seqErr != 0 {
187                                 fmt.Println(seqErr)
188                         }
189                 case osk.KTdelete:
190                         tabSeq := []byte{127}
191                         seqErr := sendAnsiSeq(string(tabSeq)) 
192                         if seqErr != 0 {
193                                 fmt.Println(seqErr)
194                         }
195                 case osk.KTcapsLock:
196                         if prevType != osk.KTcapsLock { 
197                                 upperCase = !upperCase
198                                 if upperCase {
199                                         fb.PrintImage(vk2PNG, int16(vk2.StartCoords.X), int16(vk2.StartCoords.Y), &cfg)
200                                 } else {
201                                         fb.PrintImage(vk1PNG, int16(vk1.StartCoords.X), int16(vk1.StartCoords.Y), &cfg)
202                                 }
203                         }
204                 case osk.KTcontrol:
205                         ctlState = !ctlState
206                 case osk.KTalt:
207                         altState = !altState
208                 case osk.KTesc:
209                         tabSeq := []byte{27}
210                         seqErr := sendAnsiSeq(string(tabSeq)) 
211                         if seqErr != 0 {
212                                 fmt.Println(seqErr)
213                         }
214                 case osk.KTtab:
215                         tabSeq := []byte{9}
216                         seqErr := sendAnsiSeq(string(tabSeq)) 
217                         if seqErr != 0 {
218                                 fmt.Println(seqErr)
219                         }
220                 case osk.KTup:
221                         tabSeq := []byte{27,91,65}
222                         seqErr := sendAnsiSeq(string(tabSeq)) 
223                         if seqErr != 0 {
224                                 fmt.Println(seqErr)
225                         }
226                 case osk.KTdown:
227                         tabSeq := []byte{27,91,66}
228                         seqErr := sendAnsiSeq(string(tabSeq)) 
229                         if seqErr != 0 {
230                                 fmt.Println(seqErr)
231                         }
232                 case osk.KTleft:
233                         tabSeq := []byte{27,91,68}
234                         seqErr := sendAnsiSeq(string(tabSeq)) 
235                         if seqErr != 0 {
236                                 fmt.Println(seqErr)
237                         }
238                 case osk.KTright:
239                         tabSeq := []byte{27,91,67}
240                         seqErr := sendAnsiSeq(string(tabSeq)) 
241                         if seqErr != 0 {
242                                 fmt.Println(seqErr)
243                         }
244                 case osk.KTpgUp:
245                         tabSeq := []byte{27,91,53,126}
246                         seqErr := sendAnsiSeq(string(tabSeq)) 
247                         if seqErr != 0 {
248                                 fmt.Println(seqErr)
249                         }
250                 case osk.KTpgDn:
251                         tabSeq := []byte{27,91,54,126}
252                         seqErr := sendAnsiSeq(string(tabSeq)) 
253                         if seqErr != 0 {
254                                 fmt.Println(seqErr)
255                         }
256 //                      break L
257                 default:
258                         continue
259                 }
260                 prevType = k.KeyType
261         }
262 }



$ env GO111MODULE=off GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-kobo-linux-gnueabihf-gcc CXX=arm-kobo-linux-gnueabihf-g++ go build -o oskansi

$ arm-kobo-linux-gnueabihf-strip oskansi

Copy the ~/go/src/github.com/shermp/go-kobo-input/koboin-osk-sample/oskansi binary to the /mnt/onboard/.adds/koreader/scripts/ folder of your Kobo.

Note: we have renamed the app "oskansi", meaning on screen keyboard that sends keypresses as ANSI sequences.


Now, edit our /mnt/onboard/.adds/koreader/scripts/fbmenu.sh script (from Post #7 above) so we can call our oskansi keyboard app from NickelMenu:

# nano -l /mnt/onboard/.adds/koreader/scripts/fbmenu.sh
Code:
  6 qndb -m dlgConfirmSetTitle "1-Stop agetty; 2-fbpadkb;      3-fbpadkbS;   4-fbpad;          5-fbpadS;        6-oskansi;       7-oskansiS; Select option (1-7):"
...
 18 if [ "$num" == "1" ]; then
 19                 qndb -m mwcToast 500 "You selected 1-Stop agetty+fbpad"
 20                 fbcmd="/usr/bin/pkill agetty"
 21                 qndb -m mwcToast 200 "$fbcmd"
 22                 fberr=$($fbcmd 2>&1)
 23                 fbcmd="/usr/bin/pkill fbpad"
 24                 qndb -m mwcToast 200 "$fbcmd"
 25                 fberr=$($fbcmd 2>&1)
 26                 fbcmd="/usr/bin/pkill fbkeyboard"
 27                 qndb -m mwcToast 200 "$fbcmd"
 28                 fberr=$($fbcmd 2>&1)
 29                 fbcmd="/usr/bin/pkill oskansi"
 30                 qndb -m mwcToast 200 "$fbcmd"
 31                 fberr=$($fbcmd 2>&1)
...
 58 elif [ "$num" == "6" ]; then
 59                 qndb -m mwcToast 1000 "You selected 6-oskansi"
 60                 export HOME="/mnt/onboard/.adds/koreader/"
 61                 cd "$HOME"
 62                 fbcmd="eval /mnt/onboard/.adds/koreader/scripts/fbpadkb /bin/sh 0</dev/tty1"
 63                 qndb -m mwcToast 1000 "$fbcmd"
 64                 fberr=$($fbcmd 2>&1) &
 65                 fbcmd="/mnt/onboard/.adds/koreader/scripts/oskansi"
 66                 qndb -m mwcToast 1000 "$fbcmd"
 67                 fberr=$($fbcmd 2>&1)
 68 elif [ "$num" == "7" ]; then
 69                 qndb -m mwcToast 1000 "You selected 7-oskansiS"
 70                 export HOME="/mnt/onboard/.adds/koreader/"
 71                 cd "$HOME"
 72                 fbcmd="eval /mnt/onboard/.adds/koreader/scripts/fbpadkbS /bin/sh 0</dev/tty1"
 73                 qndb -m mwcToast 1000 "$fbcmd"
 74                 fberr=$($fbcmd 2>&1) &
 75                 fbcmd="/mnt/onboard/.adds/koreader/scripts/oskansi"
 76                 qndb -m mwcToast 1000 "$fbcmd"
 77                 fberr=$($fbcmd 2>&1)
 78 else
 79                 qndb -m mwcToast 1000 "You selected an invalid option" 
 80 fi
 81
 82 qndb -m mwcToast 1000 "${fberr:-"Bye!"}"


***

To avoid keyboard taps activating a Nickel function:
From More tab (second tab from right at bottom of screen), select Activity.
If you are in SideloadedMode=true, then Activity tab is second from left at bottom of screen.

Oskansi keyboard can be started and stopped from NickelMenu and unlike fbkeyboard, doesn't require networking, as well as being much faster, due to sending ANSI codes with IOCTL calls instead of simulating input events with uinput.

The biggest issue might be that nothing appears on the fbpad screen due to e.g. oskansi sending codes to /dev/pts/0 but fbpad being on /dev/pts/1, but that shouldn't happen if you start oskansi before any other SSH session.

*Also pls see *UPDATE below for NickelMenu entry.

***

And don't forget to copy the keymap1-en_us.json, keymap2-en_us.json, and Roboto-Medium.ttf files to the /mnt/onboard/.adds/koreader/ folder of your Kobo.
Oskansi binary or fbmenu.sh script should be in /mnt/onboard/.adds/koreader/scripts/ folder.

If you're using the fbmenu.sh script above to launch oskansi, you need:
1) NickelDBus installed
https://www.mobileread.com/forums/sh...ht=nickel+dbus
2) A NickelMenu config entry like:
menu_item :main :fbmenu :cmd_spawn :quiet:exec /mnt/onboard/.adds/koreader/scripts/fbmenu.sh
chain_success :dbg_toast :Started fbmenu
chain_failure :dbg_toast :Error

If you're not using the fbmenu.sh script, you could try NickelMenu config entries like:
menu_item :main :fbpadkb :cmd_spawn :quiet :/mnt/onboard/.adds/koreader/scripts/fbpadkb /bin/sh 0</dev/tty1
chain_success :dbg_toast :Started fbpadkb
chain_failure :dbg_toast :Error starting fbpadkb
menu_item :main : oskansi :cmd_spawn :quiet:exec /mnt/onboard/.adds/koreader/scripts/oskansi
chain_success :dbg_toast :Started oskansi
chain_failure :dbg_toast :Error

*** UPDATE ***
* The NickelMenu command (if not using fbmenu.sh) for oskansi should be:

menu_item :main : oskansi :cmd_spawn :quiet:export HOME="/mnt/onboard/.adds/koreader/" && cd "$HOME" && /mnt/onboard/.adds/koreader/scripts/oskansi

This is because oskansi looks for the font and .json files in the current folder, which would be / by default, so it wouldn't find them if you put them in /mnt/onboard/.adds/koreader/ .
***

And grab the fbpadkb.bin binary from Post #6 above and rename it fbpadkb. You need to run this before oskansi.
You do not need the agetty hack from Post #7 above, and can comment out the line in /etc/udev/rules.d/90-fbpad.rules unless you are using fbpad with a USB keyboard or fbkeyboard.

Note that the CTL key in oskansi is a toggle so if you forget to retap it you may get funny characters.
Though it only works with alphabetic characters.
ALT key is a dummy key - maybe someone will want to activate it one day!

***
* Must rename oskansi.zip to oskansi.xz and extract with xz -d.
Attached Files
File Type: zip oskansi.zip (1.04 MB, 20 views)
File Type: gz oskansi-src.tar.gz (111.9 KB, 4 views)

Last edited by elinkser; 11-20-2023 at 02:39 PM. Reason: NickelMenu entry
elinkser is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PW4 Terminal or SSH through experimental browser SirMassive Kindle Developer's Corner 7 03-30-2021 09:51 PM
Web Browser and BookWalker web viewer chronoreverse Amazon Kindle 0 02-06-2019 02:44 PM
Cannot access Calibre-Web via Kobo web browser chakattack Server 14 08-19-2018 08:51 PM
Kindle Fire Web Browser will likely allow for web based games. sirmaru Kindle Fire 10 11-15-2011 03:55 PM
merged terminal/launchpad/web server lrizzo Kindle Developer's Corner 46 10-21-2011 06:51 PM


All times are GMT -4. The time now is 12:57 PM.


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