2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-09-05 08:45:26 +00:00
Commit Graph

102 Commits

Author SHA1 Message Date
Jean Delvare
05a24e5bb2 libsensors: Add support for intrusion detection.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5879 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-11-03 13:00:59 +00:00
Jean Delvare
7f1c32dbd2 Some features are never scaled.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5876 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-11-02 13:00:19 +00:00
Jean Delvare
9b44cc2819 Work with the feature type instead of the shifted subfeature type where
possible. This makes the code more readable.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5875 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-11-02 12:59:31 +00:00
Jean Delvare
62fd781722 Reorganize the temporary sparse subfeature table. It's a little larger
now, but this make it possible to add more feature types without
increasing the code complexity beyond reason. Define constants and use
them to make the code even easier to understand.

If anyone is really worried about the relatively large memory
allocation, one way to improve the situation would be a two-pass
approach. But remember the memory is only needed for a short time...


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5874 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-11-02 12:57:11 +00:00
Jean Delvare
e369e65d42 Change libsensors license from GPL to LGPL.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5844 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-07-01 11:56:42 +00:00
Jean Delvare
60635dafc6 Map individual beep features. We had symbols for them for a long time,
I have no idea why they weren't mapped to the sysfs file names.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5843 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-06-21 09:02:30 +00:00
Jean Delvare
573b707d5f Fix a comment.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5827 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-02-23 13:36:46 +00:00
Jean Delvare
5fe10beeda Increase MAX_SENSORS_PER_TYPE to 24. The old value of 20 isn't enough
at least for the W83795G, which has up to 21 voltage inputs.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5826 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-02-23 13:29:05 +00:00
Jean Delvare
7c37bd44ac Add support for HID devices.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5786 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-10-18 12:05:16 +00:00
Jean Delvare
4d3ee85bae Support upcoming sysfs path to i2c adapters.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5759 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-07-22 12:53:51 +00:00
Jean Delvare
c1a066a307 If str(n)dup fails, there is no more memory left. We should exit with
"Out of memory". Patch from Andre Prendel.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5661 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-02-20 10:56:52 +00:00
Jean Delvare
09abbcb686 When looking for hwmon device attributes, skip non-file sysfs entries.
This speeds things up a little. Patch from Andre Prendel.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5636 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-02-06 13:14:36 +00:00
Hans de Goede
11eec21555 Add ACPI bus
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5593 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-01-13 08:06:32 +00:00
Jean Delvare
51a621be43 Add support for current sensors.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5379 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-10-24 09:04:26 +00:00
Jean Delvare
d766935c47 Add support for instantaneous power sensors.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5378 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-10-24 09:03:18 +00:00
Darrick J. Wong
bb840c486c Subject: [PATCH 1/3 v3] libsensors: Support energy and power meters
Add power and sensor meters to libsensors, with minor tweaks and
documentation updates as suggested by Jean Delvare.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>



git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5183 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-04-17 01:27:22 +00:00
Jean Delvare
39b96fa477 Add support for virtual hwmon devices. This closes Red Hat bug #437637
and ticket #2305.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5176 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-04-14 15:27:59 +00:00
Darrick J. Wong
7566fa5b1c Subject: [PATCH 1/4] libsensors: Detect OpenFirmware hwmon devices
On a QS22 blade, the BMC containing the (ibmpex) power meters is enumerated
via Open Firmware.  Check for "of_platform" to handle this case.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5174 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-04-10 23:24:57 +00:00
Jean Delvare
f2e518511d Patch from Aurelien Jarno:
I have just noticed that the FSF address is the old one in all files
except COPYING. Please find a patch below to fix that.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5163 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-03-26 13:37:12 +00:00
Hans de Goede
e4870c50f9 The platform case
acts as a fallback solution so it must be last in the list.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5145 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-03-16 12:51:18 +00:00
Jean Delvare
24ee53d80e Use __func__ instead of __FUNCTION__. The former is standard, the latter
is not.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5134 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-03-05 07:44:16 +00:00
Jean Delvare
9815a9f31b Add support for drivers that place the hwmon attributes in the hwmon
class device directory rather than directly in the device directory.
The latter is what all drivers do at the moment, but in the long run
the former is preferred as it prevents attribute name collisions.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5093 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-01-05 15:20:13 +00:00
Jean Delvare
5af7917c1f Get the device type from the subsystem symlink, rather than
guessing it from how the device identifier looks like. For kernels
<= 2.6.17, we use the bus symlink instead. For kernels <= 2.6.11,
neither symlink exist so we fallback to the old type guessing
approach. It doesn't really matter as all hwmon devices were
i2c devices back then.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5092 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-01-05 12:31:55 +00:00
Mark M. Hoffman
48c6b26c20 libsensors: minor cleanup
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5075 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-12-16 19:37:11 +00:00
Jean Delvare
67218f03c3 libsensors: No longer depend on libsysfs.
Instead, access sysfs directly, using 3 embedded helper
functions. My motivations for doing this are:
* As far as I know, libsysfs is no longer maintained.
* libsysfs does much more than we need. For example, when asking for a
device attribute list, libsysfs will read the contents and permissions
of all attributes. Not only does this waste CPU cycles per se, but in
the case of hwmon driver it also triggers register reads, which can be
slow for SMBus chips.
* libsysfs enforces the difference between devices and class devices,
while future changes will be easier if we can handle both types alike.



