From: mpi Date: Wed, 17 Jun 2015 08:31:55 +0000 (+0000) Subject: Four new sensors, from David Higgs. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d55e24b251d131a37438387c4804714b001d2770;p=openbsd Four new sensors, from David Higgs. --- 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 @@ -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