root/i2c-tools/trunk/tools/i2cset.8

Revision 5911, 3.9 KB (checked in by groeck, 13 months ago)

Added support to write SMBus and I2C block commands to i2cset

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1.TH I2CSET 8 "November 2008"
2.SH "NAME"
3i2cset \- set I2C registers
4
5.SH SYNOPSIS
6.B i2cset
7.RB [ -f ]
8.RB [ -y ]
9.RB [ "-m mask" ]
10.RB [ -r ]
11.I i2cbus
12.I chip-address
13.I data-address
14.RI [ value ]
15.RI ...
16.RI [ mode ]
17.br
18.B i2cset
19.B -V
20
21.SH DESCRIPTION
22i2cset is a small helper program to set registers visible through the I2C
23bus.
24
25.SH OPTIONS
26.TP
27.B -V
28Display the version and exit.
29.TP
30.B -f
31Force access to the device even if it is already busy. By default, i2cset
32will refuse to access a device which is already under the control of a
33kernel driver. Using this flag is dangerous, it can seriously confuse the
34kernel driver in question. It can also cause i2cset to silently write to
35the wrong register. So use at your own risk and only if you know what
36you're doing.
37.TP
38.B -y
39Disable interactive mode. By default, i2cset will wait for a confirmation
40from the user before messing with the I2C bus. When this flag is used, it
41will perform the operation directly. This is mainly meant to be used in
42scripts.
43.TP
44.B -m mask
45The \fImask\fR parameter, if specified, describes which bits of \fIvalue\fR
46will be actually written to \fIdata-address\fR. Bits set to 1 in the mask
47are taken from \fIvalue\fR, while bits set to 0 will be read from
48\fIdata-address\fR and thus preserved by the operation. Please note that
49this parameter assumes that the read and write operations for the specified
50mode are symmetrical for the device you are accessing. This may or may not
51be the case, as neither I2C nor SMBus guarantees this.
52.TP
53.B -r
54Read back the value right after writing it, and compare the result with the
55value written. This used to be the default behavior. The same limitations
56apply as those of option \fB-m\fR.
57.PP
58There are three required options to i2cset. \fIi2cbus\fR indicates the number
59or name of the I2C bus to be scanned.  This number should correspond to one of
60the busses listed by \fIi2cdetect -l\fR. \fIchip-address\fR specifies the
61address of the chip on that bus, and is an integer between 0x03 and 0x77.
62\fIdata-address\fR specifies the address on that chip to write to, and is an
63integer between 0x00 and 0xFF.
64.PP
65The \fIvalue\fR parameter, if specified, is the value to write to that
66location on the chip. If this parameter is omitted, then a short write is
67issued. For most chips, it simply sets an internal pointer to the target
68location, but doesn't actually write to that location. For a few chips
69though, in particular simple ones with a single register, this short write
70is an actual write. If the mode parameter is \fBs\fP or \fBi\fP, multiple
71values can be specified.
72.PP
73The \fImode\fR parameter, if specified, is one of the letters \fBb\fP,
74\fBw\fP, \fBs\fP, or \fBi\fP, corresponding to a write size of a single byte,
75a 16-bit word, a SMBus block write, or an I2C block write, respectively.
76For SMBus and I2C block writes, the write size is determined by the number
77of \fIvalue\fR parameters.
78Except for I2C block writes, a \fBp\fP can also be appended to the \fImode\fR
79parameter to enable PEC.
80If the \fImode\fR parameter is omitted, i2cset defaults to byte
81mode without PEC. The \fIvalue\fR provided must be within range for the
82specified data type (0x00-0xFF for byte and block writes, 0x0000-0xFFFF
83for words).
84Another possible mode is \fBc\fP, which doesn't write any value (so-called
85short write). You usually don't have to specify this mode, as it is the
86default when no value is provided, unless you also want to enable PEC.
87
88.SH WARNING
89i2cset can be extremely dangerous if used improperly. It can confuse your
90I2C bus, cause data loss, or have more serious side effects. Writing to
91a serial EEPROM on a memory DIMM (chip addresses between 0x50 and 0x57) may
92DESTROY your memory, leaving your system unbootable!  Be extremely careful
93using this program.
94
95.SH SEE ALSO
96i2cdump(8), isaset(8)
97
98.SH AUTHOR
99Frodo Looijaard, Mark D. Studebaker and Jean Delvare
100
101This manual page was originally written by David Z Maze <dmaze@debian.org> for
102the Debian GNU/Linux system.
Note: See TracBrowser for help on using the browser.