Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Aug 2021 20:14:49 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Bertrand Petit <freebsd-hackers@phoe.frmug.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Is snp(4) in working order?
Message-ID:  <YR6RiRVXSTkFtIr%2B@kib.kiev.ua>
In-Reply-To: <20210819141224.GA93701@memo2.memo.frmug.org>
References:  <20210819141224.GA93701@memo2.memo.frmug.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Aug 19, 2021 at 04:12:24PM +0200, Bertrand Petit wrote:
> 
> 	I'm wondering if, on a 12.2 host, the snp(4) device is out of order or
> if I'm improperly using it.
> 
> 	Here is the situation: a GPS receiver connected to the host through
> USB (umodem driver) feeding ntpd and keeping it happy. On this setup I perform
> the following calls as root in a dedicated process:
> 
>   int a=open("/dev/cuaU0", O_RDONLY|O_NONBLOCK);
>   isatty(a); /* Yes it is */
>   int b=open("/dev/snp", O_RDONLY);
>   ioctl(b, SNPSTTY, &a);
>   int pending; ioctl(b, FIONREAD, &pending); /* Empty */
>   char buf; read(b, 1, &buf);
> 
> I ommited error handling for brevity, all calls are successfull except read()
> which never return.
> 
> 	I expected to be able to read the same bytes stream as ntpd does but I
> get nothing. Am I misusing the snp(4) interface or is it non-functioning?
> 
> 	[As a side note: I could also had used gpsd but hooking ntpd directly
> to the serial device yields a far better jitter.]
Did you tried watch(8) first?

I just used watch successfully over /dev/pts/N pseudoterminal.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YR6RiRVXSTkFtIr%2B>