2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-30 05:48:07 +00:00

4039 Commits

Author SHA1 Message Date
Jean Delvare
4d6bec8bb2 Add a parameter to sensors_get_detected_chips(), to optionally let the
caller select which subset of chips it wants. This is slightly better
size-wise than letting all applications do the filtering by themselves.

This will change the way the command line parameters of "sensors" are
interpreted. Beforehand, the chips were always returned in the order
in which they were listed by the library. Also, each chip could be listed
only once. From now on, the chips will be listed in the order in which
they are passed on the command line, which I think makes more sense. A
side effect is that chips can be listed more than once, if that's what
the user asks for. Not very useful though.

This change makes it possible to make sensors_match_chip() internal
to the library. Filtering the list of chips returned by
sensors_get_detected_chips() was the last known external use for this
function.

This patch looks much bigger than it really is, but the largest part is
really only code reindentation.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4701 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-26 08:26:20 +00:00
Jean Delvare
ff4cfd53d5 Delete file BUGS. All documented bugs are in kernel drivers so the
information no longer belongs to this package. Most of it seems to be
outdated anyway.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4700 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-25 11:49:07 +00:00
Jean Delvare
0c24a60643 Drop the CONFORMING TO sections from the man pages. lm-sensors is in no way
an official standard so it doesn't make much sense. Instead, use the 4th
field of .TH to mention that these tools are part of lm-sensors.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4699 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-23 08:14:48 +00:00
Jean Delvare
bf1ff10ab4 Relabel "sensors -u" from "unknown chip" to "raw chip". sensors uses generic
code to display all the chips now so the notion of "unknown chip" no longer
exists, however this raw output format can still be useful for debugging.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4698 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-23 07:45:58 +00:00
Jean Delvare
90c2942bef Drop sensors option -U, --hide-unknown. libsensors no longer exposes
chips with no features, and it builds the features list dynamically, so
applications no longer get to see unknown chips.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4697 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-22 18:43:48 +00:00
Jean Delvare
a30d37899f Drop SENSORS_MODE_NO_RW and SENSORS_MODE_RW. The mode is a bitfield,
we typically set, or test for, a specific bit.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4696 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-22 17:07:11 +00:00
Jean Delvare
b0fb417996 sensors_get_value() and sensors_set_value(), respectively.
The new names better reflect what the functions do.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4695 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-22 17:06:13 +00:00
Jean Delvare
8bcdc331a0 Change the prototype of sensors_get_label(). Errors can be reported
with a NULL pointer.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4694 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-22 17:05:01 +00:00
Jean Delvare
12655c1d85 Drop support for reloading the configuration with sensors_init().
Instead, the application will have to call sensors_exit() explicitly
before calling sensors_init() again. Most applications don't offer
any way to reload the configuration file, so better optimize for the
initial load.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4693 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-22 17:04:12 +00:00
Jean Delvare
fe165fea49 Fix error message.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4692 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-21 09:08:52 +00:00
Jean Delvare
5524486161 Add support for hardware monitoring chips on SPI buses.
SPI bus statements in the configuration file are not yet supported, as
SPI buses don't have a name attribute yet, it's not possible to identify
them and thus no substitution is possible.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4689 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-19 15:07:05 +00:00
Jean Delvare
f1cc941e29 Contrary to what the comment says, sensors_proc_bus_count may be a
perfectly valid bus number. We need to use a different value for
chip configuration entries we want to ignore.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4688 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-19 15:05:52 +00:00
Jean Delvare
a74addb5d4 Support more bus types (part 2 of 2). Originally libsensors was very
i2c-centric. Make it more neutral so that we can cleanly support
additional bus types such as SPI or One-Wire.

This second part updates sensors_bus to use sensors_bus_id. Thanks
to Mark M. Hoffman for showing me how the configuration file
parser could be modified to support that change.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4687 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-19 15:04:29 +00:00
Jean Delvare
7ee15371df Support more bus types (part 1 of 2). Originally libsensors was very
i2c-centric. Make it more neutral so that we can cleanly support
additional bus types such as SPI or One-Wire.

