Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work on non-interactive shell #32

Closed
parkerlreed opened this issue Feb 23, 2019 · 15 comments
Closed

Does not work on non-interactive shell #32

parkerlreed opened this issue Feb 23, 2019 · 15 comments

Comments

@parkerlreed
Copy link

parkerlreed commented Feb 23, 2019

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
@NiLuJe
Copy link
Owner

NiLuJe commented Feb 24, 2019

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.

@NiLuJe
Copy link
Owner

NiLuJe commented Feb 24, 2019

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

@parkerlreed
Copy link
Author

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

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

@parkerlreed
Copy link
Author

parkerlreed commented Feb 25, 2019

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()

@NiLuJe
Copy link
Owner

NiLuJe commented Feb 25, 2019 via email

@NiLuJe
Copy link
Owner

NiLuJe commented Feb 25, 2019 via email

NiLuJe added a commit that referenced this issue Mar 3, 2019
Besides fixing #32, this also prevents piping stuff like tail -f to
fbink, which I'm not a fan of, so I may be tweaking this...
NiLuJe added a commit that referenced this issue Mar 3, 2019
Less side-effects.
This only prohibits "follow" use-cases over non-interactive SSH
sessions instead of everywhere.
@NiLuJe
Copy link
Owner

NiLuJe commented Mar 3, 2019

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!

@NiLuJe NiLuJe closed this as completed Mar 3, 2019
@parkerlreed
Copy link
Author

parkerlreed commented Apr 16, 2019

:D just got around to testing it
IMG_20190416_144510

Didn't need the echo. Cheers!

@NiLuJe
Copy link
Owner

NiLuJe commented Apr 16, 2019

Fantastic, thanks for the confirmation ;).

@parkerlreed
Copy link
Author

parkerlreed commented Apr 16, 2019

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?

@parkerlreed
Copy link
Author

echo 14 3 > /proc/eink_fb/update_display

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

@NiLuJe
Copy link
Owner

NiLuJe commented Apr 17, 2019

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 ;).

@NiLuJe
Copy link
Owner

NiLuJe commented Apr 17, 2019

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

@NiLuJe
Copy link
Owner

NiLuJe commented Apr 17, 2019

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).

@NiLuJe
Copy link
Owner

NiLuJe commented Apr 17, 2019

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants