Commit Graph
405 Commits
Author SHA1 Message Date
Jean Delvare eaec35491e Now that sensors_get_ignored() is an internal function, we can change
its prototype to suit our needs better.

* Pass the chip name by address.
* Pass the feature directly rather than its number.
* Switch to a sane convention for the returned value.
* Don't check for errors that can't happen.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4646 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-24 08:22:03 +00:00
Jean Delvare e9c8c5fb06 Let libsensors handle ignore statements by itself, rather than
delegating the task to the user applications.

For now, I am calling sensors_get_ignored() in
sensors_get_all_features(), because this is the least intrusive way.
This is in no way optimal though, it would be better to not add
ignored features to the feature list in the first place. However,
doing so would require that the configuration file is read before
sysfs is scanned for features, which isn't currently the case. So
this improvement is left for later.

Note that this patch adds a small cost in terms of performance. This
is because we now honor ignore statements on all features (main ones
and subfeatures) while in practice "sensors" was only checking for
main features. It would be trivial to stop checking for subfeatures,
but it seems to me that supporting ignore on subfeatures is a good
move, as the user may actually want to ignore a specific subfeature.
Individual alarms come to mind. This will also be handy to debug the
generic print code in "sensors".


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4644 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-24 08:20:53 +00:00
Jean Delvare 6505fef0fd The way we build the feature lists guarantees that subfeatures always
immediately follow their main feature. This makes it possible to simplify
sensors_get_all_features() quite a bit. We no longer need to maintain
separate pointers for the last main feature and the last subfeature,
we can simply walk the list linearly.

Note that I am still not entirely happy with this API. It was obviously
designed for debugging purposes (sensors -u) and without performance
concernes nor interface cleanliness in mind. I believe that we want to
tag main features and subfeatures as such, and let the application ask
specifically for the list of main features, and for each feature, for
its list of subfeatures (i.e. two functions instead of one.)


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4643 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-24 08:19:59 +00:00
Jean Delvare a62ee5bac2 Speed up sensors_get_ignored() a bit. We can return as soon as an ignore
statement is found to match, even if it isn't an exact match.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4642 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-22 12:51:57 +00:00
Jean Delvare 4c88142226 No need to explicitly discard subclients. With the hwmon class, they won't
even be found. For earlier kernels, they will be discarded anyway because
they expose zero feature.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4638 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-22 10:13:19 +00:00
Jean Delvare 98110858fe Discard devices with zero feature.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4637 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-21 09:28:12 +00:00
Jean Delvare f302998cd2 Fix a memory leak in sensors_read_one_sysfs_chip() when an error occurs.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4636 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-21 08:44:31 +00:00
Jean Delvare 5d33dd3e68 Minor optimizations to sensors_feature_get_type():
* We no longer support any single type, so no need to handle this case.
* We can start looking for "_" at offset 3 rather than the beginning
  of the string (the shortest valid prefix is "in0", 3 characters.)


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4631 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-19 20:50:17 +00:00
Jean Delvare c5b2eabf08 Now that sensors_feature_get_type() is an internal function, we can
adjust it to fit our needs better:

* Call sensors_feature_get_type() before allocating memory for the
feature name. The allocation will be reverted for all sysfs files
which are not valid libsensors attributes, and there can be a lot
of these. So this saves a few memory allocations. But this means
that we want to pass a simple string to sensors_feature_get_type()
rather than a struct sensors_feature_data. This also means that
sensors_feature_get_type() gets the raw attribute name ("_input"
not stripped.)

* Get the channel number from sensors_feature_get_type() too. We
get it for free from sscanf(), so it's more efficient to return it
than to parse it again in sensors_read_dynamic_chip().


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4630 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-19 20:49:29 +00:00
Jean Delvare 70317e1a0e The way we use sensors_feature_get_type() is rather suboptimal. It is
first called during the library initialization to generate the feature
tables. Then it is called again by sensors itself. This is because we
do not store the result the first time. I propose that we add a type
field to struct sensors_feature_data, where libsensors would store
the result of sensors_feature_get_type(). That way, the application
can get the information without calling sensors_feature_get_type()
again.

This change has the following benefits:
* Obviously, a small speed-up.
* sensors_feature_get_type() can be removed from the public interface.
  This means that we can turn it into something that fits the
  libsensors needs better, allowing for more optimizations (see next
  patches.)

