DaemonForums  

Go Back   DaemonForums > Other Operating Systems > Other BSD and UNIX/UNIX-like

Other BSD and UNIX/UNIX-like Any other flavour of BSD or UNIX that does not have a section of its own.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 29th May 2008
motorollin motorollin is offline
New User
 
Join Date: May 2008
Posts: 5
Default Virtual serial port

Hi all

Hope someone can help. I need to create a virtual serial port for use with a serial port redirect. This is under Mac OS X, but I'm hoping OS X's BSD roots will mean there is already an established way of doing this.

TIA
Reply With Quote
  #2   (View Single Post)  
Old 29th May 2008
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

I don't quite understand your question, a serial port is simply a FIFO.

http://developer.apple.com/documenta...an4/pty.4.html
http://developer.apple.com/documenta.../mkfifo.1.html
http://developer.apple.com/documenta.../mkfifo.2.html

Hope that helps..

Last edited by BSDfan666; 29th May 2008 at 05:47 PM.
Reply With Quote
  #3   (View Single Post)  
Old 29th May 2008
motorollin motorollin is offline
New User
 
Join Date: May 2008
Posts: 5
Default

Let me explain a bit better. I have an application which talks to a serial port. I need to redirect its output to a device connected by Ethernet. Currently, I have two USB to Serial adapters connected to my Mac Mini: one as an "output" and one as an "input", with a serial cable running between them. I configure the software to talk to the "output" port, and I have configured Multicom to redirect the "input" port to the IP address of the Ethernet device.

This works, but is obviously messy hardware-wise. I would like to replace the two physical serial ports with a virtual one through software which I can redirect using Multicom.

I'll have a read of those links you posted - thanks. At first glance I'm not sure how they would be used to achieve what I'm trying to do, but I'll read them in more depth and let you know if I have any more questions!

Cheers
Reply With Quote
  #4   (View Single Post)  
Old 29th May 2008
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

Perhaps you should port an existing project to Mac? The required functionality is likely readily available.

This project, http://www.bsdua.org/netfwd.html seems to be exactly what you want..
Reply With Quote
  #5   (View Single Post)  
Old 30th May 2008
motorollin motorollin is offline
New User
 
Join Date: May 2008
Posts: 5
Default

Just compiled netfwd for OS X and it seems to do the same thing as Multicom. It doesn't seem to have any function for creating virtual COM ports itself. However, it does allow you to precisely specify which serial device to redirect, whereas Multicom only allows you to select ones which are exposed as hardware through drivers. So netfwd could still be quite useful.

I did some more digging in to pty, and if I understand correctly, data squirted in to /dev/ptyp0 should come out at /dev/ttyp0. Is that right?
Reply With Quote
  #6   (View Single Post)  
Old 30th May 2008
motorollin motorollin is offline
New User
 
Join Date: May 2008
Posts: 5
Default

I had an email from the author of netfwd to let me know that it doesn't support pty. He recommended I try socat, which worked perfectly!

# socat GOPEN:/dev/ptyp0,ignoreeof TCP:10.0.1.93:10002

Then point the application at /dev/ttyp0
Reply With Quote
  #7   (View Single Post)  
Old 30th May 2008
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

I'm glad you found a solution Sorry if I couldn't be of more assistance..
Reply With Quote
  #8   (View Single Post)  
Old 31st May 2008
motorollin motorollin is offline
New User
 
Join Date: May 2008
Posts: 5
Default

Well, you pointed me to netfwd which led me to socat which was the solution. And you also made me aware of ptys, which were part of the solution. So you solved it indirectly
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
probleme with serial port pitbac23 FreeBSD General 2 4th October 2008 01:42 AM
Serial connections JMJ_coder General software and network 9 25th July 2008 03:28 PM
Serial Consoles ddekok FreeBSD General 4 26th June 2008 07:16 PM
Usb serial adapter Business_woman FreeBSD General 10 4th June 2008 03:06 PM
Mounting a second serial hd keyboard112 Other BSD and UNIX/UNIX-like 4 12th May 2008 08:06 AM


All times are GMT. The time now is 06:43 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick