diff options
author | 2021-02-14 14:41:35 +0000 | |
---|---|---|
committer | 2021-02-14 14:41:35 +0000 | |
commit | fbe9bfe3e801cbd7a2f6ec47b134d6bd782a861b (patch) | |
tree | 184b172604b5d08720d605ca46c7019f14bfab02 | |
parent | Bail out earlier during attach if no devices are paired with the (diff) | |
download | wireguard-openbsd-fbe9bfe3e801cbd7a2f6ec47b134d6bd782a861b.tar.xz wireguard-openbsd-fbe9bfe3e801cbd7a2f6ec47b134d6bd782a861b.zip |
Postpone installation of the periodic sensor task until at least one
device has connected.
-rw-r--r-- | sys/dev/usb/uhidpp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/usb/uhidpp.c b/sys/dev/usb/uhidpp.c index 12bf3da7035..28522c54ef6 100644 --- a/sys/dev/usb/uhidpp.c +++ b/sys/dev/usb/uhidpp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhidpp.c,v 1.9 2021/02/14 14:40:38 anton Exp $ */ +/* $OpenBSD: uhidpp.c,v 1.10 2021/02/14 14:41:35 anton Exp $ */ /* * Copyright (c) 2021 Anton Lindqvist <anton@openbsd.org> @@ -398,7 +398,6 @@ uhidpp_attach(struct device *parent, struct device *self, void *aux) strlcpy(sc->sc_sensdev.xname, sc->sc_hdev.sc_dev.dv_xname, sizeof(sc->sc_sensdev.xname)); sensordev_install(&sc->sc_sensdev); - sc->sc_senstsk = sensor_task_register(sc, uhidpp_refresh, 6); out: mtx_leave(&sc->sc_mtx); @@ -622,6 +621,9 @@ uhidpp_device_connect(struct uhidpp_softc *sc, struct uhidpp_device *dev) sens->value = dev->d_battery.b_nlevels; sensor_attach(&sc->sc_sensdev, sens); + if (sc->sc_senstsk == NULL) + sc->sc_senstsk = sensor_task_register(sc, uhidpp_refresh, 6); + dev->d_connected = 1; uhidpp_device_refresh(sc, dev); } |