Changeset 5240 for i2c-tools/trunk/tools

Show
Ignore:
Timestamp:
05/05/08 16:54:18 (4 years ago)
Author:
khali
Message:

No need to print the i2c bus number in functionality error message.

Location:
i2c-tools/trunk/tools
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • i2c-tools/trunk/tools/i2cdump.c

    r5239 r5240  
    4747} 
    4848 
    49 static int check_funcs(int file, int i2cbus, int size, int pec) 
     49static int check_funcs(int file, int size, int pec) 
    5050{ 
    5151        unsigned long funcs; 
     
    6161        case I2C_SMBUS_BYTE: 
    6262                if (!((funcs & I2C_FUNC_SMBUS_BYTE) == I2C_FUNC_SMBUS_BYTE)) { 
    63                         fprintf(stderr, "Error: Adapter for i2c bus %d does " 
    64                                 "not have byte capability\n", i2cbus); 
     63                        fprintf(stderr, "Error: Adapter does " 
     64                                "not have byte capability\n"); 
    6565                        return -1; 
    6666                } 
     
    6969        case I2C_SMBUS_BYTE_DATA: 
    7070                if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { 
    71                         fprintf(stderr, "Error: Adapter for i2c bus %d does " 
    72                                 "not have byte read capability\n", i2cbus); 
     71                        fprintf(stderr, "Error: Adapter does " 
     72                                "not have byte read capability\n"); 
    7373                        return -1; 
    7474                } 
     
    7777        case I2C_SMBUS_WORD_DATA: 
    7878                if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { 
    79                         fprintf(stderr, "Error: Adapter for i2c bus %d does " 
    80                                 "not have word read capability\n", i2cbus); 
     79                        fprintf(stderr, "Error: Adapter does " 
     80                                "not have word read capability\n"); 
    8181                        return -1; 
    8282                } 
     
    8585        case I2C_SMBUS_BLOCK_DATA: 
    8686                if (!(funcs & I2C_FUNC_SMBUS_READ_BLOCK_DATA)) { 
    87                         fprintf(stderr, "Error: Adapter for i2c bus %d does " 
    88                                 "not have smbus block read capability\n", 
    89                                 i2cbus); 
     87                        fprintf(stderr, "Error: Adapter does " 
     88                                "not have smbus block read capability\n"); 
    9089                        return -1; 
    9190                } 
     
    9493        case I2C_SMBUS_I2C_BLOCK_DATA: 
    9594                if (!(funcs & I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { 
    96                         fprintf(stderr, "Error: Adapter for i2c bus %d does " 
    97                                 "not have i2c block read capability\n", 
    98                                 i2cbus); 
     95                        fprintf(stderr, "Error: Adapter does " 
     96                                "not have i2c block read capability\n"); 
    9997                        return -1; 
    10098                } 
     
    104102        if (pec 
    105103         && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C))) { 
    106                 fprintf(stderr, "Warning: Adapter for i2c bus %d does " 
    107                         "not seem to support PEC\n", i2cbus); 
     104                fprintf(stderr, "Warning: Adapter does " 
     105                        "not seem to support PEC\n"); 
    108106        } 
    109107 
     
    265263        file = open_i2c_dev(i2cbus, filename, 0); 
    266264        if (file < 0 
    267          || check_funcs(file, i2cbus, size, pec) 
     265         || check_funcs(file, size, pec) 
    268266         || set_slave_addr(file, address, force)) 
    269267                exit(1); 
  • i2c-tools/trunk/tools/i2cget.c

    r5238 r5240  
    5050} 
    5151 
    52 static int check_funcs(int file, int i2cbus, int size, int daddress, int pec) 
     52static int check_funcs(int file, int size, int daddress, int pec) 
    5353{ 
    5454        unsigned long funcs; 
     
    6464        case I2C_SMBUS_BYTE: 
    6565                if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE)) { 
    66                         fprintf(stderr, "Error: Adapter for i2c bus %d does " 
    67                                 "not have read byte capability\n", i2cbus); 
     66                        fprintf(stderr, "Error: Adapter does " 
     67                                "not have read byte capability\n"); 
    6868                        return -1; 
    6969                } 
    7070                if (daddress >= 0 
    7171                 && !(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) { 
    72                         fprintf(stderr, "Error: Adapter for i2c bus %d does " 
    73                                 "not have write byte capability\n", i2cbus); 
     72                        fprintf(stderr, "Error: Adapter does " 
     73                                "not have write byte capability\n"); 
    7474                        return -1; 
    7575                } 
     
    7878        case I2C_SMBUS_BYTE_DATA: 
    7979                if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { 
    80                         fprintf(stderr, "Error: Adapter for i2c bus %d does " 
    81                                 "not have read byte data capability\n", i2cbus); 
     80                        fprintf(stderr, "Error: Adapter does " 
     81                                "not have read byte data capability\n"); 
    8282                        return -1; 
    8383                } 
     
    8686        case I2C_SMBUS_WORD_DATA: 
    8787                if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { 
    88                         fprintf(stderr, "Error: Adapter for i2c bus %d does " 
    89                                 "not have read word data capability\n", i2cbus); 
     88                        fprintf(stderr, "Error: Adapter does " 
     89                                "not have read word data capability\n"); 
    9090                        return -1; 
    9191                } 
     
    9595        if (pec 
    9696         && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C))) { 
    97                 fprintf(stderr, "Warning: Adapter for i2c bus %d does " 
    98                         "not seem to support PEC\n", i2cbus); 
     97                fprintf(stderr, "Warning: Adapter does " 
     98                        "not seem to support PEC\n"); 
    9999        } 
    100100 
     
    219219        file = open_i2c_dev(i2cbus, filename, 0); 
    220220        if (file < 0 
    221          || check_funcs(file, i2cbus, size, daddress, pec) 
     221         || check_funcs(file, size, daddress, pec) 
    222222         || set_slave_addr(file, address, force)) 
    223223                exit(1); 
  • i2c-tools/trunk/tools/i2cset.c

    r5237 r5240  
    4646} 
    4747 
    48 static int check_funcs(int file, int i2cbus, int size, int pec) 
     48static int check_funcs(int file, int size, int pec) 
    4949{ 
    5050        unsigned long funcs; 
     
    6060        case I2C_SMBUS_BYTE: 
    6161                if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) { 
    62                         fprintf(stderr, "Error: Adapter for i2c bus %d does " 
    63                                 "not have byte send capability\n", i2cbus); 
     62                        fprintf(stderr, "Error: Adapter does " 
     63                                "not have byte send capability\n"); 
    6464                        return -1; 
    6565                } 
     
    6868        case I2C_SMBUS_BYTE_DATA: 
    6969                if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { 
    70                         fprintf(stderr, "Error: Adapter for i2c bus %d does " 
    71                                 "not have byte write capability\n", i2cbus); 
     70                        fprintf(stderr, "Error: Adapter does " 
     71                                "not have byte write capability\n"); 
    7272                        return -1; 
    7373                } 
     
    7676        case I2C_SMBUS_WORD_DATA: 
    7777                if (!(funcs & I2C_FUNC_SMBUS_WRITE_WORD_DATA)) { 
    78                         fprintf(stderr, "Error: Adapter for i2c bus %d does " 
    79                                 "not have word write capability\n", i2cbus); 
     78                        fprintf(stderr, "Error: Adapter does " 
     79                                "not have word write capability\n"); 
    8080                        return -1; 
    8181                } 
     
    8585        if (pec 
    8686         && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C))) { 
    87                 fprintf(stderr, "Warning: Adapter for i2c bus %d does " 
    88                         "not seem to support PEC\n", i2cbus); 
     87                fprintf(stderr, "Warning: Adapter does " 
     88                        "not seem to support PEC\n"); 
    8989        } 
    9090 
     
    215215        file = open_i2c_dev(i2cbus, filename, 0); 
    216216        if (file < 0 
    217          || check_funcs(file, i2cbus, size, pec) 
     217         || check_funcs(file, size, pec) 
    218218         || set_slave_addr(file, address, force)) 
    219219                exit(1);