summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@cvs.openbsd.org>2022-11-26 06:28:09 +0000
committerAnton Lindqvist <anton@cvs.openbsd.org>2022-11-26 06:28:09 +0000
commit5bd470eca85f95f74bb7b99d0b2d6cbf888bd07c (patch)
treed7e17cbf2762c725a77356909ffb55bf8acf6567 /sys/dev/usb
parent1f23d6fc12770b4b0e351baa6b5b637bcd0f2655 (diff)
Take note of the needed feature indices already in
uhipp_device_features().
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/uhidpp.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/sys/dev/usb/uhidpp.c b/sys/dev/usb/uhidpp.c
index 0968760e2f7..2719bb210c7 100644
--- a/sys/dev/usb/uhidpp.c
+++ b/sys/dev/usb/uhidpp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhidpp.c,v 1.30 2022/11/26 06:27:48 anton Exp $ */
+/* $OpenBSD: uhidpp.c,v 1.31 2022/11/26 06:28:08 anton Exp $ */
/*
* Copyright (c) 2021 Anton Lindqvist <anton@openbsd.org>
@@ -550,7 +550,6 @@ uhidpp_device_connect(struct uhidpp_softc *sc, struct uhidpp_device *dev)
{
struct ksensor *sens;
int error;
- uint8_t feature_type;
MUTEX_ASSERT_LOCKED(&sc->sc_mtx);
@@ -586,16 +585,6 @@ uhidpp_device_connect(struct uhidpp_softc *sc, struct uhidpp_device *dev)
return;
}
- error = hidpp20_root_get_feature(sc, dev->d_id,
- HIDPP20_FEAT_BATTERY_ID,
- &dev->d_battery.feature_idx, &feature_type);
- if (error) {
- DPRINTF("%s: battery feature index failure: "
- "device_id=%d, error=%d\n",
- __func__, dev->d_id, error);
- return;
- }
-
error = hidpp20_battery_get_capability(sc,
dev->d_id, dev->d_battery.feature_idx,
&dev->d_battery.nlevels, &dev->d_battery.rechargeable);
@@ -746,8 +735,10 @@ uhidpp_device_features(struct uhidpp_softc *sc, struct uhidpp_device *dev)
if (error)
continue;
- if (id == HIDPP20_FEAT_BATTERY_ID)
+ if (id == HIDPP20_FEAT_BATTERY_ID) {
dev->d_features |= UHIDPP_DEVICE_FEATURE_BATTERY;
+ dev->d_battery.feature_idx = i;
+ }
DPRINTF("%s: idx=%d, id=%x, type=%x device_id=%d\n",
__func__, i, id, type, dev->d_id);