From d1175cff0dbe4f4a17586e09dd34a87d58e707e2 Mon Sep 17 00:00:00 2001 From: mpi Date: Thu, 14 May 2015 13:50:34 +0000 Subject: [PATCH] Make the "Battery Present" sensor a depency of all the battery-related sensors only if it is present, From David Higgs. Fix a regression reported by and ok halex@ --- sys/dev/usb/upd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/upd.c b/sys/dev/usb/upd.c index 4150a4791b9..6b3b2668a8c 100644 --- a/sys/dev/usb/upd.c +++ b/sys/dev/usb/upd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: upd.c,v 1.20 2015/05/11 08:51:31 mpi Exp $ */ +/* $OpenBSD: upd.c,v 1.21 2015/05/14 13:50:34 mpi Exp $ */ /* * Copyright (c) 2015 David Higgs @@ -225,8 +225,12 @@ upd_attach_sensor_tree(struct upd_softc *sc, void *desc, int size, for (i = 0; i < nentries; i++) { entry = entries + i; - if (!upd_lookup_usage_entry(desc, size, entry, &item)) + if (!upd_lookup_usage_entry(desc, size, entry, &item)) { + /* dependency missing, add children to parent */ + upd_attach_sensor_tree(sc, desc, size, + entry->nchildren, entry->children, queue); continue; + } DPRINTF(("%s: found %s on repid=%d\n", DEVNAME(sc), entry->usage_name, item.report_ID)); -- 2.20.1