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