The ultimate goal of the serial port that i want to create is to use it for communication and PPP. Maybe through an application like Hyperterm or remote console.
If I follow this approach, will i be able to use IOKit timers and workloops or, do i have to use Mach APIs which makes it dependent on the Mach kernel.
Thanks in advance.
\Pavan.
----- Original Message ----
From: Dean Reece <email@hidden>
To: Pavan Chebbi <email@hidden>
Cc: email@hidden
Sent: Monday, February 27, 2006 11:33:20 PM
Subject: Re: How to create virtual COM port
On Feb 26, 2006, at 20:46, Pavan
Chebbi wrote:
I wanted to know how do we create and register a virtual COM port. (MAC OS X).
I assume you mean a virtual serial port (like COM1 on a PC). On Mac OS X (and Unix in general), these are implemented as /dev/tty (teletype) device nodes.
Is it possible at the user level or do we have to code in the kernel. Kindly provide some inputs on this.
No; to present a TTY port on Mac OS X, you have to have to write a KEXT that causes the /dev nodes to come into existence.
The easiest way to do this is to write an IOKit driver that makes use of the IOSerialFamily to publish one or more virtual serial interfaces. You do this by subclassing an appropriate class
(probably IOSerialStreamSync) and publishing it - the serial family takes care of publishing the /dev/tty nodes and managing all the Posix semantics of those nodes. If you do this right, the network control panel should properly display your serial port as an for PPP connections.
Another way to do this is to write a non-IOKit KEXT that directly publishes the /dev/tty nodes. This may be easier if you already have some Unix code you are porting to Darwin, but you'll have to manage all the Posix semantics yourself, and the network control panel won't find your serial port to present to the user (don't know if you care about that).
Is there any open source that I can refer to which does the same job.
The Apple16X50Serial driver project from
Darwin is a good example of the IOKit KEXT approach, though it is designed to support physical hardware. I'm not aware of an example of a virtual serial driver on Mac OS X.
I request you to help.
Warm Regards,
Pavan.
Cheers,
- Dean