LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Com port data to file (https://www.linuxquestions.org/questions/linux-software-2/com-port-data-to-file-578651/)

Ashrael 08-21-2007 05:50 AM

Com port data to file
 
HELP! I need a program (or a way) to read the com-port output of a meter, normaly it conncts to a small printer and takes ages to print out the data, which i need to copy to a spreadsheet again, this is labourious to say the least.. I am urgently looking for a way to do this directly.. Any suggestions, tips etc are welcome..



THANX!

blackhole54 08-21-2007 09:13 AM

You are talking about a serial port such as /dev/ttyS0 (COM1 in Microsoft speak)?

It really depends on what your needs are. If you just want to log incoming data to a file, for example, your solution might be as simple as the shell command (which can be in a script):

Code:

cat /dev/ttyS0 > filename
or to just spit the data out to the screen interactively:

Code:

cat /dev/ttyS0
I can think of two issues with this. This first is the issue of permissions. To do a quick-n-dirty check to see if this will work for you, you can run the command as root. If it turns out this accomplishes what you want, you will probably want to change permissions so you can run as it as a regular user. (It's bad security to run things as root that you don't have to.)

The other thing to think about is configuring the port. Check the man page of stty for about a kazillion settings for the port. You, of course, need to get baud rate right. You should also be careful on your echo settings or you might get an infinite loop going with each device echoing to the other.

If you want to interact with the device you might find minicom useful.

If neither of these suggestions does what you want, perhaps you can flesh out your problem a little more.

Ashrael 08-26-2007 01:35 PM

Thx!
 
Thanx for the tip, i'll try that this week and give you an update!....


All times are GMT -5. The time now is 09:20 AM.