Commit Graph

110 Commits

Author SHA1 Message Date
martin
3c7c27640e Remove unused variable 2013-09-15 14:40:56 +00:00
mbalmer
674743a5f1 Fix spelling, grammar, typos. 2013-01-23 18:04:33 +00:00
pgoyette
cc70ada49c Constify 2012-12-14 15:33:19 +00:00
pgoyette
76c350d10d Replace a couple of many-line #define with equivalent code loops.
No functional change intended, and atf tests (using swsensor(4)) still
pass 100%
2012-12-11 15:39:06 +00:00
macallan
9414e51eaf in sme_battery_check():
- don't assume that all batteries have exactly one ENVSYS_INDICATOR
- check capacity and charge sensors for ENVSYS_SVALID before using them
now this works on macppc
2012-10-31 05:42:47 +00:00
pgoyette
5b61c9d192 Remove (commented-out) definitions for debugging - thanks to macallan@
for defflagging these.
2012-09-06 12:21:40 +00:00
pgoyette
9687fb7cf2 1. Enable use of FMONSTCHANGED events for INDICATOR sensors
2. Update handling of FMONCRITICAL event reporting.   The state
   transition does not require a corresponding change in value.

With these changes, you can now have an INDICATOR sensor that
reports the presence or absence of a device, and (if the device
is present) separately monitor it for proper functioning.

Should address the concerns expressed recently with the commit
of changes to wmi(4) BBU handling.
2012-08-27 21:42:04 +00:00
pgoyette
55a8dfa0ed If previously there was only a dummy event entry (to force refresh for
entropy gathering), allow it to be updated for the current request to
add a real entry.
2012-07-19 13:30:01 +00:00
pgoyette
8aacc86c66 Release the mutex before taking a quick exit. 2012-07-18 20:50:40 +00:00
pgoyette
063727a480 Extend previous changes so that even sensors which don't use a refresh()
callback to update the value can be polled to provide rnd(4) entropy.
2012-07-16 13:55:01 +00:00
pgoyette
87d1d2214b If a sensor is flagged as capable of providing rnd(4) with entropy,
hook the sensor into rnd subsystem, and make sure we periodically
refresh the sensor whether or not it is being actively monitored.
2012-07-15 18:33:07 +00:00
pgoyette
0bc91edaa9 When unregistering a sensor device, make sure we unregister and delete
all the associated events.
2012-07-15 17:41:39 +00:00
pgoyette
67461ad93e Restrict limit monitoring for Indicator sensors as well as for
Battery-charge sensors.
2011-06-08 16:14:57 +00:00
pgoyette
59fe847ec9 When the user updates the sensor device's refresh timer, reset the
callout immediately rather than waiting for the previous timer to
expire.
2010-12-30 03:59:59 +00:00
pgoyette
e76f489b1b Extract searching of description tables into a single function, rather
than duplicating the code every time.  Minor reduction in code size
(about 1200 bytes on amd64), no change in functionality.
2010-12-15 17:17:16 +00:00
pgoyette
9179849b5d When removing properties (as in envstat -S), clear the flags that track
whether the properties actually exist.

When setting new limit values, don't complain/ignore about duplicate
values if the associated flag bits (indicating that the limit is valid)
are not set.

These two fixes together should fix a problem reported in private Email
by njoly@ a couple months ago.  Issue replicated and solution tested
using my recent swsensor pseudo-device running inside qemu world!
2010-12-08 00:09:14 +00:00
pgoyette
0139c9e7c5 Make this compile when "options ENVSYS_OBJECTS_DEBUG" is defined. 2010-12-06 23:26:44 +00:00
pgoyette
c5da67f0a2 1. Don't try to call the driver's get_limits routine if it doesn't have
one.  Fixes a panic reported by njoly@ in private Email

2. Acquire the device before checking whether or not the get_limits
   routine exists.

XXX There's still a bug in here somewhere that prevents setting of
XXX limit values after using 'envstat -S'
2010-09-22 00:13:55 +00:00
pgoyette
d8f35b6e65 When removing sensor properties with envstat -S, ensure that drivers
which could have modified hardware state are informed so that original
state can be restored.

Welcome to 5.99.27
2010-04-10 19:01:00 +00:00
pgoyette
6d6a30996f Permit creation of an event-monitor for alarm limits even if the limits
are not currently set (and, in case of battery capacity sensors, if there
is no value_max).  Ensure that such an event-monitor does not trigger the
delivery of any actual events.

Provide a mechanism for sensors to set their limits at time other than
system startup (for example, when a battery is inserted).

This allows us to boot a system with a battery missing, install the
battery some time later, and automatically monitor it without requiring
any user intervention to create the event-monitor.  (The actual changes
for battery sensors to use this new capability will come later.)
2010-04-01 12:16:14 +00:00
njoly
3e46e29198 Fix ENVSYS_DEBUG build. 2010-03-24 19:15:00 +00:00
pgoyette
7e351badfc In sysmon_envsys_sensor_event(), permit delivery of all events for the
sensor if no event type is specified.
2010-03-24 13:11:41 +00:00
pgoyette
bc480daf7a Additional info in DPRINTF to help debugging efforts 2010-03-23 16:52:02 +00:00
pgoyette
3a92a7609d Modify previous commit. The routine to deliver events is intended to be
exported to device drivers, so rename it and move the declaration to
<dev/sysmon/sysmonvar.h>
2010-03-19 02:19:13 +00:00
pgoyette
4e3cadf247 Separate event delivery from polling and limit evaluation in
sme_events_worker().

