summaryrefslogtreecommitdiff
path: root/lib/access.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Add support for hardware monitoring chips on SPI buses.Jean Delvare2007-08-191-0/+4
| | | | | | | | | 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
* Support more bus types (part 2 of 2). Originally libsensors was veryJean Delvare2007-08-191-1/+2
| | | | | | | | | | | | 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
* Support more bus types (part 1 of 2). Originally libsensors was veryJean Delvare2007-08-191-21/+20
| | | | | | | | | | | 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
* Add a new function to libsensors doing the opposite ofJean Delvare2007-08-161-1/+1
| | | | | | | | | 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
* Rename sensors_chip_name.busname to path, as this is what we are usingJean Delvare2007-08-161-1/+1
| | | | | | | 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
* Drop support for "dummy" bus type. The kernel no longer supportsJean Delvare2007-08-161-2/+0
| | | | | | | | 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
* Pass the structures by reference inside libsensors. Again a smallJean Delvare2007-08-131-28/+29
| | | | | | | | 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
* Change the libsensors API so that all structures are passed byJean Delvare2007-08-131-45/+48
| | | | | | | 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
* Delete sensors_do_all_sets(). I couldn't find any application using it,Jean Delvare2007-08-091-12/+0
| | | | | | | 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
* Don't export sensors_chip_name_has_wildcards(). I don't know of anyJean Delvare2007-08-091-1/+1
| | | | | | | | 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
* Now that sensors_get_ignored() is an internal function, we can changeJean Delvare2007-07-241-23/+18
| | | | | | | | | | | | 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
* Let libsensors handle ignore statements by itself, rather thanJean Delvare2007-07-241-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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
* The way we build the feature lists guarantees that subfeatures alwaysJean Delvare2007-07-241-17/+4
| | | | | | | | | | | | | | | | | 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
* Speed up sensors_get_ignored() a bit. We can return as soon as an ignoreJean Delvare2007-07-221-10/+7
| | | | | | | 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
* Discard devices with zero feature.Jean Delvare2007-07-211-2/+0
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4637 7894878c-1315-0410-8ee3-d5d059ff63e0
* Minor optimizations to sensors_feature_get_type():Jean Delvare2007-07-191-15/+8
| | | | | | | | | * 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
* Now that sensors_feature_get_type() is an internal function, we canJean Delvare2007-07-191-9/+11
| | | | | | | | | | | | | | | | | | | | 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
* Move sensors_proc_read and sensors_proc_write to sysfs.c, and rename themJean Delvare2007-07-051-3/+3
| | | | | | | 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
* Add support for foo#_label sysfs filesHans de Goede2007-07-041-7/+23
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4550 7894878c-1315-0410-8ee3-d5d059ff63e0
* Add some more warning flags, and fix these warnings.Jean Delvare2007-07-031-17/+23
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4545 7894878c-1315-0410-8ee3-d5d059ff63e0
* Make a few libsensors functions static.Jean Delvare2007-07-031-6/+10
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4544 7894878c-1315-0410-8ee3-d5d059ff63e0
* Drop VRM reporting and selection support from libsensors. Since kernelJean Delvare2007-07-031-4/+0
| | | | | | | | 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
* Use sscanf instead of regex to match the feature names. This is much faster.Jean Delvare2007-07-031-28/+15
| | | | | | | | 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
* There are no sensor* sysfs files.Jean Delvare2007-06-291-2/+6
| | | | | | | 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
* Drop two unused macros.Jean Delvare2007-06-291-5/+0
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4519 7894878c-1315-0410-8ee3-d5d059ff63e0
* We no longer need alternative sysfs file names and magnitudes, as they areJean Delvare2007-06-281-10/+3
| | | | | | | 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
* With the new dynamic chip features enumeration code, the sensors_proc_chipsJean Delvare2007-06-281-10/+10
| | | | | | | | | | | | 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
* Use complete chip names (prefix + bus + address) as the keys ofJean Delvare2007-06-281-17/+17
| | | | | | | | | 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
* struct sensors_proc_chips_entry now has a single member, so we mayJean Delvare2007-06-261-1/+1
| | | | | | | 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
* Delete all remnants of algorithm names.Jean Delvare2007-06-251-6/+0
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4465 7894878c-1315-0410-8ee3-d5d059ff63e0
* Drop SENSORS_FEATURE_TEMP_OVER, SENSORS_FEATURE_TEMP_HIGH andJean Delvare2007-05-291-2/+0
| | | | | | | | 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
* Fixes to the dynamic chip support:Jean Delvare2007-05-281-1/+5
| | | | | | | | | | * 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
* -rewrite dyn chip code, it now uses sensors_feature_get_type() toHans de Goede2007-04-101-12/+11
| | | | | | | | | | | | | | | | | 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
* -comment abituguru entry in lib/chips.c and prog/sensors/main.c, as theHans de Goede2007-04-091-1/+1
| | | | | | | | | | | | | | | | | | 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
* Generic chip support / get featuretype fixes just received from Bob ↵Hans de Goede2007-04-091-58/+95
| | | | | | 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
* Some fixes for problems with the dyn chip support / generic printing ↵Hans de Goede2007-04-091-0/+6
| | | | | | routines which showed up while testing with the abituguru driver git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4364 7894878c-1315-0410-8ee3-d5d059ff63e0
* add sensors_feature_get_type method, by Bob Schlarmann and Luuk KleiwegHans de Goede2007-04-091-0/+64
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4360 7894878c-1315-0410-8ee3-d5d059ff63e0
* The sensors library relied on one structure having an identical layout inMark M. Hoffman2007-01-091-33/+32
| | | | | | | | | | | | | | | | | | | | memory as part of another structure. This rather large patch fixes that by making the smaller piece an explicit member of the larger. I brought this patch into sync with the latest SVN, and tested it by comparing objects files from the tree pre- and post- patch. The remaining 99% of the credit goes to Bob Schlärmann <bob2@dsv.nl> for creating the original patch... thanks Bob! * Bob Schlärmann <bob2@dsv.nl> [2006-12-24 18:29:39 +0100]: > The following patch changes all of the lib/chips.c entries and any function > that uses sensors_chip_feature. Most of the conversion was done through a > perl script, so if you don't agree with the syntax it'll be easy to change. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4287 7894878c-1315-0410-8ee3-d5d059ff63e0
* Better parse error messages.Jean Delvare2006-12-211-2/+2
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4266 7894878c-1315-0410-8ee3-d5d059ff63e0
* Add support for the w83627dhg. Original patch by David Holl.Jean Delvare2006-12-181-0/+2
| | | | | | | This closes ticket #2157. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4264 7894878c-1315-0410-8ee3-d5d059ff63e0
* libsensors: Drop support for algorithm names.Jean Delvare2006-10-131-12/+2
| | | | | | | | | | 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
* Add PCI bus supportRudolf Marek2006-08-191-0/+8
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4098 7894878c-1315-0410-8ee3-d5d059ff63e0
* Reformat of lib/access.c:Mark M. Hoffman2006-07-251-350/+372
| | | | | | | | | | | First ran .../scripts/Lindent from Linux 2.6.x, then fixed up some things that were particularly ugly. Verified the final result by rebuilding and running 'objdump -d' on the before and after; there were no differences. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4073 7894878c-1315-0410-8ee3-d5d059ff63e0
* Remove a workaround for sysfs support that is no longer needed.Mark M. Hoffman2005-10-011-7/+0
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3113 7894878c-1315-0410-8ee3-d5d059ff63e0
* (mmh)Mark M. Hoffman2005-09-181-1/+2
| | | | | | | | | | | | | 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
* Declare foundsysfs in proc.h.Jean Delvare2005-09-101-2/+0
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3080 7894878c-1315-0410-8ee3-d5d059ff63e0
* Fix memory leak in sensors_get_label(). Reported by John Naylon.Jean Delvare2005-07-151-17/+6
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3031 7894878c-1315-0410-8ee3-d5d059ff63e0
* Fix a bug in libsensors which caused some failed feature writesJean Delvare2004-09-191-3/+3
| | | | | | | | | ("set lines") to go unnoticed. lm78's fan3_div (which is read-only but stored in a R/W file in procfs) was one of them. Make sensors' error message in this case more explicit. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2692 7894878c-1315-0410-8ee3-d5d059ff63e0
* Patch by Philipp Thomas <pth@suse.de>:Mark M. Hoffman2004-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | > Current gcc versions warn when type punning is used, as this breaks the > strict aliasing analysis gcc 3.3 does by default. When checking the causes > for these warnings I discovered that sensors_malloc_array, > sensors_free_array, sensors_add_array_el and sensors_add_array_els in > lib/general.c all take a 'void **' for the list. This is plain wrong as > the C standard only allow 'char *' and 'void *' to alias any other type, so > if these functions should take a generic pointer, it *must* be a 'void *' > that's internally cast to a 'void **'. > > The attached patch does this and adapts all places where these functions are > called. Note that when done correctly, no cast what-so-ever in the calling > code is needed. > > The patch is against current lm_sensors2 cvs version. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2345 7894878c-1315-0410-8ee3-d5d059ff63e0
* retrieve i2c adapter name from sysfsMark D. Studebaker2003-11-161-6/+0
| | | | git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2060 7894878c-1315-0410-8ee3-d5d059ff63e0