From 790a2f001026d225e4d901d8a10dda457f7f8a32 Mon Sep 17 00:00:00 2001 From: henning <> Date: Sun, 28 May 2006 02:06:46 +0000 Subject: [PATCH] make use of the new hotplug events for sensors showing up or vanishing --- src/usr.sbin/ntpd/sensors.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/usr.sbin/ntpd/sensors.c b/src/usr.sbin/ntpd/sensors.c index 98c52c39..7e7baf18 100644 --- a/src/usr.sbin/ntpd/sensors.c +++ b/src/usr.sbin/ntpd/sensors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensors.c,v 1.6 2006/05/27 22:23:49 henning Exp $ */ +/* $OpenBSD: sensors.c,v 1.7 2006/05/28 02:06:46 henning Exp $ */ /* * Copyright (c) 2006 Henning Brauer @@ -207,6 +207,19 @@ sensor_hotplugevent(int fd) if (n == sizeof(he)) switch (he.he_type) { + case HOTPLUG_DEVAT: + if (he.he_devclass == DV_SENSOR) + sensor_probe(he.he_devid); + break; + case HOTPLUG_DEVDT: + if (he.he_devclass == DV_SENSOR) { + struct ntp_sensor *s; + + s = sensor_byid(he.he_devid); + if (s != NULL) + sensor_remove(s); + } + break; default: /* ignore */ break; }