-/* $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>
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);
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);
}