LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-12-2016, 09:59 PM   #1
VIC-20
LQ Newbie
 
Registered: Jan 2016
Posts: 1

Rep: Reputation: 0
How to write program for RasPi that accepts input from PuTTY in RAW mode?


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.
 
Old 02-13-2016, 07:51 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,965

Rep: Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530
Welcome to LinuxQuestions

PuTTY's raw mode is a way to send plain text to a running service. It does not use ssh or any defined protocol.

http://the.earth.li/~sgtatham/putty/...#using-rawprot

To receive data you need to write a network program that listens on the desired port. You can find many examples of python network programming by searching the web. I'm still learning python...

http://www.ibm.com/developerworks/li...cks/index.html
http://www.dabeaz.com/python/PythonNetBinder.pdf
 
1 members found this post helpful.
Old 02-13-2016, 10:16 AM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Quote:
Originally Posted by VIC-20 View Post
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.

Last edited by jpollard; 02-13-2016 at 10:18 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Putty RAW mode connection RileyTheWiley Linux - Networking 2 04-06-2013 02:27 PM
How to write a program that captures joystick input? chutsu Linux - General 1 05-10-2009 06:22 PM
how to write crontab for cpp program so that it accepts input interactively srinivas445 Linux - Newbie 1 10-15-2008 02:09 PM
Raw mode keyboard input vivekagrawal82 Linux - Software 1 07-02-2005 11:11 PM
Client for 'raw telnet mode' like PuTTY wies Linux - Networking 1 03-30-2005 11:20 AM


All times are GMT -5. The time now is 02:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration