-/* $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>
{ 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,
{ 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))
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;
-/* $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 $ */
#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