Commit Graph
3652 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 9896986247 We no longer need sensors_get_label_and_valid(), as it does hardly
more than sensors_get_label(). This allows for some cleanups.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4645 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-24 08:21:23 +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 462e7d81df Unify error reporting messages. Fix a memory leak in error path.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4639 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-22 12:25:15 +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 834cd70e14 Drop redundant test.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4632 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-20 19:09:00 +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 ac5ae18fe7 Drop the package target.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4628 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-19 16:59:16 +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 d73a25b166 Don't sort the same list twice.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4611 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-14 16:32:56 +00:00
Jean Delvare c100b4f38b Don't add non-sensor I2C chips to the list of detected I2C chips. Even
if we discard them later, their presence in the list can prevent the
"no sensors found" event from triggering. It also causes the script to
suggest loading i2c bus drivers which are not needed for hardware
monitoring.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4610 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-14 16:29:52 +00:00
Jean Delvare 91d6d664ed Fix broken links to Analog Devices website.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4607 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-13 14:53:31 +00:00
Jean Delvare 356e03f000 Add missing static marker.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4605 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-13 11:05:43 +00:00
Jean Delvare 02b58be2e8 Add Fintek F71806FG and F71862FG detection.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4604 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-10 21:09:32 +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
Hans de Goede d5d0476273 remove f71882fg example config fan2-4 ignore lines and add labels, fix typo in Battery label
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4600 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-09 12:54:54 +00:00
Jean Delvare e45b873981 Delete unused function sensors_get_sub_feature_by_type().
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4598 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-09 11:20:47 +00:00
Jean Delvare 867b8453f2 Add more known SMSC Super IO chips to sensors-detect. Also sort
the list of SMSC chips by chip name. Patch from Juerg Haefliger.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4597 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-08 20:54:33 +00:00
Hans de Goede 712748f659 Handle chips who return the beta value as temp sensor type
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4595 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-08 18:59:16 +00:00
Jean Delvare a2b7c5b0b1 Drop reference to mkdev.sh.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4594 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-08 12:01:23 +00:00
Jean Delvare a83ef92c9a Delete mkdev.sh. i2c device nodes are created by devfs or udev on most
2.6 kernel-based systems, for others they should have been created at
system installation time. If they are missing, sensors-detect will run
MAKEDEV to create them.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4593 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-08 12:00:55 +00:00
Jean Delvare 982afbce24 Only write integer values to pwm files.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4591 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-08 11:17:26 +00:00
Jean Delvare cd0b8c3489 Delete fancontrol.pl. The reason given when it was added was that the
bash implementation was spawning too many child processes, and that
was true, but this has been addressed since. And I don't particularly
enjoy maintaining two scripts doing exactly the same thing.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4590 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-08 10:13:11 +00:00
Jean Delvare 759098c8f8 Use linear interpolation instead of quadratic to choose PWM values.
This is simpler and will work better in most cases. For example this
should address at least part of ticket #2224. It seems that quadratic
was used to lower the average noise level, but I don't think this is a
valid reason. The new MINPWM and MAXPWM parameters will also let the
user control the noise level if really needed.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4589 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-08 10:04:48 +00:00
Hans de Goede caa92d7b1e add check for /dev/MAKEDEV
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4587 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-08 05:56:43 +00:00
Jean Delvare d33285b3b0 Cleanup the module.conf / modprobe.conf selection code.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4585 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-07 20:04:59 +00:00
Hans de Goede 15f1274aef add f71882fg sensors.conf.eg entry
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4580 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-07 16:57:07 +00:00
Jean Delvare 3549a94232 Right-align FAULT flags.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4578 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-07 15:26:12 +00:00
Jean Delvare 2296f9b738 Add the recent donations from Observit.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4577 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-07 08:29:48 +00:00
Hans de Goede d2c3d2d14f try to run MAKEDEV if i2c-dev device files are missing before aborting (adapted fedora patch)
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4572 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-06 19:40:44 +00:00
Hans de Goede 9fb93e1ff9 handle /usr/bin location of sensors command in example scripts printed by sensors-detect
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4569 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-06 19:24:57 +00:00
Hans de Goede 1864d90513 also recognise /etc/modprobe.conf (Fedora patch)
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4567 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-06 19:14:18 +00:00
Hans de Goede b1281bf669 improve generic print of temp inputs with so many limits they span 2 lines
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4564 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-06 13:19:00 +00:00
Jean Delvare e17f73da24 Fix ADM1022 detection.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4562 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-06 09:54:10 +00:00
Hans de Goede 4d2fa4eadd Better generic print fault handling
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4559 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-05 21:03:06 +00:00
Jean Delvare 83fe82736d Prevent a potential array overrun.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4556 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-05 16:19:51 +00:00
Hans de Goede b998b35ecc update fintek f71882fg sensors-detect entry
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4555 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-05 16:15:27 +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 7cb36ef6d2 add AMDSI PECI sensortype support to generic_temp_print()
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4552 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-05 11:22:57 +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
Hans de Goede 3e37149f04 generic in and fan print routine fixes
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4549 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-07-03 19:38: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