diff options
author | Anton Lindqvist <anton@cvs.openbsd.org> | 2022-02-05 07:31:41 +0000 |
---|---|---|
committer | Anton Lindqvist <anton@cvs.openbsd.org> | 2022-02-05 07:31:41 +0000 |
commit | 77d9aba6737bc75aa4aaa223480925b1c228f608 (patch) | |
tree | e8c31882381b37613a8b05f7d62d3a6c5e9af73c /sys/dev/usb/uhidpp.c | |
parent | 7253dbf3fad58e0a7ba81ff6da9822d2d1a3ae7f (diff) |
Only install the sensors once as multiple devices can be paired with the
same receiver. Prevents a newly added assertion from triggering.
Problem reported by Joel Carnat <joel at carnat dot net> on bugs@
Diffstat (limited to 'sys/dev/usb/uhidpp.c')
-rw-r--r-- | sys/dev/usb/uhidpp.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/usb/uhidpp.c b/sys/dev/usb/uhidpp.c index a0c470d906c..174b59361b6 100644 --- a/sys/dev/usb/uhidpp.c +++ b/sys/dev/usb/uhidpp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhidpp.c,v 1.25 2022/01/26 06:05:59 anton Exp $ */ +/* $OpenBSD: uhidpp.c,v 1.26 2022/02/05 07:31:40 anton Exp $ */ /* * Copyright (c) 2021 Anton Lindqvist <anton@openbsd.org> @@ -637,6 +637,13 @@ uhidpp_device_connect(struct uhidpp_softc *sc, struct uhidpp_device *dev) uhidpp_device_refresh(sc, dev); + /* + * There could be many devices connected to the same receiver, therefore + * only install the sensors once. + */ + if (uhidpp_has_sensors(sc)) + return; + strlcpy(sc->sc_sensdev.xname, sc->sc_hdev.sc_dev.dv_xname, sizeof(sc->sc_sensdev.xname)); sensordev_install(&sc->sc_sensdev); |