Note: the patch looks bigger that it really is, because I had to move
definitions around in sensors.h.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4629 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-19 20:46:09 +00:00
Jean Delvare fd6fc535ab No special treatment is needed for the name attribute.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4616 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-16 12:08:00 +00:00
Jean Delvare 7b8fdf0188 Advertise and document libsensors_version.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4602 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-10 19:55:06 +00:00
Jean Delvare f905e5f242 Delete LM_DATE and libsensors_date.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4601 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-10 19:38:14 +00:00
Jean Delvare 9cd9debba9 Add support for multiple VID values. Untested as I don't have a chip with
multiple VIDs, but these exist. This closes ticket #2223.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4554 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-05 16:09:40 +00:00
Jean Delvare 7a2ab38ecf Move sensors_proc_read and sensors_proc_write to sysfs.c, and rename them
to something more in line with what they do.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4553 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-05 15:03:22 +00:00
Hans de Goede eeee6f9bb7 Add support for foo#_label sysfs files
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4550 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-04 07:54:37 +00:00
Jean Delvare b79274babd Add some more warning flags, and fix these warnings.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4545 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-03 16:03:22 +00:00
Jean Delvare c7c77845d2 Make a few libsensors functions static.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4544 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-03 14:26:26 +00:00
Jean Delvare 7cc03f5029 Drop VRM reporting and selection support from libsensors. Since kernel
2.6.9, the right VID conversion formula is selected automatically
depending on the CPU model, so the user shouldn't have to care.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4543 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-03 13:22:28 +00:00
Jean Delvare dced776a12 Use sscanf instead of regex to match the feature names. This is much faster.
As a side effect, this fixes a memory leak (the regex engine data was never
freed.)


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4538 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-03 08:18:21 +00:00
Jean Delvare cc1700958b Fix the description of the mode field.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4525 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-29 12:30:58 +00:00
Jean Delvare e780d22d03 Simplify the code setting the feature mode.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4521 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-29 12:11:43 +00:00
Jean Delvare 78d9053547 There are no sensor* sysfs files.
The VID value is in cpu*_vid, not vid.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4520 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-29 11:46:20 +00:00
Jean Delvare 0c46611b20 Drop two unused macros.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4519 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-29 08:21:38 +00:00
Jean Delvare 1de056f9bf Negative magnitudes are no longer supported.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4518 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-29 08:16:24 +00:00
Jean Delvare e08eabe33c We no longer need alternative sysfs file names and magnitudes, as they are
the real name and magnitude now.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4513 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-28 18:19:58 +00:00
Jean Delvare 92b5982180 With the new dynamic chip features enumeration code, the sensors_proc_chips
and sensors_chip_features_list arrays tend to track the same information.
So it's much more simple, and more efficient, to have a single array. I
decided to keep sensors_proc_chips, because it already has memory management
helpers. One nice side effect is that the arbitrary limit to the number of
supported chips is now gone. Another one is that some of the memory leaks
were fixed.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4510 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-28 14:39:34 +00:00
Jean Delvare 32b1b71245 Feature names are now dynamically allocated -> no const.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4509 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-28 13:35:46 +00:00
Jean Delvare 063f4b91d4 Use complete chip names (prefix + bus + address) as the keys of
sensors_chip_features_list[]. Using only the prefix (as was done before)
makes it impossible to properly support multiple chips with the same prefix
but a different feature set.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4508 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-28 12:09:00 +00:00
Jean Delvare 8fdfa3f19d Move the few lines of code remaining in chips.c to data.c, and finally
delete chips.c. RIP.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4507 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-28 09:53:01 +00:00
Jean Delvare 75d55dc5ae Delete the chip-specific code from libsensors. It's about time to get
the generic code to work.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4506 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-28 09:38:31 +00:00
Jean Delvare 3e69b5182a No longer need to include "kernel/sensors.h".
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4501 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-28 07:29:43 +00:00
Jean Delvare 8138489a72 struct sensors_proc_chips_entry now has a single member, so we may
as well use this member directly for slightly more simple code.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4474 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-26 11:33:09 +00:00
Jean Delvare 6c7effca88 libsensors: Kill procfs and sysctl support, part 2.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4473 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-26 10:06:46 +00:00
Jean Delvare 24f6b62c3f Delete all remnants of algorithm names.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4465 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-25 14:21:01 +00:00
Jean Delvare f00aef9271 Return with an explicit error code/message if sysfs isn't mounted.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4464 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-25 13:58:55 +00:00
Jean Delvare f8c7f20bf1 No longer need to include general.h.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4463 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-25 13:39:55 +00:00
Jean Delvare fea1d9a1bb libsensors: Kill procfs support, part 1.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4462 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-25 13:32:27 +00:00
Jean Delvare c8b02ddfa3 Install libsensors as libsensors.so.4, and sensors as sensors3. This makes
it possible to install both the old and the new libsensors and sensors,
making testing much easier. sensors3 will be renamed back to sensors before
we release.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4461 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-25 11:39:08 +00:00
Jean Delvare 85393f35b6 Always build libsensors with sysfs support.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4458 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-06-25 08:18:47 +00:00
Jean Delvare 768be0b9c0 Drop SENSORS_FEATURE_TEMP_LIM, it doesn't correspond to anything in the
standard sysfs interface.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4428 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-05-29 16:49:06 +00:00
Jean Delvare 33a3d6fba2 Drop SENSORS_FEATURE_TEMP_OVER, SENSORS_FEATURE_TEMP_HIGH and
SENSORS_FEATURE_TEMP_LOW, they don't correspond to anything in the
standard sysfs interface.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4427 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-05-29 16:23:19 +00:00
Jean Delvare 139afe6665 Disable specific support for the ds1621, lm90 and f71805f drivers.
I tested that the generic support works fine for these devices.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4424 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-05-28 15:02:18 +00:00
Jean Delvare a08cf956fb Fixes to the dynamic chip support:
* Fix the handling of temperature hysteresis. Hysteresis is not a
  temperature limit by itself, but a property of temperature limit.
