diff --git a/sys/dev/sysmon/sysmon_envsys.c b/sys/dev/sysmon/sysmon_envsys.c index 7d0c3009032b..467205842d37 100644 --- a/sys/dev/sysmon/sysmon_envsys.c +++ b/sys/dev/sysmon/sysmon_envsys.c @@ -1,4 +1,4 @@ -/* $NetBSD: sysmon_envsys.c,v 1.98 2010/03/24 12:15:54 pgoyette Exp $ */ +/* $NetBSD: sysmon_envsys.c,v 1.99 2010/03/26 12:36:59 pgoyette Exp $ */ /*- * Copyright (c) 2007, 2008 Juan Romero Pardines. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.98 2010/03/24 12:15:54 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.99 2010/03/26 12:36:59 pgoyette Exp $"); #include #include @@ -1141,6 +1141,7 @@ sme_add_property_dictionary(struct sysmon_envsys *sme, prop_array_t array, prop_dictionary_t dict) { prop_dictionary_t pdict; + const char *class; int error = 0; pdict = prop_dictionary_create(); @@ -1148,8 +1149,8 @@ sme_add_property_dictionary(struct sysmon_envsys *sme, prop_array_t array, return EINVAL; /* - * Add the 'refresh-timeout' object into the 'device-properties' - * dictionary. We use by default 30 seconds. + * Add the 'refresh-timeout' and 'dev-class' objects into the + * 'device-properties' dictionary. * * ... * @@ -1157,7 +1158,9 @@ sme_add_property_dictionary(struct sysmon_envsys *sme, prop_array_t array, * * refresh-timeout * 120device-class + * class_name + * * * ... * @@ -1170,6 +1173,16 @@ sme_add_property_dictionary(struct sysmon_envsys *sme, prop_array_t array, error = EINVAL; goto out; } + if (sme->sme_class == SME_CLASS_BATTERY) + class = "battery"; + else if (sme->sme_class == SME_CLASS_ACADAPTER) + class = "ac-adapter"; + else + class = "other"; + if (!prop_dictionary_set_cstring_nocopy(pdict, "device-class", class)) { + error = EINVAL; + goto out; + } if (!prop_dictionary_set(dict, "device-properties", pdict)) { error = EINVAL;