Changeset 5390
- Timestamp:
- 11/20/08 09:22:18 (5 years ago)
- Location:
- i2c-tools/trunk
- Files:
-
- 3 modified
-
CHANGES (modified) (1 diff)
-
tools/i2cset.8 (modified) (4 diffs)
-
tools/i2cset.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
i2c-tools/trunk/CHANGES
r5388 r5390 23 23 Add support for short writes (SMBus send byte) 24 24 Better error message on missing adapter functionality 25 Set the data value mask with -m 25 26 i2c-stub-from-dump: Add support for partial dumps 26 27 Report if only garbage is found in dump file -
i2c-tools/trunk/tools/i2cset.8
r5237 r5390 1 .TH I2CSET 8 " May2008"1 .TH I2CSET 8 "November 2008" 2 2 .SH "NAME" 3 3 i2cset \- set I2C registers … … 7 7 .RB [ -f ] 8 8 .RB [ -y ] 9 .RB [ "-m mask" ] 9 10 .I i2cbus 10 11 .I chip-address 11 12 .I data-address 12 .RI [ "value " [ "mode " [ mask ]]]13 .RI [ "value " [ "mode" ]] 13 14 .br 14 15 .B i2cset … … 37 38 will perform the operation directly. This is mainly meant to be used in 38 39 scripts. 40 .TP 41 .B -m mask 42 The \fImask\fR parameter, if specified, describes which bits of \fIvalue\fR 43 will be actually written to \fIdata-address\fR. Bits set to 1 in the mask 44 are taken from \fIvalue\fR, while bits set to 0 will be read from 45 \fIdata-address\fR and thus preserved by the operation. 39 46 .PP 40 47 There are three required options to i2cset. \fIi2cbus\fR indicates the number … … 58 65 mode without PEC. The \fIvalue\fR provided must be within range for the 59 66 specified data type (0x00-0xFF for bytes, 0x0000-0xFFFF for words). 60 .PP61 The \fImask\fR parameter, if specified, describes which bits of \fIvalue\fR62 will be actually written to \fIdata-address\fR. Bits set to 1 in the mask63 are taken from \fIvalue\fR, while bits set to 0 will be read from64 \fIdata-address\fR and thus preserved by the operation.65 67 66 68 .SH WARNING -
i2c-tools/trunk/tools/i2cset.c
r5242 r5390 36 36 { 37 37 fprintf(stderr, 38 "Usage: i2cset [-f] [-y] I2CBUS CHIP-ADDRESS DATA-ADDRESS [VALUE [MODE [MASK]]]\n"38 "Usage: i2cset [-f] [-y] [-m MASK] I2CBUS CHIP-ADDRESS DATA-ADDRESS [VALUE [MODE]]\n" 39 39 " I2CBUS is an integer or an I2C bus name\n" 40 40 " ADDRESS is an integer (0x03 - 0x77)\n" … … 129 129 { 130 130 char *end; 131 const char *maskp = NULL; 131 132 int res, i2cbus, address, size, file; 132 133 int value, daddress, vmask = 0; … … 142 143 case 'f': force = 1; break; 143 144 case 'y': yes = 1; break; 145 case 'm': 146 if (2+flags < argc) 147 maskp = argv[2+flags]; 148 flags++; 149 break; 144 150 default: 145 151 fprintf(stderr, "Error: Unsupported option " … … 196 202 } 197 203 204 /* Old method to provide the value mask, deprecated and no longer 205 documented but still supported for compatibility */ 198 206 if (argc > flags + 6) { 199 vmask = strtol(argv[flags+6], &end, 0); 207 if (maskp) { 208 fprintf(stderr, "Error: Data value mask provided twice!\n"); 209 help(); 210 } 211 fprintf(stderr, "Warning: Using deprecated way to set the data value mask!\n"); 212 fprintf(stderr, " Please switch to using -m.\n"); 213 maskp = argv[flags+6]; 214 } 215 216 if (maskp && size != I2C_SMBUS_BYTE) { 217 vmask = strtol(maskp, &end, 0); 200 218 if (*end || vmask == 0) { 201 219 fprintf(stderr, "Error: Data value mask invalid!\n");
