# Share incoming data from serial port?



## PeteS (Dec 21, 2010)

Hi,

I want to sample what's coming from the serial port /dev/cuau0 in a script or program.

The problem is that the serial port is used by ntpd and if I do `# cat /dev/cuau0` I can see what's coming from the serial port but I also interrupt the communication between the serial port and ntpd.

Is there a way to share the communication from the serial port to two applications at the same time?

Thanks in advance for any help.

Cheers,
Pete


----------



## gordon@ (Dec 22, 2010)

Not that I'm aware. Serial port devices can only be opened by a single process at a time.


----------



## wblock@ (Dec 22, 2010)

ISTR that gpsd (either astro/gpsd or... damn, there's another gpsd that's part of another GPS port, can't recall) does something like that for GPS devices.  But the applications are written to work with it.

That gets trickier with ntpd.  Anything between it and a time source could cause accuracy problems.


----------



## PeteS (Dec 29, 2010)

Thanks guys. I will work around it by periodically opening the serial port, steal a few bytes with `# dd` and then close it.


----------



## PeteS (Dec 29, 2010)

PeteS said:
			
		

> Thanks guys. I will work around it by periodically opening the serial port, steal a few bytes with `# dd` and then close it.



For example:
`# dd if=/dev/gps0 count=3`


----------

