Changeset 2142 for lm-sensors/trunk/doc/developers/applications
- Timestamp:
- 12/08/03 00:44:59 (10 years ago)
- Files:
-
- 1 modified
-
lm-sensors/trunk/doc/developers/applications (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/doc/developers/applications
r1302 r2142 11 11 1) Character device access to the i2c bus driver 12 12 via /dev/i2c-x 13 2) I2C bus access functions as defined in <linux/i2c-dev.h> 14 3) /proc access to the chip device driver 13 2) I2C bus access functions as defined in kernel/include/i2c-dev.h 14 3A) /proc access to the chip device driver 15 3B) sysfs access to the chip device driver 15 16 4) libsensors library 17 5) sensors program 16 18 17 19 … … 27 29 28 30 This method does not use a chip device driver at all. 31 However it does require the i2c-dev module. 29 32 The driver must set an individual chip address on the bus via 30 33 an ioctl, so it must use locking if multiple devices on the … … 38 41 2. Direct /dev access using inline functions 39 42 -------------------------------------------- 40 I2C bus access inline functions as defined in <linux/i2c-dev.h>43 I2C bus access inline functions as defined in kernel/include/i2c-dev.h, 41 44 and in doc/dev-interface in the i2c package or 42 45 Documentation/i2c/dev-interface in the linux kernel sources. 46 Note that these used to be defined in <linux/i2c-dev.h> in the kernel 47 source tree. However, userspace applications are not supposed to 48 include kernel headers, so the inline functions were removed from 49 the kernel file in recent kernels. Use the header file in this package 50 instead. 43 51 44 52 This method does not use a chip device driver at all. 53 However it does require the i2c-dev module. 45 54 The driver must set an individual chip address on the bus via 46 55 an ioctl, so it must use locking if multiple devices on the … … 52 61 53 62 54 3 . /proc access55 --------------- 63 3A. /proc access (2.4 kernels) 64 ----------------------------- 56 65 Chip drivers using the i2c-proc module create subdirectories in 57 66 /proc/sys/dev/sensors which can be accessed directly by applications. 58 67 Naming and content standards for the entries in these subdirectories 59 68 is documented in the file doc/developers/proc. Note that these 60 standards are only loosely followed.69 standards may not be strictly followed. 61 70 62 71 If a new driver adheres to these standards then an application may … … 79 88 For examples of programs using /proc accesses, see 80 89 prog/eeprom/decode-dimms.pl, prog/matorb/displayit.pl, 81 prog/maxilife/writelcd.sh, prog/rrd/sens_update_rrd. 90 prog/maxilife/writelcd.sh, prog/rrd/sens_update_rrd, 91 prog/pwm/fancontrol, and prog/pwm/pwmconfig. 82 92 Also search freshmeat for sensors applications. 93 94 95 3B. sysfs access (2.6 kernels) 96 ------------------------------ 97 Chip drivers using the i2c-sensor module create subdirectories in 98 the sysfs filesystem (usually /sys) which can be accessed 99 directly by applications. 100 Naming and content standards for the entries in these subdirectories 101 is documented in the file Documentation/i2c/sysfs-interface in the 102 2.6 kernel source tree. Note that these standards may not be 103 strictly followed. 104 105 If a new driver adheres to these standards then an application may 106 be able to support new devices on-the-fly. 107 108 sysfs access provides a method to read and write sensor values 109 for any driver using i2c-sensor, including ISA chip drivers. 110 111 This method may also works well for shell and perl scripts 112 written to access a specific device. Note that sysfs is 113 standard in 2.6 kernels. 114 115 Note that most drivers provide only raw sensor readings via /sys; 116 many readings must be scaled or adjusted, and these adjustments 117 must often be changed by the user. An application using /proc must 118 generally provide adjustment facilities and the requirements 119 of the adjustments can be quite complex. If you need adjustment 120 facilities, consider the libsensors library, below. 121 122 For an examples of a program using /sys accesses, see gkrellm. 123 See also lib/proc.c and prog/dump/i2cbusses.c for examples. 124 The sysfsutils package may also be helpful. 125 Also search freshmeat for sensors and sysfs applications. 83 126 84 127 … … 90 133 provided by the user. Other facilities are sensor renaming, limit setting, 91 134 and ignoring individual sensors. 135 The libsensors library supports both 2.4 and 2.6 kernels. 92 136 93 Unfortunately there is nodocumentation for libsensors. See the137 Unfortunately there is little documentation for libsensors. See the 94 138 'sensors' application in prog/sensors for an example. The source 95 139 for libsensors is in the lib/ directory. Another example … … 104 148 does not fall under the GPL. This may or may not be changed in the future. 105 149 Contact us if you wish to discuss your application. 150 151 For an examples of a program using libsensors accesses, see 152 prog/sensors/sensors. Also search freshmeat for sensors applications. 153 154 5. sensors program 155 ------------------ 156 The 'sensors' program is a text-based application that uses libsensors. 157 The output is fairly standardized; therefore this output could be 158 used by other applications. 159 One simple method is 'sensors|grep ALARM'.