This first part introduces sensors_bus_id, and updates
sensors_chip_name to use it.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4686 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-19 15:03:50 +00:00
Jean Delvare
af2880326f Drop chip names including dashes, as these are no longer supported.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4685 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-19 14:18:52 +00:00
Jean Delvare
de4eca1ff7 Fix a broken comment.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4684 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-18 06:58:33 +00:00
Jean Delvare
4695755d89 Drop unneeded frees.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4682 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-17 21:11:57 +00:00
Jean Delvare
557feb2696 Fix error message when a chip is specified on the command line
with no prefix and that chip isn't found.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4681 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-17 11:36:01 +00:00
Jean Delvare
da7fbf5b70 Reindent and cleanup.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4678 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-16 16:18:18 +00:00
Jean Delvare
f430b0991a Chip types can no longer contain dashes. This makes it possible to
rewrite sensors_parse_chip_name() with a simpler algorithm. The new
code is smaller by about one third, and twice as fast on average
(5 times as fast in the most frequent case "foo-*".)

This closes ticket #2221.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4677 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-16 10:06:35 +00:00
Jean Delvare
edb42b3c16 Add a new function to libsensors doing the opposite of
sensors_parse_chip_name(). sensors_snprintf_chip_name() converts
a chip name from its internal representation to a human readable
string. So far, each user program had to reimplement this function.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4676 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-16 10:04:57 +00:00
Jean Delvare
493d9b27f5 Use strtoul() instead of parsing integers on our own.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4675 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-16 09:58:44 +00:00
Jean Delvare
e9fccf7d01 Don't handle the isa bus in sensors_parse_i2cbus_name(). We really
don't need to, as there is a single ISA bus, there's no need for
substituting anything.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4674 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-16 09:57:56 +00:00
Jean Delvare
8896ba3b1f Rename sensors_chip_name.busname to path, as this is what we are using
it for by now.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4673 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-16 09:56:07 +00:00
Jean Delvare
b52225ffc0 Drop support for "dummy" bus type. The kernel no longer supports
such fake i2c buses, so neither should we. Instead, non-i2c buses are
handled explicitly.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4672 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-16 09:54:53 +00:00
Jean Delvare
6bf63e0f7a License fix.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4670 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-15 08:23:38 +00:00
Jean Delvare
3b25c8dc22 Pass structures by reference in sensors and sensord, again for a
small performance gain and better consistency with the new
libsensors API.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4668 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-13 20:19:44 +00:00
Jean Delvare
d9ec11a6c7 Pass the structures by reference inside libsensors. Again a small
performance gain, and this makes the internal code consistent with the
public functions.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4667 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-13 20:16:42 +00:00
Jean Delvare
3bab00fff9 Change the libsensors API so that all structures are passed by
reference. This is more efficient that way.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4666 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-13 20:16:03 +00:00
Hans de Goede
69757bcc20 Add FSC Heimdall, Poseidon II detection, change Poseidon I label from just plain Poseidon to Poseidon I
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4665 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-13 20:11:02 +00:00
Jean Delvare
6a49d8c88a Discard legacy comment.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4663 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-12 19:54:40 +00:00
Jean Delvare
625e4944c5 Add detection of the Winbond W83L786NR/NG/R/G and W83L771W/G chips.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4661 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-12 19:41:33 +00:00
Jean Delvare
a98987dcc6 List the upcoming adt7470 driver.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4656 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-12 16:31:43 +00:00
Jean Delvare
fbdb5dba87 The libsensors test suite doesn't use iconv.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4655 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-12 15:44:35 +00:00
Jean Delvare
e689752228 Don't probe i2c-isa as if it were a regular i2c bus. This bug was
introduced when getting rid of the i2cdetect dependency. I had
forgotten that i2c-isa was not listed in class i2c-dev but was
still listed in class i2c-adapter.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4650 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-10 17:33:43 +00:00
Jean Delvare
1b51800541 Delete sensors_do_all_sets(). I couldn't find any application using it,
and sensors_do_chip_sets() can be used instead if really needed.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4648 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-09 08:43:40 +00:00
Jean Delvare
5fb9a1689f Don't export sensors_chip_name_has_wildcards(). I don't know of any
application using it, and I can't think of any use case for it outside
of libsensors. I'm not even sure if the inside calls are all legitimate.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4647 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-09 08:39:41 +00:00
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