LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-05-2010, 08:11 AM   #1
gm04030276
LQ Newbie
 
Registered: Jul 2007
Posts: 5

Rep: Reputation: 0
/dev/ttyS multiplexer?


Hi, Im wondering if there is a program to multiplex the output of a serial device.

I have an arduino with a gps plugged in transmitting NMEA data on /dev/ttyUSB0. I can get this information to u-center (Software by the gps chipset manufacturer) or to gpsd and out to other programs.

I'm trying to program my own ncurses app in python and was looking into using python-gps however it doesn't seem to be getting all the data from gpsd or something.

Anyway, I was wondering if there is a program to take the output from /dev/ttyUSB0 and output it through virtual devices so that gpsd, u-center and my own app can get all the gps data through connecting to the virtual devices?

Both u-center and gpsd can be connected but only one can get the data because once it's read from the device its gone.
 
Old 01-05-2010, 01:02 PM   #2
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 414

Rep: Reputation: 33
Maybe?

Is there any hand shacking to your gps device??

You could use a hardware solution? Wire the gps output to two different serial devices?

Or a software solution using pipes or pseudo terminals?

I am assuming you are running Linux?
 
Old 01-05-2010, 04:38 PM   #3
gm04030276
LQ Newbie
 
Registered: Jul 2007
Posts: 5

Original Poster
Rep: Reputation: 0
The device just automatically starts dumping out NMEA strings at 9600 baud so no handshaking needed. Only need to communicate with it if I want to do extra configuration. But only one program at a time would be doing that since it would be user controlled. (at least in u-center and my own software, don't know if gpsd does anything, though there is an option to stop it?)

I would prefer a software solution if possible

yes, I'm using Ubuntu 9.10 x86_64. Will be using Ubuntu UNR when my netbook arrives which is really what I want this running on.
 
Old 01-07-2010, 01:18 PM   #4
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 414

Rep: Reputation: 33
OK, you can try this:
  • Start the GPS app using ttyUSB0
  • Start your next app using a redirect, 'next_app < /dev/ttyUSB0'
This assumes that your next_app is using stdin for it's data input?
You may need to adjust the mod of ttyUSB0?

You could test it with this script:
Code:
/bin/bash
/usr/bin/xterm -e /bin/bash -c "/bin/cat < /dev/ttyUSB0" &
u-center /dev/ttyUSB0 &
 
Old 01-09-2010, 05:48 AM   #5
gm04030276
LQ Newbie
 
Registered: Jul 2007
Posts: 5

Original Poster
Rep: Reputation: 0
I don't think anything uses stdin. u-center doesn't, and gpsd doesn't seem to (tried it).

I can get the raw gps info from gpsd using gpspipe and open that in python for reading, so I can use that for my own app easily enough. But u-center is a wine app, it needs a link straight to the device from ~/.wine/dosdevices/com1 to /dev/ttyUSB0.

Is there no way I can even write a little app in some language to read from the /dev/device and create 2 to write to? It doesn't seem like it should be that hard. Just reading from one place and writing to two+. How do you open for writing a /dev like file/device/...what is it?
 
Old 01-16-2010, 06:57 PM   #6
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 414

Rep: Reputation: 33
You can use 'tee'.

Quote:
Originally Posted by gm04030276 View Post
I don't think anything uses stdin. u-center doesn't, and gpsd doesn't seem to (tried it).

I can get the raw gps info from gpsd using gpspipe and open that in python for reading, so I can use that for my own app easily enough. But u-center is a wine app, it needs a link straight to the device from ~/.wine/dosdevices/com1 to /dev/ttyUSB0.

Is there no way I can even write a little app in some language to read from the /dev/device and create 2 to write to? It doesn't seem like it should be that hard. Just reading from one place and writing to two+. How do you open for writing a /dev like file/device/...what is it?
There is a command called 'tee' that you could use? It reads from stdin and outputs to a file and to stdout. The source is available if you wish to modify it?
 
Old 02-02-2010, 04:02 PM   #7
Eggg
LQ Newbie
 
Registered: Feb 2010
Posts: 1

Rep: Reputation: 0
Question Similar problem I think (first posting ever)

This looked like a current post on topic to my problem.
I have some simple shell scripts for moving text data from the serial port around if you want them (they may need some tweaking depending on what version of debian you run)?

Back ground
Ebox 2300
Linux Puppy 2.16 frugal
Wine-0.9.28

I have been using the ebox to log temperatures from the serial port with simple scripts.

I thought I'd step it up a notch.
I just tried to operate a K190 temperature sensor / relay control circuit software in wine.
Wine appears to function fine with everything I have given it so far & gives the appearance of working with the K190 software until I connect to the com.

The consistent error I get is
".wine/dosdevices/com1"


I have created the symbolic links a couple of times using (deleting using rox file manager in between creations, some times the link comes up with a hazard triangle !)

"cd /root/.wine/dosdevices
"ln -s /dev/ttyS0 com1"

I have tested the software and circuit on my old win98 pc and it is all fine.
I have tried all the versions of windows offered in wine

Any one able to help or point me in the correct direction.

Thanks
IEgg
 
  


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
FC6 does not create /dev/ttyS?? for ISA serial cards jatf Linux - Hardware 1 10-31-2007 02:01 PM
where is my serial device??? /dev/ttyS* is missing! mrchaos Linux - Hardware 2 03-11-2006 02:50 PM
How to find the correct /dev/ttyS*? SeanatIL Linux - Software 1 07-07-2004 06:33 PM
serial multiplexer frieza Linux - Hardware 0 09-27-2002 10:15 PM
cannot open /dev/ttyS ...resource or driver busy...error.. chiragw Linux - General 0 09-05-2001 03:03 AM


All times are GMT -5. The time now is 04:32 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration