#define UEVENT_ENUM_FIELDS(_) \
_(state, BATTERY, STATUS, "Discharging","Charging","Full","Unknown" ) \
- _(type, BOTH, TYPE, "Mains", "Battery" )
+ _(type, BOTH, TYPE, "Mains", "Battery", "USB" )
#define CHGST_DISCHARGING 0 /* Reflects order in _(state,...) above */
#define CHGST_CHARGING 1 /* Also, much code assumes exactly */
#define CHGST_ERROR 8 /* Except that this one is an extra bit. */
#define TYPE_MAINS 0 /* Reflects order in _(type,...) above */
-#define TYPE_BATTERY 1 /* Also, much code assumes exactly these two */
-#define TYPE_BOTH 100 /* Except this is a magic invalid value. */
+#define TYPE_BATTERY 1 /* We want exactly one of MAINS & BATTERY */
+#define TYPE_USB 2 /* These get ignored. */
+#define TYPE_BOTH 100 /* This is a magic invalid value. */
#define SEPARATE_QUANTITY_FIELDS(_) \
/* See commit ec6f5f0be800bc5f2a27046833dba04e0c67ffac for
r= readbattery();
tidybattery();
+ if (this_type >= TYPE_USB)
+ continue;
+
if (r) {
bad:
charging_mask |= (1u << CHGST_ERROR);