Changeset 4431
- Timestamp:
- 06/04/07 19:54:46 (6 years ago)
- Location:
- lm-sensors/branches/lm-sensors-3.0.0
- Files:
-
- 9 modified
-
CHANGES (modified) (1 diff)
-
prog/dump/i2cbusses.c (modified) (1 diff)
-
prog/dump/i2cbusses.h (modified) (1 diff)
-
prog/dump/i2cdump.8 (modified) (3 diffs)
-
prog/dump/i2cdump.c (modified) (4 diffs)
-
prog/dump/i2cget.8 (modified) (3 diffs)
-
prog/dump/i2cget.c (modified) (5 diffs)
-
prog/dump/i2cset.8 (modified) (3 diffs)
-
prog/dump/i2cset.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/branches/lm-sensors-3.0.0/CHANGES
r4421 r4431 15 15 Delete support of non-sensor drivers (ddcmon, eeprom) 16 16 Man page sensors.conf.5: Update the chip statement section 17 Programs i2cdump, i2cget, i2cset: Do not force the slave address by default 17 18 Program i2cdump: Use the new I2C block read function 18 19 Program isadump: Detect when address bit 7 is a busy flag -
lm-sensors/branches/lm-sensors-3.0.0/prog/dump/i2cbusses.c
r4240 r4431 244 244 return file; 245 245 } 246 247 int set_slave_addr(int file, int address, int force) 248 { 249 /* With force, let the user read from/write to the registers 250 even when a driver is also running */ 251 if (ioctl(file, force ? I2C_SLAVE_FORCE : I2C_SLAVE, address) < 0) { 252 fprintf(stderr, 253 "Error: Could not set address to 0x%02x: %s\n", 254 address, strerror(errno)); 255 return -errno; 256 } 257 258 return 0; 259 } -
lm-sensors/branches/lm-sensors-3.0.0/prog/dump/i2cbusses.h
r3077 r4431 25 25 26 26 int open_i2c_dev(const int i2cbus, char *filename, const int quiet); 27 int set_slave_addr(int file, int address, int force); 27 28 28 29 #endif -
lm-sensors/branches/lm-sensors-3.0.0/prog/dump/i2cdump.8
r4157 r4431 1 .TH I2CDUMP 8 " April 2006"1 .TH I2CDUMP 8 "June 2007" 2 2 .SH NAME 3 3 i2cdump \- examine I2C registers … … 5 5 .SH SYNOPSIS 6 6 .B i2cdump 7 .RB [ -f ] 7 8 .RB [ -y ] 8 9 .I i2cbus … … 22 23 .B -V 23 24 Display the version and exit. 25 .TP 26 .B -f 27 Force access to the device even if it is already busy. By default, i2cdump 28 will refuse to access a device which is already under the control of a 29 kernel driver. Using this flag is dangerous, it can seriously confuse the 30 kernel driver in question. It can also cause i2cdump to return invalid 31 results. So use at your own risk and only if you know what you're doing. 24 32 .TP 25 33 .B -y -
lm-sensors/branches/lm-sensors-3.0.0/prog/dump/i2cdump.c
r4419 r4431 32 32 void help(void) 33 33 { 34 fprintf(stderr, "Syntax: i2cdump [- y] I2CBUS ADDRESS [MODE] [BANK"35 "[BANK REG]]\n"34 fprintf(stderr, "Syntax: i2cdump [-f] [-y] I2CBUS ADDRESS [MODE] " 35 "[BANK [BANKREG]]\n" 36 36 " i2cdump -V\n" 37 37 " MODE is one of:\n" … … 61 61 int pec = 0, even = 0; 62 62 int flags = 0; 63 int yes = 0, version = 0;63 int force = 0, yes = 0, version = 0; 64 64 65 65 /* handle (optional) flags first */ … … 67 67 switch (argv[1+flags][1]) { 68 68 case 'V': version = 1; break; 69 case 'f': force = 1; break; 69 70 case 'y': yes = 1; break; 70 71 default: … … 235 236 } 236 237 237 /* use FORCE so that we can look at registers even when 238 a driver is also running */ 239 if (ioctl(file, I2C_SLAVE_FORCE, address) < 0) { 240 fprintf(stderr, "Error: Could not set address to %d: %s\n", 241 address, strerror(errno)); 242 exit(1); 243 } 238 if (set_slave_addr(file, address, force) < 0) 239 exit(1); 244 240 245 241 if (pec) { -
lm-sensors/branches/lm-sensors-3.0.0/prog/dump/i2cget.8
r4157 r4431 1 .TH I2CGET 8 " September 2005"1 .TH I2CGET 8 "June 2007" 2 2 .SH "NAME" 3 3 i2cget \- read from I2C/SMBus chip registers … … 5 5 .SH SYNOPSIS 6 6 .B i2cget 7 .RB [ -f ] 7 8 .RB [ -y ] 8 9 .I i2cbus … … 21 22 .B -V 22 23 Display the version and exit. 24 .TP 25 .B -f 26 Force access to the device even if it is already busy. By default, i2cget 27 will refuse to access a device which is already under the control of a 28 kernel driver. Using this flag is dangerous, it can seriously confuse the 29 kernel driver in question. It can also cause i2cget to return an invalid 30 value. So use at your own risk and only if you know what you're doing. 23 31 .TP 24 32 .B -y -
lm-sensors/branches/lm-sensors-3.0.0/prog/dump/i2cget.c
r4256 r4431 37 37 void help(void) 38 38 { 39 fprintf(stderr, "Syntax: i2cget [- y] I2CBUS CHIP-ADDRESS [DATA-ADDRESS "40 "[ MODE]]\n"39 fprintf(stderr, "Syntax: i2cget [-f] [-y] I2CBUS CHIP-ADDRESS " 40 "[DATA-ADDRESS [MODE]]\n" 41 41 " i2cget -V\n" 42 42 " MODE can be: 'b' (read byte data, default)\n" … … 98 98 fprintf(stderr, "Warning: Adapter for i2c bus %d does " 99 99 "not seem to support PEC\n", i2cbus); 100 }101 102 return 0;103 }104 105 int set_slave(int file, int address)106 {107 /* use FORCE so that we can read registers even when108 a driver is also running */109 if (ioctl(file, I2C_SLAVE_FORCE, address) < 0) {110 fprintf(stderr, "Error: Could not set address to %d: %s\n",111 address, strerror(errno));112 return -1;113 100 } 114 101 … … 174 161 int pec = 0; 175 162 int flags = 0; 176 int yes = 0, version = 0;163 int force = 0, yes = 0, version = 0; 177 164 178 165 /* handle (optional) flags first */ … … 180 167 switch (argv[1+flags][1]) { 181 168 case 'V': version = 1; break; 169 case 'f': force = 1; break; 182 170 case 'y': yes = 1; break; 183 171 default: … … 236 224 if (file < 0 237 225 || check_funcs(file, i2cbus, size, daddress, pec) 238 || set_slave (file, address))226 || set_slave_addr(file, address, force)) 239 227 exit(1); 240 228 -
lm-sensors/branches/lm-sensors-3.0.0/prog/dump/i2cset.8
r4157 r4431 1 .TH I2CSET 8 " September 2005"1 .TH I2CSET 8 "June 2007" 2 2 .SH "NAME" 3 3 i2cset \- set I2C registers … … 5 5 .SH SYNOPSIS 6 6 .B i2cset 7 .RB [ -f ] 7 8 .RB [ -y ] 8 9 .I i2cbus … … 24 25 .B -V 25 26 Display the version and exit. 27 .TP 28 .B -f 29 Force access to the device even if it is already busy. By default, i2cset 30 will refuse to access a device which is already under the control of a 31 kernel driver. Using this flag is dangerous, it can seriously confuse the 32 kernel driver in question. It can also cause i2cset to silently write to 33 the wrong register. So use at your own risk and only if you know what 34 you're doing. 26 35 .TP 27 36 .B -y -
lm-sensors/branches/lm-sensors-3.0.0/prog/dump/i2cset.c
r4256 r4431 34 34 void help(void) 35 35 { 36 fprintf(stderr, "Syntax: i2cset [- y] I2CBUS CHIP-ADDRESS DATA-ADDRESS "36 fprintf(stderr, "Syntax: i2cset [-f] [-y] I2CBUS CHIP-ADDRESS DATA-ADDRESS " 37 37 "VALUE [MODE] [MASK]\n" 38 38 " i2cset -V\n" … … 54 54 int pec = 0; 55 55 int flags = 0; 56 int yes = 0, version = 0;56 int force = 0, yes = 0, version = 0; 57 57 58 58 /* handle (optional) flags first */ … … 60 60 switch (argv[1+flags][1]) { 61 61 case 'V': version = 1; break; 62 case 'f': force = 1; break; 62 63 case 'y': yes = 1; break; 63 64 default: … … 161 162 } 162 163 163 /* use FORCE so that we can write registers even when 164 a driver is also running */ 165 if (ioctl(file, I2C_SLAVE_FORCE, address) < 0) { 166 fprintf(stderr, "Error: Could not set address to %d: %s\n", 167 address, strerror(errno)); 164 if (set_slave_addr(file, address, force) < 0) 168 165 exit(1); 169 }170 166 171 167 if (!yes) {
