diff options
author | Marc Balmer <mbalmer@cvs.openbsd.org> | 2006-06-04 09:52:41 +0000 |
---|---|---|
committer | Marc Balmer <mbalmer@cvs.openbsd.org> | 2006-06-04 09:52:41 +0000 |
commit | 66ef516e5404c5db094b9fa2607166e65bd43556 (patch) | |
tree | 5b4375dce03898971f46b93fe626d01542a7bfc1 | |
parent | 2207e6f02f1e44b1fb340dc5f884b6706e793a86 (diff) |
- ntpd no longer needs the NTP identifier as part of a timedelta sensor
description.
- create the timedelta sensors as early as possible, but mark them invalid
as long as there is no real data.
- update docs accordingly
-rw-r--r-- | share/man/man4/udcf.4 | 10 | ||||
-rw-r--r-- | sys/dev/usb/udcf.c | 15 | ||||
-rw-r--r-- | sys/kern/tty_nmea.c | 14 |
3 files changed, 18 insertions, 21 deletions
diff --git a/share/man/man4/udcf.4 b/share/man/man4/udcf.4 index da9fc4e1b6a..36d741c2a5f 100644 --- a/share/man/man4/udcf.4 +++ b/share/man/man4/udcf.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: udcf.4,v 1.9 2006/05/28 18:52:16 mbalmer Exp $ +.\" $OpenBSD: udcf.4,v 1.10 2006/06/04 09:52:40 mbalmer Exp $ .\" .\" Copyright (c) 2006 Marc Balmer <mbalmer@openbsd.org> .\" @@ -36,15 +36,13 @@ interface. The driver automatically detects if it is receiving the German DCF77 timecode or the Swiss HBG timecode and indicates the clock type in the sensor description. -The first four bytes of the description are the NTP identifier followed -by a space and the station name (which might be the same). This value will not be changed once set, even when the receiver module is changed at runtime. -.Bl -tag -width "DCF DCFXX" -.It DCF DCF77 +.Bl -tag -width "DCFXX" +.It DCF77 German DCF77 time signal station (77.5 kHz longwave transmitter located in Mainflingen near Frankfurt) -.It HBG HBG +.It HBG Swiss HBG time signal station (75 kHz longwave transmitter located in Prangins near Geneva) .El diff --git a/sys/dev/usb/udcf.c b/sys/dev/usb/udcf.c index 9af2454d6a5..0105b07df58 100644 --- a/sys/dev/usb/udcf.c +++ b/sys/dev/usb/udcf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udcf.c,v 1.9 2006/05/28 18:52:16 mbalmer Exp $ */ +/* $OpenBSD: udcf.c,v 1.10 2006/06/04 09:52:40 mbalmer Exp $ */ /* * Copyright (c) 2006 Marc Balmer <mbalmer@openbsd.org> @@ -56,8 +56,8 @@ int udcfdebug = 0; #define CLOCK_HBG 1 static const char *clockname[2] = { - "DCF DCF77", - "HBG HBG" }; + "DCF77", + "HBG" }; struct udcf_softc { USBBASEDEVICE sc_dev; /* base device */ @@ -179,6 +179,8 @@ USB_ATTACH(udcf) sizeof(sc->sc_sensor.device)); sc->sc_sensor.type = SENSOR_TIMEDELTA; sc->sc_sensor.status = SENSOR_S_UNKNOWN; + sc->sc_sensor.flags = SENSOR_FINVALID; + sensor_add(&sc->sc_sensor); /* Prepare the USB request to probe the value */ @@ -290,8 +292,7 @@ USB_DETACH(udcf) /* Unregister the clock with the kernel */ - if (sc->sc_sensor.status != SENSOR_S_UNKNOWN) - sensor_del(&sc->sc_sensor); + sensor_del(&sc->sc_sensor); usb_rem_task(sc->sc_udev, &sc->sc_task); usb_rem_task(sc->sc_udev, &sc->sc_bv_task); @@ -409,9 +410,7 @@ udcf_probe(void *xsc) clockname[CLOCK_HBG] : clockname[CLOCK_DCF77], sizeof(sc->sc_sensor.desc)); - DPRINTF(("add timedelta sensor for %s\n", - sc->sc_sensor.desc)); - sensor_add(&sc->sc_sensor); + sc->sc_sensor.flags &= ~SENSOR_FINVALID; } sc->sc_sensor.status = SENSOR_S_OK; diff --git a/sys/kern/tty_nmea.c b/sys/kern/tty_nmea.c index 5a1fa9b547a..247abd00354 100644 --- a/sys/kern/tty_nmea.c +++ b/sys/kern/tty_nmea.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_nmea.c,v 1.3 2006/06/01 23:17:08 ckuethe Exp $ */ +/* $OpenBSD: tty_nmea.c,v 1.4 2006/06/04 09:52:40 mbalmer Exp $ */ /* * Copyright (c) 2006 Marc Balmer <mbalmer@openbsd.org> @@ -115,7 +115,8 @@ nmeaopen(dev_t dev, struct tty *tp) np->time.type = SENSOR_TIMEDELTA; np->time.value = 0LL; np->time.rfact = 0; - np->time.flags = 0; + np->time.flags = SENSOR_FINVALID; + sensor_add(&np->time); np->state = S_SYNC; np->last = 0L; } @@ -129,8 +130,7 @@ nmeaclose(struct tty *tp, int flags) struct nmea *np = (struct nmea *)tp->t_sc; tp->t_line = 0; /* switch back to termios */ - if (np->time.status != SENSOR_S_UNKNOWN) - sensor_del(&np->time); + sensor_del(&np->time); free(np, M_DEVBUF); nmea_count--; return linesw[0].l_close(tp, flags); @@ -368,8 +368,8 @@ nmea_rmc(struct nmea *np) np->time.tv.tv_sec = np->tv.tv_sec; np->time.tv.tv_usec = np->tv.tv_usec; if (np->time.status == SENSOR_S_UNKNOWN) { - strlcpy(np->time.desc, np->ti == TI_GPS ? "GPS GPS" : - "LORC Loran-C", sizeof(np->time.desc)); + strlcpy(np->time.desc, np->ti == TI_GPS ? "GPS" : + "Loran-C", sizeof(np->time.desc)); if (np->fldcnt == 12) { switch (np->cbuf[np->fpos[11]]) { case 'S': @@ -395,7 +395,7 @@ nmea_rmc(struct nmea *np) } } np->time.status = SENSOR_S_OK; - sensor_add(&np->time); + np->time.flags &= ~SENSOR_FINVALID; } switch (np->cbuf[np->fpos[1]]) { case 'A': |