[LinuxPPS] ntp-dev-4.2.5p237-RC does sync with PPS for me
William S. Brasher
billb958 at door.net
Tue Oct 27 22:52:36 CET 2009
On Tue, 27 Oct 2009, Rodolfo Giometti wrote:
>
> Try this patch:
>
That patch did not work for me. The patch was munged by the time it
reached me, so what I applied, which may not be what was intended, is at
the bottom of this post.
With this patch ppstest prints one line each second:
source 0 - assert 1256675446.782665642, sequence: 447 - clear 1256675001.897923435, sequence: 2
source 0 - assert 1256675447.782590639, sequence: 448 - clear 1256675001.897923435, sequence: 2
source 0 - assert 1256675448.782516489, sequence: 449 - clear 1256675001.897923435, sequence: 2
source 0 - assert 1256675449.782441484, sequence: 450 - clear 1256675001.897923435, sequence: 2
Otherwise, ppstest prints two lines each second:
source 0 - assert 1256675616.000007948, sequence: 17523 - clear 1256675615.100006738, sequence: 17522
source 0 - assert 1256675616.000007948, sequence: 17523 - clear 1256675616.100006246, sequence: 17523
source 0 - assert 1256675617.000006620, sequence: 17524 - clear 1256675616.100006246, sequence: 17523
source 0 - assert 1256675617.000006620, sequence: 17524 - clear 1256675617.100006314, sequence: 17524
diff -Naur linux-2.6.31.5.org/drivers/pps/kapi.c linux-2.6.31.5/drivers/pps/kapi.c
--- linux-2.6.31.5.org/drivers/pps/kapi.c 2009-09-10 10:53:44.000000000 -0500
+++ linux-2.6.31.5/drivers/pps/kapi.c 2009-10-27 14:37:35.000000000 -0500
@@ -271,6 +271,7 @@
{
struct pps_device *pps;
unsigned long flags;
+ int captured = 0;
if ((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0) {
printk(KERN_ERR "pps: unknown event (%x) for source %d\n",
@@ -293,7 +294,8 @@
/* Check the event */
pps->current_mode = pps->params.mode;
- if (event & PPS_CAPTUREASSERT) {
+ if ((event & PPS_CAPTUREASSERT) &
+ (pps->params.mode & PPS_CAPTUREASSERT)) {
/* We have to add an offset? */
if (pps->params.mode & PPS_OFFSETASSERT)
pps_add_offset(ts, &pps->params.assert_off_tu);
@@ -303,8 +305,11 @@
pps->assert_sequence++;
pr_debug("capture assert seq #%u for source %d\n",
pps->assert_sequence, source);
+
+ captured = ~0;
}
- if (event & PPS_CAPTURECLEAR) {
+ if ((event & PPS_CAPTURECLEAR) &
+ (pps->params.mode & PPS_CAPTURECLEAR)) {
/* We have to add an offset? */
if (pps->params.mode & PPS_OFFSETCLEAR)
pps_add_offset(ts, &pps->params.clear_off_tu);
@@ -314,12 +319,16 @@
pps->clear_sequence++;
pr_debug("capture clear seq #%u for source %d\n",
pps->clear_sequence, source);
- }
- pps->go = ~0;
- wake_up_interruptible(&pps->queue);
+ captured = ~0;
+ }
- kill_fasync(&pps->async_queue, SIGIO, POLL_IN);
+ /* Wake up iif captured somthing */
+ if (captured) {
+ pps->go = ~0;
+ wake_up_interruptible(&pps->queue);
+ kill_fasync(&pps->async_queue, SIGIO, POLL_IN);
+ }
spin_unlock_irqrestore(&pps->lock, flags);
More information about the LinuxPPS
mailing list