From 48124f6825d8d97ca039225be57008bb53ad42c7 Mon Sep 17 00:00:00 2001 From: anton Date: Sat, 5 Feb 2022 07:31:40 +0000 Subject: [PATCH] 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@ --- sys/dev/usb/uhidpp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); -- 2.20.1