diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-06-17 08:31:56 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-06-17 08:31:56 +0000 |
commit | 815cfe7d1e29e20b5be1699265a6a1fe9f83b085 (patch) | |
tree | d5dc26af73649344ae0fb24b7e6c5ca2ee5caa5d /sys | |
parent | 14be51b84ce8dcefdccc19be8eeb1e59afa22ced (diff) |
Four new sensors, from David Higgs.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/upd.c | 20 | ||||
-rw-r--r-- | sys/dev/usb/usbhid.h | 4 |
2 files changed, 19 insertions, 5 deletions
diff --git a/sys/dev/usb/upd.c b/sys/dev/usb/upd.c index 6b3b2668a8c..1b0e065c463 100644 --- a/sys/dev/usb/upd.c +++ b/sys/dev/usb/upd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: upd.c,v 1.21 2015/05/14 13:50:34 mpi Exp $ */ +/* $OpenBSD: upd.c,v 1.22 2015/06/17 08:31:55 mpi Exp $ */ /* * Copyright (c) 2015 David Higgs <higgsd@gmail.com> @@ -66,7 +66,13 @@ static struct upd_usage_entry upd_usage_batdep[] = { { HUP_BATTERY, HUB_DISCHARGING, SENSOR_INDICATOR, "Discharging" }, { HUP_BATTERY, HUB_ATRATE_TIMETOFULL, - SENSOR_TIMEDELTA, "AtRateTimeToFull" } + SENSOR_TIMEDELTA, "AtRateTimeToFull" }, + { HUP_BATTERY, HUB_ATRATE_TIMETOEMPTY, + SENSOR_TIMEDELTA, "AtRateTimeToEmpty" }, + { HUP_BATTERY, HUB_RUNTIMETO_EMPTY, + SENSOR_TIMEDELTA, "RunTimeToEmpty" }, + { HUP_BATTERY, HUB_NEED_REPLACEMENT, + SENSOR_INDICATOR, "NeedReplacement" }, }; static struct upd_usage_entry upd_usage_roots[] = { { HUP_BATTERY, HUB_BATTERY_PRESENT, @@ -75,7 +81,9 @@ static struct upd_usage_entry upd_usage_roots[] = { { HUP_POWER, HUP_SHUTDOWN_IMMINENT, SENSOR_INDICATOR, "ShutdownImminent" }, { HUP_BATTERY, HUB_AC_PRESENT, - SENSOR_INDICATOR, "ACPresent" } + SENSOR_INDICATOR, "ACPresent" }, + { HUP_POWER, HUP_OVERLOAD, + SENSOR_INDICATOR, "Overload" }, }; #define UPD_MAX_SENSORS (nitems(upd_usage_batdep) + nitems(upd_usage_roots)) @@ -410,6 +418,12 @@ upd_sensor_update(struct upd_softc *sc, struct upd_sensor *sensor, case HUB_FULLCHARGE_CAPACITY: adjust = 1000; /* scale adjust */ break; + case HUB_ATRATE_TIMETOFULL: + case HUB_ATRATE_TIMETOEMPTY: + case HUB_RUNTIMETO_EMPTY: + /* spec says minutes, not seconds */ + adjust = 1000000000LL; + break; default: adjust = 1; /* no scale adjust */ break; diff --git a/sys/dev/usb/usbhid.h b/sys/dev/usb/usbhid.h index 74ca55abe21..5f5422fad29 100644 --- a/sys/dev/usb/usbhid.h +++ b/sys/dev/usb/usbhid.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usbhid.h,v 1.17 2014/03/16 10:53:09 mpi Exp $ */ +/* $OpenBSD: usbhid.h,v 1.18 2015/06/17 08:31:55 mpi Exp $ */ /* $NetBSD: usbhid.h,v 1.11 2001/12/28 00:20:24 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbhid.h,v 1.7 1999/11/17 22:33:51 n_hibma Exp $ */ @@ -213,7 +213,7 @@ struct usb_hid_descriptor { #define HUB_CONDITIONING_FLAG 0x0048 #define HUB_ATRATE_OK 0x0049 #define HUB_SMB_ERROR_CODE 0x004a -#define HUB_SMB_NEED_REPLACE 0x004b +#define HUB_NEED_REPLACEMENT 0x004b #define HUB_ATRATE_TIMETOFULL 0x0060 #define HUB_ATRATE_TIMETOEMPTY 0x0061 #define HUB_AVERAGE_CURRENT 0x0062 |