Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a usb gps receiver. The navigation program I use, uses the serial port directly.
Now I would like to use another program e.g. gpsd to use the same data that comes from the serial port, simultaneously with my navigation program. But only one program at a time can use the port.
So I am looking for a way to clone the serial port. Or any other way I can use two (or more) programs reading from the same serial port.
I can let gpsd use the gps serial port and use gpspipe to connect to gpsd and that way I can get the data I need (as standard output) , but I still need a way to make my navigation program use that data.
I won't necessarily have a hardware serial port (rs-232) on the machine.
-s option causes the collected data to be written to the specified
serial device with setttings 4800 8N1. Thus gpspipe can be used with -s
and -r options to emulate a serial port hardwired to a GPS that gpsd is
managing.
And you are using wine (which I know next to nothing about), but maybe try something like this
Code:
gpspipe -r -s ~/.wine/dosdevices/com1
Then see if your windows program can use com1 as a gps receiver
Last edited by tredegar; 07-30-2010 at 11:11 AM.
Reason: edited the ~/.wine path
and I linked /home/ravenous/.wine/dosdevices/com2 to /dev/ttyS0
but 'cat /dev/ttyS0' or 'gpscat /dev/ttyS0' gave nothing and my navigation software couldn't find it either.
On this machine, I do have one real serial port /dev/ttyS0. Using anything else gives the following error.
Code:
ravenous@square:~/gpsd-2.92$ ./gpspipe -r -s /dev/ttyS1
gpspipe: error reading serial port settings
I suppose this is because ttyS0 is a real port. I probably would be able to read from it, if I connected it to another computer and read that other computer's serial port.
That is why I need to emulate a serial port, I think. Or if there is a way to loopback ttyS0, so that you can read everything you write to it, but I haven't found anything in the setserial manual.
and I linked /home/ravenous/.wine/dosdevices/com2 to /dev/ttyS0
I don't think that is going to help, just telling gpspipe to send the data to /home/ravenous/.wine/dosdevices/com2should be enough. Better to remove that link before you find it complicating things.
Quote:
gpspipe: error reading serial port settings
I see you are running gpspipe as yourself. That's OK, but what are the permissions on /dev/ttyS1 (where you have a node, but no real device) and what groups are you in?
Code:
ls -l /dev/ttyS1
groups
It would also be useful to know what distro you are running
On another track:
Maybe, as you are using wine, life would be easier if you were not running gpsd at all.
What happens if you kill gpsd and then symlink /dev/ttyUSB0 (where the GPS device is) to /home/ravenous/.wine/dosdevices/com2
Wine / windows program should say "com2 is a COM port, with a GPS receiver spitting out NMEA data, I'll use it".
I don't think that is going to help, just telling gpspipe to send the data to /home/ravenous/.wine/dosdevices/com2should be enough. Better to remove that link before you find it complicating things.
~/.wine/dosdevices/com2 is just a symlink to /dev/ttyS0 or /dev/ttyUSB0
It is the way wine accesses serial devices. If I should remove the link, what kind of file should ~/.wine/dosdevices/com2 be? It is not automatically created by wine.
This is how my navigation software can use /dev/ttyUSB0, which is my gps receiver and this way the navigation software can use the gps receiver just fine.
But the problem is that I want to use my navigation software on one hand, and use gpsd on the other, running side by side; both using the same gps receiver.
Quote:
I see you are running gpspipe as yourself. That's OK, but what are the permissions on /dev/ttyS1 (where you have a node, but no real device) and what groups are you in?
It would also be useful to know what distro you are running
/dev/ttyS1 is rw for dialout group, which ravenous belongs to.
I tried running gpspipe as root and using sudo, but I get the same message.
I am using Kubuntu 10.04
I have read several things about socat and remserial. I just came up with an idea. Creating a stream with socat between my gps receiver and a network port. Then creating two other streams that connect between that network port and two PTY's, which according to the manual, can be accessed as a serial line. But I don't know socat, so maybe someone has some suggestions about this?
and create a link to /home/ravenous/pty in ~/.wine/dosdevices
Now I can use gpsd and my navigation software simultaneously.
All in all, an easy solution.
I was about to refer you to this page where they seem to have solved it with a php script and a fifo pipe, when you posted the above.
The script I linked probably won't work with the latest version of gpsd anyway.
But your fix is more elegant, easier and probably the "right" way to do it. man socat was giving me a headache!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.