Commit Graph
608 Commits
Author SHA1 Message Date
Andrew Lunn 0880db23b9 Add support for MDIO busses
Marvell Ethernet PHYs can contain a temperature sensor, which the kernel
exports as an HWMON device. The PHY is on an MDIO bus. Add support for
this bus types to libsensors. The sensor is then displayed by sensors(1):

socaipsbus02100000ethernet02188000mdioswitch0mdio01-mdio-1
Adapter: MDIO adapter
temp1:        +54.0°C  (crit = +100.0°C)

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
2017-07-08 20:19:13 -07:00
David Frey 7035d7bec4 Make include guards consistent in libsensors
Signed-off-by: David Frey <dpfrey@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-04-14 08:11:01 -07:00
Jean Delvare b200f794b3 libsensors: Fix sparse warnings
Sparse wants forward declarations of static functions to be static as
well. For sensors_eval_expr, do that. For the error callbacks,
rearrange the code so that the forward declarations are no longer
needed.
2015-05-15 11:24:28 +00:00
Jean Delvare e0abfe8c5d Add libsensors.map to the list of dependencies for libsensors.so. 2014-05-09 05:53:10 +00:00
Jean Delvare da5b14dc0c sensors.conf.5: Enhance the hysteresis documentation
Mention all supported temperature hysteresis attributes. Recommend
setting each limit before its hysteresis.
2014-04-23 15:17:24 +00:00
Jean Delvare f09b1c6483 libsensors: Add support for temp[1-*]_min_hyst and temp[1-*]_lcrit_hyst
Add support for sysfs attributes temp[1-*]_min_hyst (already
implemented by drivers adt7x10, lm77 and lm92) and
temp[1-*]_lcrit_hyst (no known users yet.)
2014-04-22 08:05:14 +00:00
Jean Delvare eb5cf8b2ec Update my e-mail address and copyright years 2014-03-20 10:23:35 +00:00
Jean Delvare c29be769f1 libsensors: Avoid insane memory allocations
While there is no longer a hard limit to the number of sensor of a
given type per chip, I feel a little uncomfortable having no limit at
all on the amount of memory we may try to allocate. Add an arbitrary
safety limit so that a design error or a bug in a hwmon driver can't
result into an insane memory allocation.
2014-01-30 12:45:23 +00:00
Jean Delvare b9361dc088 libsensors: Adjust memory pre-allocation steps
Make memory pre-allocation steps depend on the sensor type. Things like
voltages, temperatures or fans are typically plenty, however vid and
chassis intrusion are typically only a few, and there can only be one
beep_enable by design. This saves a small amount of temporary memory
for cheap.
2014-01-29 14:39:34 +00:00
Jean Delvare 0159202226 libsensors: Get rid of FEATURE_SIZE
max_subfeatures is computed the first time it is needed, we can do
exactly the same with FEATURE_SIZE. Introduce feature_size as a static
variable so that we don't have to recompute it again and again.
2014-01-29 14:11:12 +00:00
Jean Delvare 8b4299252b Bumb libsensors version, part 2 2014-01-29 09:28:08 +00:00
Jean Delvare ff7e16dafa Bump libsensors version 2014-01-29 09:27:23 +00:00
Jean Delvare 883f4e49a3 libsensors: Get rid of arbitrary limit on per-type sensor count
When gathering the attributes of each hwmon chip, libsensors uses a
temporary structure in memory to order and group all the attributes
into features. This temporary structure used to be a single array with
room for every possible attribute/subfeature. While simple, this
approach required to predefine a maximum number of per-type sensor
that could be handled.

In order to get rid of this arbitrary limit, which we hit and had to
raise three times already, I changed the temporary structure to an
array of dynamically allocated per-type subattribute arrays. This lets
us not allocate any memory for types which aren't implemented by a
given chip, and more importantly, this lets us reallocate room for
more attributes of a given type as needed.

I decided to allocate chunks of 8 attributes at a time, as this seemed
a good compromise between two frequent reallocations and
over-provisioning. It could be tweaked if needed.

