From: anton Date: Sat, 5 Feb 2022 07:31:40 +0000 (+0000) Subject: Only install the sensors once as multiple devices can be paired with the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=48124f6825d8d97ca039225be57008bb53ad42c7;p=openbsd 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 on bugs@ --- 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 @@ -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);