Closed parkerlreed closed 5 years ago
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
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()
I'll take a closer look at it when I get back next week, because it probably shouldn't hang with no input, at the very least ;)
On Mon, Feb 25, 2019, 06:51 parkerlreed notifications@github.com wrote:
Here's the code (I addec 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('
', onLeftDrag) frame.bind(' ', key) frame.pack() root.mainloop()
ssh.close()
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/NiLuJe/FBInk/issues/32#issuecomment-466880714, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG1Zh5tgyJa2jaaYl3A0IvJu1qXp7x9ks5vQ3nrgaJpZM4bOEcA .
Note that you could also go with the Python bindings for this sort of stuff ;).
I'd even recommend using A2 updates for stuff like that to make it slightly more reactive, but you currently can't with the image drawing API, I need to tweak that to make it possible ;).
On Mon, Feb 25, 2019, 12:11 NiLuJe ninuje@gmail.com wrote:
I'll take a closer look at it when I get back next week, because it probably shouldn't hang with no input, at the very least ;)
On Mon, Feb 25, 2019, 06:51 parkerlreed notifications@github.com wrote:
Here's the code (I addec 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('
', onLeftDrag) frame.bind(' ', key) frame.pack() root.mainloop()
ssh.close()
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/NiLuJe/FBInk/issues/32#issuecomment-466880714, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG1Zh5tgyJa2jaaYl3A0IvJu1qXp7x9ks5vQ3nrgaJpZM4bOEcA .
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
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...
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...
It fails to clear the screen and hangs at the end (leaving the connection open)
Works fine when in interactive. Kindle 4 non-touch