NiLuJe / FBInk

FrameBuffer eInker, a small tool & library to print text & images to an eInk Linux framebuffer

Home Page:https://www.mobileread.com/forums/showthread.php?t=299110

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not work on non-interactive shell

parkerlreed opened this issue · comments

It fails to clear the screen and hangs at the end (leaving the connection open)

Works fine when in interactive. Kindle 4 non-touch

[parker@stealth ~]$ ssh root@192.168.86.125 fbink -c
root@192.168.86.125's password: 
[FBInk] Enabled Legacy einkfb Kindle quirks
[FBInk] Clock tick frequency appears to be 100 Hz
[FBInk] Screen density set to 167 dpi
[FBInk] Variable fb info: 600x800, 8bpp @ rotation: 0 (Upright, 0°)
[FBInk] Fontsize set to 16x16 (IBM base glyph size: 8x8)
[FBInk] Line length: 37 cols, Page size: 50 rows
[FBInk] Fixed fb info: ID is "eink_fb", length of fb mem: 966656 bytes & line length: 600 bytes
[FBInk] Pen colors set to #000000 -> #FFFFFF for the foreground and #FFFFFF -> #000000 for the background

Yeah, it's expecting to read from stdin when stdin is not a tty.

You'll have to pass an empty string if you want a clear over a non-interactive shell.

(I'm away for a week, so this is an AFAIR answer for now ;)).

And just like that, you bring the idea to life :D

https://www.youtube.com/watch?v=p3Jv77gtLNk

Here's the code (I added c to clear the screen)

from tkinter import *
import paramiko

hostname = '192.168.86.125'
password = 'password'
username = 'root'

root = Tk()

def key(event):
    stdin, stdout, stderr = ssh.exec_command("echo '' | fbink -c")

def onLeftDrag(event):
    stdin, stdout, stderr = ssh.exec_command("echo '' | fbink -g file=/mnt/us/circle.png,x=" + str(event.x) + ",y=" + str(event.y) + " -x 0 -y 0")

frame = Frame(root, width=600, height=800)
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.connect(hostname, username=username, password=password)
stdin, stdout, stderr = ssh.exec_command("echo '' | fbink -c")

frame.focus_set()
frame.bind('<B1-Motion>', onLeftDrag)
frame.bind('<c>', key)
frame.pack()

root.mainloop()

ssh.close()

Okay, the stdin / non-interactive SSH session issue should (mostly) be fixed.
For your specific use-cases, no need to pass an empty string anymore :).

And I just added support for specifying a waveform mode when printing an image ;).

That'll make it into 1.12.0, which I'll be releasing later tonight.

Thanks!

:D just got around to testing it
IMG_20190416_144510

Didn't need the echo. Cheers!

Fantastic, thanks for the confirmation ;).

Quick question. Let's just say someone killed a lot of unnecessary processes and wants to throw an image on the display...

image

fbink still works but I lose rotation (since that was being handled by the main application)

I don't see a rotate option in fbink. Is this possible?

echo 14 3 > /proc/eink_fb/update_display

Mostly works but has some weird artifacting towards the top of the image

I don't remember if there's a /sys/class/graphics/fb0/rotate on the K4, and whether it behaves sanely ;).

Otherwise, it's done via ioctl, cf. rota.c in utils ;).

It may be weirder on the K4, because it's using a legacy einkfb shim, while actually being mxcfb under the hood...

i.e., instead of/in addition to the standard Linux fb ioctl, there's the einkfb one here, which apparently matches what you did via procfs.

I've never played with rotation on Kindle, as it's always been sane (i.e., origin at (0, 0) on the top-left) in my usual use cases ;).

I can just say that the K4 may be quirkier than other Kindles in that respect, because of the einkfb-on-top-of-mxcfb thing (as it's essentially a Kindle Touch masquerading as a Kindle 3).

I wouldn't even know how to mess rotation up, as I don't think the framework touches it, since I'm fairly sure I print stuff with the framework down during MRPI sessions...