Originally Posted by VIC-20
I have a Raspberry Pi 2 running the latest Raspbian OS (based on Debian Linux). I've learned to SSH in from a Widows 7 client using PuTTY. I'm learning Python to (hopefully) write code that lets Windows send 6 bytes over the internet to the RPi2 via a SSH connection in PuTTY's raw mode. Assuming I get this far, please outline the steps needed to read the incoming data. One problem is that the data I now send appears as command line text in the Xterm window. It should, instead, go to the code I need to write. PuTTY has the option "Don't start a shell or command at all". Will that work? Do I then read the data out of "the" serial port? I found a package that lets me code in BASIC (one less thing to learn). The documentation has commands for "Serial Port Programming" that seem to meet my needs. The serial port, it says, "...might be something like ”/dev/ttyS1”" Am I on the right track? If not, your guidance could save me some real headaches. Thanks.
All you do is have the python script set the tty to raw mode. I'm not sure of the Python code, but from C it involves getting the terminal characteristics (ioctl to get them), modify them to enable raw mode, then (ioctl to set them) to set raw mode. Note, it is a good idea to save the original characteristics so that you can restore them before the program exits.
This is what nearly all editors (vi/vim/emacs/...) do when you use them remotely.