Provide a wrapper that can be called from sensor drivers' interrupt
routines to find and deliver a specific event.

XXX Actually updating sensor drivers (and their parent devices) to
XXX have interrupts is a future enhancement.  This is simply an
XXX enabler.
2010-03-19 01:16:44 +00:00
pgoyette
f2b6b76565 If we're going to valdate things, at least do it correctly. 2010-02-18 12:30:53 +00:00
pgoyette
8844275b30 For symmetry, allow warning and critical upper-limits for capacity
sensors.
2010-02-15 22:32:04 +00:00
pgoyette
de08bb89f2 Replace large amount of replicated code with a macro to improve readability. 2010-02-14 23:30:52 +00:00
pgoyette
9150436462 Remove the flags member of the limits structure. Its value was only
meaningful for a few limited function calls;  all persitent storage
of limit-present flags is maintained in the edata->upropset member.
2010-02-14 23:06:01 +00:00
pgoyette
f84d320712 Correct one more instance of checking flags in the wrong place. 2010-02-14 16:22:09 +00:00
pgoyette
7bd93168ee When checking current sensor value vs limits, check the correct set of
flags to determine which limits are present.
2010-02-13 19:34:14 +00:00
jruoho
7ed7fa0c2a Fix a typo in one DPRINTF (s/edata->des/edata->desc/). 2010-02-05 19:22:25 +00:00
pgoyette
4c60416219 If the AC adapter is flagged with SME_DISABLE_REFRESH, don't try to call
its refresh() callback.  Just assume that its value has been properly
updated by other means.
2010-02-04 18:06:53 +00:00
pgoyette
aaabf34dde Validate limit-based monitoring in one place, so we can apply the
constraints to both driver-requested and user-requested monitoring.

While here, clean up some of the debugging DPRINTFs.
2010-01-30 02:46:52 +00:00
pgoyette
af4bab2a6f Move the limits out of the event structure and into the main sensor.
Use the limits_flags only for calls to the {get,set}_limits() callbacks
and merge the results into upropset, rather than trying to maintain both
values (error prone).
2010-01-26 14:22:00 +00:00
pgoyette
299ee01345 If no limits are exceeded, make sure we set state to SVALID 2010-01-18 21:48:15 +00:00
pgoyette
4e1c0f753c Flags for existence of limit values need to be propagated to the
event data.  Otherwise, they're not processed.

XXX This needs to be rethought.  While fixing it this way makes things
XXX "work", we really shouldn't need to replicate these flags.  The
XXX limits and their flags should be kept as part of the sensor data,
XXX and not part of the event-monitor data.  I'll work on this in the
XXX near future.
2010-01-02 19:02:39 +00:00
pgoyette
801c007d68 Don't infer a sensor driver's ability to handle limit checking itself. 2010-01-01 15:41:25 +00:00
pgoyette
160a805c1d Check for value exceeding crit-max limit before checking against warn-max
limit.  Otherwise we'll never notice if we exceed crit-max (assuming that
crit-max is at least as large as warn-max).
2009-12-23 18:31:00 +00:00
pgoyette
d36ea2afc5 Document usage of PROP_DRIVER_LIMITS flag and set it correctly.
Use flag bits to determine validity of limit values, rather than
assuming that invalid/not-present values are set to zero.
2009-07-10 15:27:33 +00:00
pgoyette
c7ba8d5428 Initialize lims.sel_flags before using it. Prevents spurious limit
events being created for devices that don't provide internal limits.

Thanks to Mattias for finding this.
2009-07-08 17:28:53 +00:00
pgoyette
e65558aef1 Clean up a couple of debug statements that got missed previously. 2009-07-08 13:34:11 +00:00
pgoyette
45f4717820 Ooops - {get,set}_limits() need to be sensor-specific. Pass an extra
argument to them to identify the individual sensor being processed.
2009-06-14 19:43:12 +00:00
pgoyette
c235777756 Add capability to send sensor limit values to the driver so they can
be programmed into device registers.  This way we can let the hardware
help us out instead of having to always compare the value against each
limit.  (Driver updates for some sensors to take advantage of this
capability will be forthcoming.)
2009-06-13 16:08:25 +00:00
pgoyette
260b6fd907 Correct typo in last so we can #undef the correct macro. 2009-06-08 13:06:33 +00:00
pgoyette
f7ad703892 General clean-up and some restructuring of event handling. This is a
precursor to letting sensor drivers actually exchange limits/thresholds
with user-land.
2009-06-08 00:55:35 +00:00
pgoyette
5a84f3060e Since we no longer have individual events for each sensor value limit,
we don't need individual flag bits.  Clean up extra bit definitions.
Bump kernel version - welcome to 5.99.13
2009-06-01 20:08:44 +00:00
dyoung
3afac3e189 Fix spelling: mak -> make. 2009-04-07 21:49:36 +00:00
pgoyette
438c6057be Fix typo in previous, and wrap a panic with #ifdef DIAGNOSTIC 2008-11-11 19:03:06 +00:00
pgoyette
0ba7ea9569 Initialize event's "previous sent state" based on the event monitor type,
regardless of sensor type.  Fixes spurious "device: normal state on
'sensor-name' messages (reported by ad@) which interfere with sysinst.
2008-11-11 16:55:01 +00:00