git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5067 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-12-10 13:30:22 +00:00
Jean Delvare
8a62e5f651 libsensors: Report I/O errors as such.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4899 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-29 18:48:20 +00:00
Jean Delvare
2c642d01e1 libsensors: Differentiate between different read error types.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4896 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-29 12:46:36 +00:00
Jean Delvare
301e18b511 libsensors: Notify the caller when writing a value fails.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4895 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-29 11:57:37 +00:00
Jean Delvare
6c229f7a3c Drop SENSORS_ERR_NO_DEVS: we return success, not error, when no device
is found.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4879 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-24 16:34:56 +00:00
Jean Delvare
38d16d299d Add support for platform devices with no ID.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4878 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-24 15:22:01 +00:00
Jean Delvare
d1b374cc38 Renumber feature and subfeature types to leave more room if we later
need to add more feature or subfeature types.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4858 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 17:42:27 +00:00
Jean Delvare
55e467b151 Don't arbitrarily write errors to stderr. In production mode,
simply ignore the errors. In debug mode, call sensors_fatal_error().

As a side note, there is certainly room for improvement in the way
errors are reported by libsensors. sensors_fatal_error() is fatal,
and sensors_parse_error() is too specific, so we lack a more general
error reporting function. printf-like formatting for error messages
would also be a good idea.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4855 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 14:34:42 +00:00
Jean Delvare
ab36c5b0f8 Delete unused SENSORS_ERR_ACCESS.
Rename SENSORS_ERR_PROC to the more neutral SENSORS_ERR_KERNEL.
Introduce SENSORS_ERR_NO_DEVS for finer-grained error reporting.
Use SENSORS_ERR_KERNEL and SENSORS_ERR_NO_DEVS where appropriate.
No error message for invalid error codes.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4854 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 13:53:11 +00:00
Jean Delvare
9ba88a7d1f Better prototype for get_type_scaling().
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4850 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:49:47 +00:00
Jean Delvare
e7c345f4cf Pass a subfeature structure to sensors_read_sysfs_attr() and
sensors_write_sysfs_attr(), rather than a subfeature number, so that
we do not have to lookup the feature number again.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4841 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:20:07 +00:00
Jean Delvare
da7b4e48da Introduce a separate type for main features. Make subfeatures map to
the real main feature rather than the first subfeature.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4838 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:16:50 +00:00
Jean Delvare
65f1d1f1cd Rename subfeature types from *_FEATURE_* to *_SUBFEATURE_*, to better
reflect what they represent.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4837 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:12:19 +00:00
Jean Delvare
e13c11d353 Update the comments and symbols in the whole library code to refer to
features and subfeatures as appropriate.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4836 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:07:53 +00:00
Jean Delvare
96c914bfda Define a separate structure to represent main features. This allows
for faster main features lookup. One side effect of this change is
that subfeatures can no longer have labels nor be ignored. I do not
think that this is a problem in practice, and actually this makes a
lot of sense.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4834 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:05:16 +00:00
Jean Delvare
79086fb7b8 Rename struct sensors_feature_data to sensors_subfeature. This is a
first step towards a clean separation between main features and
subfeatures.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4832 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:02:22 +00:00
Jean Delvare
08a686e3cc sensors_feature_data and sensors_chip_feature are now the exact
same structure, so we can get rid of the former for simpler code.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4830 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 11:59:51 +00:00
Jean Delvare
60b50b6cb9 Fix compilation breakage with non-C99 compilers.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4829 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-21 18:15:32 +00:00
Jean Delvare
9cf1330eb0 Add support for beep features.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4826 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-20 21:23:19 +00:00
Jean Delvare
65b9d4dd92 Move sensors_feature_get_type() from access.c to sysfs.c, it's only called
from this file. This lets the compiler do additional optimizations.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4776 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 16:14:53 +00:00
Jean Delvare
61686376df Add support for temperature offset files, which are part of the
standard sysfs interface. I don't think it makes much sense to
display the offset values as part of the output of "sensors" (it
would even probably confuse people) but having support for these
in libsensors makes it possible to adjust the offsets in
sensors.conf, which is convenient.

This closes ticket #2248.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4769 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 12:31:12 +00:00
Jean Delvare
29bea1e843 Add support for the standard beep_enable attribute (#2248).
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4766 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 12:28:31 +00:00
Jean Delvare
3c53f5fa85 Increase MAX_SENSORS_PER_TYPE from 16 to 20: the ADM1026 can have up
to 17 voltage inputs, and bmcsensors used to support up to 20 voltage
values.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4765 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 08:31:25 +00:00
Jean Delvare
5c121e2b74 Another minor optimization to sensors_read_dynamic_chip():
* We don't need a temporary structure for the feature being
  currently processed. Instead we can work on the large sparse
  array directly.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4764 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 08:29:36 +00:00
Jean Delvare
75bd19ec34 Minor optimizations in sensors_read_dynamic_chip():
* We don't need to compute the mapping during the first pass: this
  field is overwritten when renumbering the features anyway.
* Only main features have features mapping to them.
* Only subfeatures have mappings, so we can stop the scan at the next
  main feature.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4763 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 08:26:26 +00:00
Jean Delvare
b836fc0b53 Now that we can deduce the scaling factor required for each feature
from its type, there's no need to store this scaling factor. We can
instead compute it at runtime. This saves some memory (about 10 kB
in my real-world test), and the runtime overhead is totally
negligible.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4762 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 08:21:19 +00:00