diff options
author | 2006-06-04 09:52:40 +0000 | |
---|---|---|
committer | 2006-06-04 09:52:40 +0000 | |
commit | 352f4d647dfa0fb6563339e41ab8acd9fb1f5691 (patch) | |
tree | e733e9b541f7fd7291cf2059613ea796fa1c56bd /sys | |
parent | - we can just use the 'sizdiff' variable instead of calling strlen(expbuf); (diff) | |
download | wireguard-openbsd-352f4d647dfa0fb6563339e41ab8acd9fb1f5691.tar.xz wireguard-openbsd-352f4d647dfa0fb6563339e41ab8acd9fb1f5691.zip |
- 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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/udcf.c | 15 | ||||
-rw-r--r-- | sys/kern/tty_nmea.c | 14 |
2 files changed, 14 insertions, 15 deletions
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': |