Icing on the cake, I benchmarked this change on two different systems
and it results in performance gains. The total heap usage as reported
by valgrind is down by 50% on average, with peak memory consumption
(as reported by valgrind's massif) also down by 43% on average. The
total instructions count (as reported by valgrind's callgrind) is down
by 11% on average, with measured execution time also down by a few
percents. Valgrind rocks, BTW.

I have some ideas to optimize the memory allocations further, but I do
not expect such a huge gain from them. They may not even improve peak
memory consumption as massif shows the peak is somewhere else now at
least in some cases.
2014-01-29 09:25:31 +00:00
Jean Delvare 18853526ec libsensors: rename function sensors_compute_max
The new function name, sensors_compute_max_sf, better reflects what
the function is actually doing.
2014-01-28 21:47:41 +00:00
Jean Delvare 2252b49e2b libsensors: Increase MAX_SENSORS_PER_TYPE to 33
This is needed to properly support all temperatures reported by the
coretemp driver on recent hardware.
2014-01-14 14:49:04 +00:00
Jean Delvare a3f215218f Extend the documentation of sensors_init() and
sensors_get_adapter_name(). Paul Crawford asked questions about these
as he found the original documentation unclear. I'm including my
answers to his questions here, reformatted, so that other developers
can benefit from them too.
2013-09-11 11:56:08 +00:00
Jean Delvare 122780fc96 sensors.conf.5: Mention "sensors -u" to get the raw feature names.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6091 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-11-12 09:48:37 +00:00
Jean Delvare 6ee8f6096d Merge 4 regular expressions into a single one, this is faster.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6046 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-04-19 13:21:00 +00:00
Jean Delvare 08d713c412 libsensors: Fix warning about library path not in /etc/ld.so.conf
On recent systems, extra configuration files can live in
/etc/ld.so.conf.d, so check this directory too, before warning.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6045 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-04-19 13:18:45 +00:00
Jean Delvare ae877a1e55 Prepare for release.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6035 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-03-14 07:43:39 +00:00
Jean Delvare a3e40509e0 Add support for fan[1-*]_max, fan[1-*]_min_alarm and fan[1-*]_max_alarm
attributes. These are defined in the standard sysfs interface for quite
some time, and at least three drivers (max6650, lm63 and applesmc)
implement them so we should support them.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6029 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-03-06 07:34:13 +00:00
Jean Delvare ae32c8a919 Upcoming change in sysfs will break the way libsensors detects if
sysfs is mounted. Adjust the implementation so that it still works after
said change.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6017 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-01-31 12:54:03 +00:00
Guenter Roeck 273102f2c9 Add support for additional sysfs attributes to libsensors and to sensors command
inX_average
inX_lowest
inX_highest
tempX_lowest
tempX_highest
currX_average
currX_lowest
currX_highest




git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6007 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-01-09 17:30:10 +00:00
Jean Delvare 159cceaa24 Prepare for release.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5949 7894878c-1315-0410-8ee3-d5d059ff63e0
2011-03-28 07:02:37 +00:00
Jean Delvare cae654385e Only export from libsensors symbols which are actually public (i.e.
listed in the public header files and documented in the manual page.)
Patch from Cristian Rodriguez <crrodriguez@opensuse.org>.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5939 7894878c-1315-0410-8ee3-d5d059ff63e0
2011-03-06 20:20:55 +00:00
Guenter Roeck eaf86b0c49 Added support for SENSORS_SUBFEATURE_FAN_PULSES to libsensors.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5938 7894878c-1315-0410-8ee3-d5d059ff63e0
2011-03-04 20:37:43 +00:00
Guenter Roeck c618c56023 Added support for humidity sensors to libsensors
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5918 7894878c-1315-0410-8ee3-d5d059ff63e0
2011-02-13 18:55:09 +00:00
Guenter Roeck fb325cf089 Add support for recently added sysfs ABI attributes
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5917 7894878c-1315-0410-8ee3-d5d059ff63e0
2011-02-09 19:25:22 +00:00
Guenter Roeck 443b54b325 Added support for new sysfs attributes
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5898 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-12-14 20:26:27 +00:00
Jean Delvare ff0bfc174d Compute MAX_*_SENSOR_TYPES at build time (#2378).
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5897 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-12-14 09:09:42 +00:00
Jean Delvare a29f126e08 Compute MAX_SUBFEATURES at run-time (#2378).
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5896 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-12-14 09:06:19 +00:00
Guenter Roeck 5cd466477f Fixed typo in lib/sensors.conf.5.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5887 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-12-09 16:31:03 +00:00
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 f292e9f408 Prepare for release.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5863 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-10-10 19:15:54 +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 6e78c8c779 Prepare for release.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5819 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-02-02 20:14:53 +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
Hans de Goede 271aec857a Add sensor3.conf.5 symlink to sensors.conf.5 manpage
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5776 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-10-01 07:43:41 +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 6868367764 sensors_get_label: Merge pathname and label buffers (patch from
George Spelvin).
    
The lifetimes of the path and label name buffers are
disjoint, so a single buffer can be used for both purposes.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5748 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-06-30 20:52:20 +00:00
Jean Delvare b3f39211b2 Consolidate strdup calls in sensors_get_label (patch from George Spelvin).
There were multiple in-line calls that then fell through to
a common exit.  Instead, set up a pointer to the original
strings, and have a single strdup in the common code.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5747 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-06-30 20:47:53 +00:00
Jean Delvare 0a55087719 Bump library version to 4.2.0.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5741 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-06-20 12:00:22 +00:00
Jean Delvare 78f496ca62 libsensors: New method to free the memory allocated for the internal
representation of chip names.
sensord, sensors: Fix a memory leak when one or more chip names are
provided on the command line.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5740 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-06-20 10:04:52 +00:00
Jean Delvare ee26e6d2b0 From Yuriy Kaminskiy:
Most filesystems (in particular - reiserfs, jfs, xfs, nfs); maybe,
some legacy installation of ext2/3 too) always return dirent->dt_type =
DT_UNKNOWN, so libsensors fails to parse /etc/sensors.d.
  Also, symlink (DT_LNK) can point to directory, or FIFO/socket/device
(very bad!) - current check insufficient anyways.

Fixed by always using stat() to check what each entry is, rather than
relying on dirent->dt_type.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5730 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-06-05 15:17:29 +00:00