From: mpi Date: Thu, 14 May 2015 13:50:34 +0000 (+0000) Subject: Make the "Battery Present" sensor a depency of all the battery-related X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d1175cff0dbe4f4a17586e09dd34a87d58e707e2;p=openbsd 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@ --- 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));