Changeset 5195
- Timestamp:
- 04/20/08 19:32:12 (5 years ago)
- Location:
- i2c-tools/trunk/tools
- Files:
-
- 5 modified
-
i2cbusses.c (modified) (2 diffs)
-
i2cdetect.8 (modified) (2 diffs)
-
i2cdump.8 (modified) (2 diffs)
-
i2cget.8 (modified) (2 diffs)
-
i2cset.8 (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
i2c-tools/trunk/tools/i2cbusses.c
r5194 r5195 341 341 } 342 342 343 static int lookup_i2c_bus_by_name(const char *bus_name) 344 { 345 struct i2c_adap *adapters; 346 int i, i2cbus = -1; 347 348 adapters = gather_i2c_busses(); 349 if (adapters == NULL) { 350 fprintf(stderr, "Error: Out of memory!\n"); 351 return -3; 352 } 353 354 /* Walk the list of i2c busses, looking for the one with the 355 right name */ 356 for (i = 0; adapters[i].name; i++) { 357 if (strcmp(adapters[i].name, bus_name) == 0) { 358 if (i2cbus >= 0) { 359 fprintf(stderr, 360 "Error: I2C bus name is not unique!\n"); 361 i2cbus = -4; 362 goto done; 363 } 364 i2cbus = adapters[i].nr; 365 } 366 } 367 368 if (i2cbus == -1) 369 fprintf(stderr, "Error: I2CBUS argument doesn't match any " 370 "I2C bus name\n"); 371 372 done: 373 free_adapters(adapters); 374 return i2cbus; 375 } 376 343 377 /* 344 378 * Parse an I2CBUS command line argument and return the corresponding … … 352 386 i2cbus = strtol(i2cbus_arg, &end, 0); 353 387 if (*end || !*i2cbus_arg) { 354 fprintf(stderr, "Error: I2CBUS argument not a number!\n");355 return -1;388 /* Not a number, maybe a name? */ 389 return lookup_i2c_bus_by_name(i2cbus_arg); 356 390 } 357 391 if (i2cbus < 0 || i2cbus > 0xff) { -
i2c-tools/trunk/tools/i2cdetect.8
r4488 r5195 1 .TH I2CDETECT 8 " June 2007"1 .TH I2CDETECT 8 "April 2008" 2 2 .SH NAME 3 3 i2cdetect \- detect I2C chips … … 24 24 i2cdetect is a userspace program to scan an I2C bus for devices. It 25 25 outputs a table with the list of detected devices on the specified bus. 26 \fIi2cbus\fR indicates the number o f the I2C bus to be scanned, and26 \fIi2cbus\fR indicates the number or name of the I2C bus to be scanned, and 27 27 should correspond to one of the busses listed by \fIi2cdetect -l\fR. 28 28 The optional parameters \fIfirst\fR and \fIlast\fR restrict the scanning -
i2c-tools/trunk/tools/i2cdump.8
r5151 r5195 1 .TH I2CDUMP 8 " March2008"1 .TH I2CDUMP 8 "April 2008" 2 2 .SH NAME 3 3 i2cdump \- examine I2C registers … … 44 44 .PP 45 45 At least two options must be provided to i2cdump. \fIi2cbus\fR indicates the 46 number o f the I2C bus to be scanned. This number should correspond to one46 number or name of the I2C bus to be scanned. This number should correspond to one 47 47 of the busses listed by \fIi2cdetect -l\fR. \fIaddress\fR indicates the 48 48 address to be scanned on that bus, and is an integer between 0x00 and 0x7F. -
i2c-tools/trunk/tools/i2cget.8
r4488 r5195 1 .TH I2CGET 8 " June 2007"1 .TH I2CGET 8 "April 2008" 2 2 .SH "NAME" 3 3 i2cget \- read from I2C/SMBus chip registers … … 37 37 .PP 38 38 There are two required options to i2cget. \fIi2cbus\fR indicates the number 39 o f the I2C bus to be scanned. This number should correspond to one of39 or name of the I2C bus to be scanned. This number should correspond to one of 40 40 the busses listed by \fIi2cdetect -l\fR. \fIchip-address\fR specifies the 41 41 address of the chip on that bus, and is an integer between 0x03 and 0x77. -
i2c-tools/trunk/tools/i2cset.8
r4488 r5195 1 .TH I2CSET 8 " June 2007"1 .TH I2CSET 8 "April 2008" 2 2 .SH "NAME" 3 3 i2cset \- set I2C registers … … 41 41 .PP 42 42 There are four required options to i2cset. \fIi2cbus\fR indicates the number 43 o f the I2C bus to be scanned. This number should correspond to one of43 or name of the I2C bus to be scanned. This number should correspond to one of 44 44 the busses listed by \fIi2cdetect -l\fR. \fIchip-address\fR specifies the 45 45 address of the chip on that bus, and is an integer between 0x00 and 0x7F.
