Commit Graph
39 Commits
Author SHA1 Message Date
Jean Delvare 9fcfb654af The free_expr() function is no longer static in lib/init.c (it is also
used in lib/conf-parse.y), and therefore must be renamed according to
the libsensors naming conventions.
Based on an original patch from Sergey Vlasov.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5302 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-07-14 16:21:48 +00:00
Jean Delvare 399410079f The configuration file is currently parsed in the locale set by the main
program using the library. This means that if the decimal separator
(defined in LC_NUMERIC) is not '.' the values in the compute lines are
truncated. This happens for example with sensors-applet and a French
locale.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=469333

Parsing the configuration file in C locale fixes the problem.
Original patch from Aurelien Jarno.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5169 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-04-08 14:50:13 +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
Jean Delvare 35a5a7dbce Use /etc/sensors3.conf as the default configuration file. If it can't
be found, fallback to /etc/sensors.conf. This allows for an old
libsensors and a new libsensors to be installed in parallel, and each
one has its own configuration file.

One important change here is that the default configuration file will
be installed as /etc/sensors3.conf by "make install".


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4990 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-10-25 09:59:05 +00:00
Jean Delvare de00b0aad4 Make the configuration file optional. Although in most cases it's not
very useful to use libsensors without a configuration file, I fail to
see the rationale for making a configuration file mandatory.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4989 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-10-25 09:52:46 +00:00
Jean Delvare 58b3284058 Clean up if something goes wrong during initialization. Otherwise
we're leaking memory.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4988 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-10-25 09:51:19 +00:00
Jean Delvare fb920578a9 Let libsensors know the default path to its configuration file.
That way, applications no longer have to care.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4985 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-10-25 09:48:18 +00:00
Jean Delvare 647b47cb6a Add my copyright everywhere it is missing.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4902 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-29 19:18:15 +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 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 5dec68540f Warning fix.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4778 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 20:10:00 +00:00
Jean Delvare 6b3803c386 Fix memory leaks in the configuration file parser when a label, set,
compute or ignore statement is found before the first chip statement.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4768 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 12:30:39 +00:00
Jean Delvare 23f4274010 Store the feature list length separately instead of null-terminating
the list. This make it possible to check for out-of-bound indexes
without walking the entire list, so that direct look-ups are safer.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4760 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 08:19:42 +00:00
Jean Delvare 27200afa1d Reorder functions so that forward declarations are no longer needed.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4737 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-31 15:09:26 +00:00
Jean Delvare a82c6b0476 Mass reindent, coding style and whitespace cleanups.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4736 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-31 14:42:20 +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 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 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 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 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 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 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 6270cf381a libsensors: Drop support for algorithm names.
I2C algorithms no longer have names in Linux 2.6, and anyway they are
implementation details user-space doesn't care about. No third party
application is known to have ever used this particular feature of
libsensors. "sensord" and "sensors" no longer do.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4208 7894878c-1315-0410-8ee3-d5d059ff63e0
2006-10-13 19:55:41 +00:00
Jean Delvare bf96a279b8 libsensors: Probe for busses before chips. This makes more sense that way,
and may allow for cleanups later.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4198 7894878c-1315-0410-8ee3-d5d059ff63e0
2006-10-08 15:45:15 +00:00
Mark M. Hoffman 4d2c4fd212 Previous leak fix caused multiple sensors_init() calls to break.
This patch fixes that by managing the scanner buffers manually.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3300 7894878c-1315-0410-8ee3-d5d059ff63e0
2006-05-20 15:24:37 +00:00
Mark M. Hoffman e620cb652c fix 2 leaks found by valgrind - missing some free() during cleanup
(as opposed to ongoing run-time leaks)


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3293 7894878c-1315-0410-8ee3-d5d059ff63e0
2006-05-15 03:06:05 +00:00
Mark M. Hoffman 85a0c8ccb2 (mmh)
This patch replaces the I2C chip enumeration (through sysfs) in lib/proc.c
with new functions in lib/sysfs (using libsysfs).  The patch also updates
the init code accordingly.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3095 7894878c-1315-0410-8ee3-d5d059ff63e0
2005-09-18 20:38:19 +00:00
Mark M. Hoffman c277761d15 (mmh)
This patch replaces the I2C bus enumeration (through sysfs) in lib/proc.c
with a new function in lib/sysfs (using libsysfs).  The patch also updates
the init code accordingly.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3094 7894878c-1315-0410-8ee3-d5d059ff63e0
2005-09-18 20:37:42 +00:00
Mark M. Hoffman 87fba1c487 (mmh)
This patch adds the files lib/sysfs.h and lib/sysfs.c, beginning with a rewrite
of the sysfs detection code (using libsyfs).  In the process, I replaced two
poorly named globals with better names, and moved them to sysfs.c.  The sysfs
detection now happens very early during library init, rather than later.

The long term plan is for the two global variables to disappear anyway, as
everything to do with sysfs should get moved into lib/sysfs.c.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3093 7894878c-1315-0410-8ee3-d5d059ff63e0
2005-09-18 20:30:44 +00:00
Jean Delvare 44ff677255 Fix memory leak.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2088 7894878c-1315-0410-8ee3-d5d059ff63e0
2003-11-23 21:20:57 +00:00
Frodo Looijaard 8199abde46 New sensors.conf keyword 'ignore'
This often-asked for, long-planned and somewhat-forgotten feature
makes it possible to tell libsensors-linked applications (like
the sensors program) that certain features should not be displayed.
This is very nice for things like unconnected temperature sensors
or fans.

Modifications to the library code, to the sensors program and to
the documentation and example sensors.conf file.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@676 7894878c-1315-0410-8ee3-d5d059ff63e0
1999-12-24 22:44:41 +00:00
Frodo Looijaard 24792039f6 Adrian's copyright patch applied
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@207 7894878c-1315-0410-8ee3-d5d059ff63e0
1999-02-08 22:50:29 +00:00
Frodo Looijaard faa996f454 Moved some library functions around, to put them in more logical files.
No external changes.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@119 7894878c-1315-0410-8ee3-d5d059ff63e0
1998-12-25 21:51:59 +00:00
Frodo Looijaard 1c12665831 Expanded expressions, slightly new syntax
An expression can now refer to the value it has to compute (@), but also to
other values. This is now perfectly valid as an expression:
  vid + in_min - in_max * 2 / @
Not that this is very sensible, but you get the idea. Please install the
new example config file, or replace all old 'val' occurences with '@'.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@107 7894878c-1315-0410-8ee3-d5d059ff63e0
1998-12-24 01:13:44 +00:00
Frodo Looijaard 849acbe439 More libary stuff
The bus translation functions.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@101 7894878c-1315-0410-8ee3-d5d059ff63e0
1998-12-22 01:25:25 +00:00
Frodo Looijaard f26b52021b More library extensions
Most notably, config file line numbers are now stored, so we can now generate
better error messages.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@98 7894878c-1315-0410-8ee3-d5d059ff63e0
1998-12-21 14:14:25 +00:00
Frodo Looijaard 1779b684c1 More library stuff
Nice init and cleanup functions.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@97 7894878c-1315-0410-8ee3-d5d059ff63e0
1998-12-20 21:57:39 +00:00