Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 12-04-2021, 05:27 PM   #1
jollyblondgiant
Member
jollyblondgiant began at the beginning.
 
Posts: 24
Karma: 10
Join Date: Jun 2021
Device: Kindle Touch K5
Custom Menu Options on Kterm

Greetings,

Where are the options set for the menu that pops up with two fingers on kterm? I want to fire off a custom script, either when I do the two-finger tap or, safer, as an option sibling to “rotate screen” or “toggle keyboard” so that I can potentially ssh into a raspi I’m using for a kindle berry project without using the kindle’s keyboard. Is this possible? I’ve been looking through the repo for kterm and have not found where those menu options or their behavior might be set.

Eternally grateful,
JBG
jollyblondgiant is offline   Reply With Quote
Old 12-04-2021, 05:43 PM   #2
irreld
Enthusiast
irreld began at the beginning.
 
Posts: 35
Karma: 10
Join Date: Jan 2016
Device: PW2 PW3 DPT-RP1
This should get you started. Though you might want to spawn a shell first.
irreld is offline   Reply With Quote
Old 12-05-2021, 12:18 PM   #3
jollyblondgiant
Member
jollyblondgiant began at the beginning.
 
Posts: 24
Karma: 10
Join Date: Jun 2021
Device: Kindle Touch K5
Thanks for the suggestion! I’ve never coded in c, but this looks relatively straightforward. I plan to use system() to run ssh, but some forums recommend this might not be the best method. Do you have a suggestion for using ssh from within c? Also thanks for the suggestion to spawn a shell; I don’t write in c much, so excuse my ignorance but why would I need to spawn a shell, and what’s your favorite method for spawning one?

Thanks again,
JBG
jollyblondgiant is offline   Reply With Quote
Old 12-06-2021, 11:23 AM   #4
jollyblondgiant
Member
jollyblondgiant began at the beginning.
 
Posts: 24
Karma: 10
Join Date: Jun 2021
Device: Kindle Touch K5

I'm at a loss here because I can't build kterm:

I updated the kterm.c file with the following code:
Code:
/* line 186, in between definitions for 'fontup' and 'fontdown' */
static void kindleberry(GtkWidget *widget, gpointer terminal) {
    UNUSED(widget);
    UNUSED(terminal);
    system("pi");
}
/* line 406, immediately after 
   GtkWidget *menu = gtk_menu_new();
*/
GtkWidget *kindleberry_item = gtk_menu_item_new_with_label("Kindleberry");
/* a few lines later, on line 416, right after
   GtkWidget *quit_item = gtk_menu_item_new_with_label("Quit");
*/
gtk_menu_shell_append(GTK_MENU_SHELL(menu), kindleberry_item);
/* and finally, line 427, right after
   gtk_menu_shell_append(GTK_MENU_SHELL(menu), quit_item);
*/  
g_signal_connect(G_OBJECT(kindleberry_item), "activate", G_CALLBACK(kindleberry), 
 (gpointer) terminal);
then following instructions on https://github.com/bfabiszewski/kterm the build process fails on
Code:
./configure
with:
Code:
No package 'vte' found
so I tried to install vte from https://github.com/GNOME/vte but that fails at
Code:
meson _build
with:
Code:
meson.build:137: WARNING: Consider using the built-in option for language standard version instead of using "-std=gnu11".
Compiler for C++ supports arguments -std=gnu++20: NO 

meson.build:144:0: ERROR: Assert failed: option -std=gnu++20 not supported by gcc
and my google-fu is not strong enough to find reference to or solution for this error. Does it refer to my OS? I am currently running Ubuntu 20.04.3 'Focal'. How do modern Ubuntu users compile C files? I just need the dozen lines of code injected into kterm.c; the command "pi" exists in my /usr/bin:
Code:
$ cat /usr/bin/pi
#!/bin/sh
echo "baking up some kindleberry pi"
eval $(ssh-agent -s)
ssh-add /rsa/kindleberry
ifconfig usb0 192.168.15.244
ssh pi@192.168.15.201
so that, as yet, all I have to do to get started is type "pi" into the built-in keyboard to set up the ssh-agent, my ssh-key, and connection, then poke with two fingers and hide the keyboard. If the "kindleberry" menu option fires the "pi" command on my kindle i hope it could do the same setup behavior so that I never need to type into the built-in keyboard.

However, I cannot install vte, and therefore cannot build kterm myself. If a wizard were to build
Code:
make dist-kindle
and send this lost novice the generated zip file, or alternatively help clear up the vte installation confustion, I'd be sincerely grateful.
jollyblondgiant is offline   Reply With Quote
Old 12-06-2021, 01:18 PM   #5
katadelos
rm -rf /
katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.
 
Posts: 219
Karma: 3333683
Join Date: Nov 2019
Location: United Kingdom
Device: K5, KT, KT2, KT3, KT4, KV, PW2, PW3, PW4, PW5
This sounds like an XY problem - if your goal is to autologin to the Pi, just pass your login script to kterm when it starts?

Try changing /mnt/us/extensions/kterm/bin/kterm.sh to something like this:
Code:
#!/bin/sh
EXTENSION=/mnt/us/extensions/kterm
DPI=`cat /var/log/Xorg.0.log | grep DPI | sed -n 's/.*(\([0-9]\+\), [0-9]\+).*/\1/p'`
#use different layouts for high resolution devices
if [ ${DPI} -gt 290 ]; then
  PARAM="-l ${EXTENSION}/layouts/keyboard-300dpi.xml"
elif [ ${DPI} -gt 200 ]; then
  PARAM="-l ${EXTENSION}/layouts/keyboard-200dpi.xml"
fi
export TERM=xterm TERMINFO=${EXTENSION}/vte/terminfo
${EXTENSION}/bin/kterm ${PARAM} -e "/usr/bin/pi" "$@"
katadelos is offline   Reply With Quote
Reply

Tags
kindle touch, kindleberry pi, kterm


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide/remove some top menu options in Calibre. vishwam Calibre 3 02-22-2019 10:14 PM
How to access regular android menu options on stock rom? Roseweave Barnes & Noble NOOK 1 12-26-2013 03:22 PM
Items missing from the Reading Options menu TheBFG Amazon Kindle 2 04-19-2013 07:33 AM
PRS-900 Menu Options/Volume - Ghost in the Machine? whalesong Sony Reader 1 02-19-2011 03:20 PM
Firmware changed menu options? Bob Russell Sony Reader 2 08-07-2007 11:09 PM


All times are GMT -4. The time now is 02:10 AM.


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