joukos / PaperTTY

PaperTTY - Python module to render a TTY or VNC on e-ink
946 stars 101 forks source link

Issue running terminal #73

Closed JetJaguar124 closed 2 years ago

JetJaguar124 commented 3 years ago

Sorry if this is incredibly basic, but I've installed papertty on my raspberry pi 3 with a 9.7" waveshare epaper screen and it's been running quite well. I've gotten the VNC, image, etc... features running without issue. However, when trying to run terminal, it's outputting absolutely tiny font and in the wrong orientation (see this image: https://postimg.cc/QBtb0sCQ). I'm running Debian 10 (Buster) which may be part of the reason for the error. Per the dev updates on the front page, it looks like unicode support was incorporated for this particular OS. However, when I run papertty terminal it provides an error message about unicode being unsupported and defaulting to 8 bit, which may be part of the issue.

In addition to the tiny sideways text, it appears that the terminal on my papertty screen is not receiving input commands, as nothing I type is showing up.

Forgive me if this issue is extremely pedestrian. If it's been addressed elsewhere, just let me know. I'm not very familiar with programming for drivers, but I have some experience with python, so if this seems like an error of some kind that you could use help fixing, I wouldn't mind helping out if you could point me to where I can learn some about how all this works.

Thanks and this has been a wonderful project to stumble on to! I was worried I'd have to learn how to program an IT8951 driver for this bad boy myself, which probably would have required a great deal of time.

joukos commented 3 years ago

The message about unicode not being supported would refer to the font you've picked, so make sure you're using a TrueType font (note that you need to give it the complete path to the .ttf file, check in /usr/share/fonts). With such a big display and small font, the terminal also has some limitations since it uses the Linux virtual console instead of a more flexible pseudo terminal (for which support is still unimplemented). VNC is the workaround since you can use your favorite terminal emulator.

I forget the limitations of VT resizing exactly, but essentially setting arbitrary rows/cols for the console won't work (either it was a limitation with the console itself or the way PaperTTY handles it) and with a big display and a tiny font this is apparent if you fill the screen with text. For your display you should try a fairly big font to utilize all of it. Using the --autofit option PaperTTY tries to match the rows/columns for the font, so it's recommended to use that if possible (if the font's too small, it will fail to fit).

To fix the orientation you can try --portrait - some displays are internally wired to be in a different orientation than one might expect, so for some this might actually mean that they'll change to "landscape" mode. The terminal feature currently doesn't provide as useful orientation options as vnc/image though (should be fixed, not too hard).

I recommend checking the --help for the terminal feature to perhaps get a more concise summary of the options than the currently messy README, and also after picking a nice font you may want to try --interactive so you change the font size etc. on the fly (press Ctrl-C to get a menu).

Regarding input - are you typing with a keyboard that's directly connected to the RPi's USB ports? You should, unless you use a trick to start a tmux (or such) session in the console to access it from elsewhere. Just typing stuff to the terminal you start PaperTTY from will not work, because what PaperTTY actually does with the terminal feature is display the raw content of /dev/vcsu (or vcsa) - and that's the virtual console, where your boot messages and the login prompt are printed after turning the thing on. That said, you should be able to start it up in the same virtual console itself and see it running.

If you're launching PaperTTY on the RPi itself via a graphical desktop, you also need to somehow input the text to the virtual console instead. This may be as simple as doing a Ctrl-Alt-F1 to hop to VT1. I don't remember now how Raspbian was configured with regard to these, but you should be able to get back to GUI from the console by trying Alt-F2, Alt-F3... etc. until you're back there.

The VT stuff is grantedly a bit obscure these days so starting up tmux there instead (README has some instructions for this, hopefully not too out of date) and then connecting to that from wherever you want is often a nicer option, but this depends on your use case.

Let me know if the above doesn't help. Also, just boldly hack on the code - it's actually much simpler than one might expect and there's plenty of low-hanging fruit to improve.