summaryrefslogtreecommitdiff
path: root/lib/access.c
Commit message (Collapse)AuthorAgeFilesLines
* libsensors: Add support for SENSORS_BUS_TYPE_SCSIGuenter Roeck2018-08-111-0/+2
| | | | | | | Upcoming kernel drivers may add SCSI bus based sensors. Add support for it to libsensors. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* Add support for MDIO bussesAndrew Lunn2017-07-081-0/+2
| | | | | | | | | | | | 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>
* libsensors: Fix sparse warningsJean Delvare2015-05-151-3/+3
| | | | | | | | 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.
* Update my e-mail address and copyright yearsJean Delvare2014-03-201-1/+1
|
* Change libsensors license from GPL to LGPL.Jean Delvare2010-07-011-6/+6
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5844 7894878c-1315-0410-8ee3-d5d059ff63e0
* Add support for HID devices.Jean Delvare2009-10-181-0/+4
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5786 7894878c-1315-0410-8ee3-d5d059ff63e0
* sensors_get_label: Merge pathname and label buffers (patch fromJean Delvare2009-06-301-4/+4
| | | | | | | | | | 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
* Consolidate strdup calls in sensors_get_label (patch from George Spelvin).Jean Delvare2009-06-301-3/+4
| | | | | | | | | 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
* Use __func__ in sensors_fatal_error() to get function name.Andre Prendel2009-03-021-2/+1
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5674 7894878c-1315-0410-8ee3-d5d059ff63e0
* Include the configuration file name when reporting parse errors.Jean Delvare2009-02-151-4/+7
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5649 7894878c-1315-0410-8ee3-d5d059ff63e0
* Keep track of configuration file names so that we can later generateJean Delvare2009-02-151-3/+3
| | | | | | | better error reports. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5648 7894878c-1315-0410-8ee3-d5d059ff63e0
* Fix inclusion of general.h.Jean Delvare2009-02-111-1/+0
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5639 7894878c-1315-0410-8ee3-d5d059ff63e0
* Add ACPI busHans de Goede2009-01-131-0/+2
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5593 7894878c-1315-0410-8ee3-d5d059ff63e0
* Detect excessive recursion depth during expression evaluation.Jean Delvare2009-01-111-12/+26
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5582 7894878c-1315-0410-8ee3-d5d059ff63e0
* Fix error propagation during expression evaluation.Jean Delvare2009-01-111-4/+2
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5581 7894878c-1315-0410-8ee3-d5d059ff63e0
* Add support for virtual hwmon devices. This closes Red Hat bug #437637Jean Delvare2008-04-141-0/+2
| | | | | | | and ticket #2305. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5176 7894878c-1315-0410-8ee3-d5d059ff63e0
* We start at the end of the chip list, going backwards, and we want theJean Delvare2008-04-111-2/+4
| | | | | | | | | | | late compute statements to override the early ones (as documented in the sensors.conf manual page), so we must stop as soon as any match is found. This fixes Debian bug #474596: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=474596 git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5175 7894878c-1315-0410-8ee3-d5d059ff63e0
* Patch from Aurelien Jarno:Jean Delvare2008-03-261-1/+2
| | | | | | | | 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
* Returned error values are supposed to be negative.Jean Delvare2007-12-181-2/+2
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5077 7894878c-1315-0410-8ee3-d5d059ff63e0
* Preserve error values returned by sensors_read_sysfs_attr() andJean Delvare2007-09-231-5/+4
| | | | | | | sensors_write_sysfs_attr(). git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4851 7894878c-1315-0410-8ee3-d5d059ff63e0
* New public library function: sensors_get_subfeature(). Applications canJean Delvare2007-09-231-0/+19
| | | | | | | | | use it to retrieve a specific subfeature by type. While it is slighly less efficient than looping over sensors_get_all_subfeatures(), it often makes the application code much more elegant. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4846 7894878c-1315-0410-8ee3-d5d059ff63e0
* Use sensors_lookup_chip() wherever possible, it makes the codeJean Delvare2007-09-231-24/+20
| | | | | | | more readable. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4845 7894878c-1315-0410-8ee3-d5d059ff63e0
* Use sensors_lookup_chip() to speed up sensors_lookup_subfeature_name()Jean Delvare2007-09-231-23/+25
| | | | | | | as well. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4844 7894878c-1315-0410-8ee3-d5d059ff63e0
* New internal library function: sensors_lookup_chip(). It looks up aJean Delvare2007-09-231-27/+38
| | | | | | | | | | chip in the detected chip list. It is more efficient to do it once and for all than to do it over and over again in sensors_lookup_feature_nr() and sensors_lookup_subfeature_nr() as was done before. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4843 7894878c-1315-0410-8ee3-d5d059ff63e0
* sensors_lookup_subfeature_nr() can now be made static.Jean Delvare2007-09-231-1/+1
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4842 7894878c-1315-0410-8ee3-d5d059ff63e0
* Pass a subfeature structure to sensors_read_sysfs_attr() andJean Delvare2007-09-231-2/+2
| | | | | | | | sensors_write_sysfs_attr(), rather than a subfeature number, so that we do not have to lookup the feature number again. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4841 7894878c-1315-0410-8ee3-d5d059ff63e0
* There's no rationale for preventing against setting the sameJean Delvare2007-09-231-18/+3
| | | | | | | | subfeature value several times. If the user asks for that, let's just do it. Otherwise we have a performance penalty for all other users. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4840 7894878c-1315-0410-8ee3-d5d059ff63e0
* We can plain skip the feature lookup and compute statement search forJean Delvare2007-09-231-28/+33
| | | | | | | subfeatures with no compute mapping. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4839 7894878c-1315-0410-8ee3-d5d059ff63e0
* Introduce a separate type for main features. Make subfeatures map toJean Delvare2007-09-231-20/+30
| | | | | | | the real main feature rather than the first subfeature. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4838 7894878c-1315-0410-8ee3-d5d059ff63e0
* Update the comments and symbols in the whole library code to refer toJean Delvare2007-09-231-41/+44
| | | | | | | features and subfeatures as appropriate. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4836 7894878c-1315-0410-8ee3-d5d059ff63e0
* sensors_get_all_features has a single caller now, so foldJean Delvare2007-09-231-23/+12
| | | | | | | it thereinto. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4835 7894878c-1315-0410-8ee3-d5d059ff63e0
* Define a separate structure to represent main features. This allowsJean Delvare2007-09-231-36/+28
| | | | | | | | | | 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
* Rename struct sensors_feature_data to sensors_subfeature. This is aJean Delvare2007-09-231-28/+28
| | | | | | | | 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
* Split sensors_get_all_features() into two distinct functions, one toJean Delvare2007-09-231-3/+32
| | | | | | | | | | | get the list of all main features, and one to get the list of all the subfeatures of a given main feature. This is a more logical interface for applications to use. The current implementation is admittedly less than optimal, because the storage structures weren't meant for it, but this issue can (and will) be addressed later. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4831 7894878c-1315-0410-8ee3-d5d059ff63e0
* sensors_feature_data and sensors_chip_feature are now the exactJean Delvare2007-09-231-32/+32
| | | | | | | 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
* Make sensors.conf entirely case-sensitive.Mark M. Hoffman2007-09-161-9/+9
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4796 7894878c-1315-0410-8ee3-d5d059ff63e0
* Move sensors_feature_get_type() from access.c to sysfs.c, it's only calledJean Delvare2007-09-051-90/+0
| | | | | | | from this file. This lets the compiler do additional optimizations. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4776 7894878c-1315-0410-8ee3-d5d059ff63e0
* Add support for temperature offset files, which are part of theJean Delvare2007-09-051-0/+1
| | | | | | | | | | | | | standard sysfs interface. I don't think it makes much sense to display the offset values as part of the output of "sensors" (it would even probably confuse people) but having support for these in libsensors makes it possible to adjust the offsets in sensors.conf, which is convenient. This closes ticket #2248. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4769 7894878c-1315-0410-8ee3-d5d059ff63e0
* Add support for the standard beep_enable attribute (#2248).Jean Delvare2007-09-051-0/+6
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4766 7894878c-1315-0410-8ee3-d5d059ff63e0
* Store the feature list length separately instead of null-terminatingJean Delvare2007-09-051-3/+6
| | | | | | | | 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
* Renumber the features linearly, so that feature number N is atJean Delvare2007-09-051-6/+2
| | | | | | | | | | position N in the array. This allows for O(1) look-ups, as opposed to O(N) before. This makes sensors_lookup_feature_nr() 2.4 times faster in my real-world tests, resulting in a 6% performance boost on average in the runtime part of "sensors". git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4759 7894878c-1315-0410-8ee3-d5d059ff63e0
* The compute mapping value is either SENSORS_NO_MAPPING or the sameJean Delvare2007-09-051-9/+9
| | | | | | | | | | feature number as the logical mapping. This means that the compute mapping can be turned into a simple boolean flag. Doing so makes struct sensors_feature_data smaller, which saves some memory (about 17 kB in my tests.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4758 7894878c-1315-0410-8ee3-d5d059ff63e0
* Rename sensors_feature_data.mode to flags, as we plan to use it toJean Delvare2007-09-051-2/+2
| | | | | | | store non-mode flags soon. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4757 7894878c-1315-0410-8ee3-d5d059ff63e0
* Mass reindent, coding style and whitespace cleanups.Jean Delvare2007-08-311-3/+3
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4736 7894878c-1315-0410-8ee3-d5d059ff63e0
* Rename SENSORS_FEATURE_TEMP_SENS to SENSORS_FEATURE_TEMP_TYPE. ThisJean Delvare2007-08-291-1/+1
| | | | | | | better reflects what this feature is, in line with the sysfs file name. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4730 7894878c-1315-0410-8ee3-d5d059ff63e0
* Looking up a mapping can't fail if looking up the feature itselfJean Delvare2007-08-291-6/+10
| | | | | | | succeeded (or that would be a bug in the library code.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4729 7894878c-1315-0410-8ee3-d5d059ff63e0
* Make sensors_match_chip internal to libsensors. It is no longer used byJean Delvare2007-08-261-1/+1
| | | | | | | applications in practice. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4702 7894878c-1315-0410-8ee3-d5d059ff63e0
* Add a parameter to sensors_get_detected_chips(), to optionally let theJean Delvare2007-08-261-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | 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
* sensors_get_value() and sensors_set_value(), respectively.Jean Delvare2007-08-221-6/+6
| | | | | | | 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
* Change the prototype of sensors_get_label(). Errors can be reportedJean Delvare2007-08-221-11/+11
| | | | | | | 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