* Handle per-limit temperature alarms.
With these fixes, the ADM1032 is properly supported by the new code.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4423 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-05-28 14:22:58 +00:00
Jean Delvare 1bd9212065 Fill the magnitude field of dynamically generated device entries.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4420 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-05-28 12:38:28 +00:00
Jean Delvare 5a38143c5e libsensors: Drop support for non-sensor drivers: ddcmon and eeprom.
These should never have been supported to start with, and no longer
are in practice with recent 2.6 kernels.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4403 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-05-13 15:02:44 +00:00
Jean Delvare e8861069b2 sensors.conf.8: Update the chip statement section.
* Drop outdated reference to /proc/sys/dev/sensors
* Bus type can be pci
* Make the examples more realistic


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4374 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-04-20 13:36:43 +00:00
Hans de Goede bd74aa2390 -rewrite dyn chip code, it now uses sensors_feature_get_type() to
identify sysfs entries. Reasons for this rewrite / bugs fixed:
 -Don't give features like alarms / sensor type / fault flag a
  compute mapping only a normal mapping
 -Don't generate features for sysfs entries like uvent, modalias, etc.
  instead only generate features for features known by
  sensors_feature_get_type()
 -Sort the list of found features logically instead of sorted in alphabet order
  of the sysfs entry. So now it starts with all in entries, then all fan and
  then all temp. Just like the order of most entries in lib/chips.c. Also
  this means that it now contains in0 - in10 in that order and not in0, in10,
  in1 - in9


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4368 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-04-10 11:51:07 +00:00
Hans de Goede 16408d8665 -comment abituguru entry in lib/chips.c and prog/sensors/main.c, as the
abituguru seems to work well with the new dynamic chip support and generic
 chip printroutines. note: the abituguru code should be completly removed in
 the future.
-comment k8temp entry in lib/chips.c and prog/sensors/main.c, as the
 k8temp seems to work well with the new dynamic chip support and generic
 chip printroutines. note: the k8temp code should be completly removed in
 the future.
-make the match for the subtype exact instead of a strncmp, otherwise
 an alarm_enable flag gets classified as an alarm, leading to all sensors who
 have their alarm enabled getting an alarm reported, as the alarm_enabled gets
 read as alarm.
-and do the same for the _input match to check if this is a main or subfeature


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4367 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-04-09 18:07:07 +00:00
Hans de Goede ba5140b3d8 Generic chip support / get featuretype fixes just received from Bob Schlarmann, as the version I committed wasn't the latest version
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4366 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-04-09 17:48:57 +00:00