13

I'm trying to create a pair of virtual serial ports on my mac. This is fairly easy to do with many shareware programs on a PC. I figured there would be some uber-powerful shell command to do this in one line, but I can't find it.

I want to send NMEA data into one port, and have Google earth read the data out of the other.

Any tips?

EDIT

MrDaniel's /dev/ptypx comment seemed to be interesting - I can pull it out of /dev/ttypx just fine in terminal.
But Google earth seems to be reading cu.deviceName instead of the /ttypx deveices..

specifically (Old Pro):

When trying to import the current location using a GPS (or NMEA stream piped through our virtual serial port), we go: Tools > GPS > Realtime to get to the import screen.
After selecting the NMEA option, and enabling realtime tracking, it looks for connected devices, and seems to look at:

  • usb:
  • /dev/cu.Bluetooth-PDA-Sync
  • /dev/cu.Bluetooth-Modem
  • /dev/cu.iPhone-WirelessAP

Even with our ttypx serial port operating ok, it doesn't look for it.
I would like to get the data from that device into Google Earth.

5
  • 1
    +1, as I also would like to do this for device development. Might also be ServerFault, SuperUser or StackOverflow.
    – bot47
    Apr 3, 2012 at 6:02
  • Have you considered using Google Latitude instead? If that is not acceptable, then please provide more details about what Google Earth is doing.
    – Old Pro
    Jun 4, 2012 at 9:32
  • Have you been successful in controlling Google Earth through a fake position provided through a NMEA port? I'd be interested in how this works.
    – Max N
    May 14, 2016 at 1:43
  • 1
    @MaxN - Nope. I gave up :( May 14, 2016 at 9:39
  • This is close (AppleScript): laclefyoshi.blogspot.com/2011/01/…
    – Max N
    May 14, 2016 at 11:44

6 Answers 6

11
+25

Google has an extremely useful tool for Arduino developers and it simulates serial ports very well on OS X for testing purposes. It only works until 10.6

https://github.com/clokey/PublicCode/tree/master/MacOSXVirtualSerialPort

(previously available from http://code.google.com/p/macosxvirtualserialport/ )

Might this help you?

4
  • 2
    Forgive my undeleting this and editing it - I'd rather you got the credit for bringing google's awesome virtual serial port software to light. You may of course delete it again and I'll leave it alone if that is your preference.
    – bmike
    Jun 4, 2012 at 23:08
  • 3
    That code.google.com site for macosxvirtualserialport now returns a 404 error.
    – hotpaw2
    Aug 7, 2015 at 2:25
  • 2
    The Google project seems to be availabe on Github now: github.com/clokey/PublicCode/tree/master/… it only works until 10.7 though
    – Max N
    May 10, 2016 at 12:58
  • OS X El Capitan 10.11 and later have System Integrity Protection that prevents creating these /dev/ files.
    – Dave X
    Apr 7, 2022 at 18:41
5

I think what you are looking for is a Pseudo Terminal, as noted in Text-Terminal-HOWTO. It looks like Mac OS X has built in in /dev and it seems like this can do what you want to do, e.g. two programs talking together via a "virtual" serial port.

Pseudo terminals are pairs of devices such as /dev/ptyp3 and /dev/ttyp3. There is no physical device directly associated with either of them, not even a serial port connector. But if a program treats ttyp3 like it was a serial port, what is read and written to that port appears on the other member of the pair ptyp3 which another program uses to read and write to. Thus two programs talk to each other via this method and one program on ttyp3 thinks it's talking to a serial port. It's something like a "pipe" between these two tty's.

Additionally, the screen program may be useful to you as well.

0
1

There are several angles to your question here:

  • Do you just want to convert NMEA tracks etc. into something Google Earth can read (and display)? GPSBabel is the tool of choice for these kind of things.
  • Do you want to attach your GPS and read its content via a serial port? Macs don't have serial ports, you will need something like Keyspan USA-19HS to connect serial devices via USB.
  • Do you want to create virtual serial devices out of curiosity? That's definitively possible but beyond my knowledge...
4
  • 1
    Option 3. I have the NMEA data (in realtime), and want to display it in realtime. Google Earth reads from a serial port, so I just need to figure out how to set up the ports, and pipe it into one of them. Nov 2, 2011 at 3:40
  • Where is the NMEA data coming from? GPSBabel is able to act as a real-time converter, see gpsbabel.org/htmldoc-1.4.2/tracking.html
    – nohillside
    Nov 2, 2011 at 18:03
  • It's streamed from an iPhone. I don't need conversion into anything (particularly kml), I just need a virtual serial port to throw the nmea data into, and suck it out the other end by Google Earth. Nov 2, 2011 at 23:42
  • Every time I get to use my Keyspan I just grin ear to ear. Especially on my new 11 inch Air - so much new and old working together ;-)
    – bmike
    Jun 4, 2012 at 23:06
0

It's not clear you can fake out the built in serial port detection but I would start with a named pipe (mkfifo) in /dev/cu.fake.ttypx and have some data ready to be read when you enable the realtime.

My copy of Google Earth appears to poll each potential source in order and continues to do nothing but scan since I have no NMEA data being provided.

You'll of course need a small [shell|perl|python] script to read from /dev/ttypx and write to your "fake" fifo file.

-1

I've used a Posix pseudoterminal to create a virtual comm port into an OSX C program. You might search for the posix_openpt() library function.

-2

There is a windows tool called GooPs http://goopstechnologies.com/?page_id=12 which handles some similar tasks.

You can also make a placemark that reads coordinates from a file and refreshes every second.

https://stackoverflow.com/questions/7249565/how-to-properly-update-google-earth-kml-using-networklinkcontrol-and-the-java-ap

1
  • How does this solve the problem described in the question?
    – nohillside
    May 16, 2016 at 7:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .