Hello community,

here is the log from the commit of package i2c-tools for openSUSE:Factory 
checked in at 2011-12-06 17:59:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/i2c-tools (Old)
 and      /work/SRC/openSUSE:Factory/.i2c-tools.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "i2c-tools", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/i2c-tools/i2c-tools.changes      2011-10-04 
18:12:04.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.i2c-tools.new/i2c-tools.changes 2011-12-06 
17:59:57.000000000 +0100
@@ -1,0 +2,8 @@
+Mon Dec  5 10:42:30 CET 2011 - [email protected]
+
+- Update to version 3.1.0:
+  * Support for block writes (i2cset)
+  * at24 driver support (decode-dimms)
+  * Slightly improved DDR SDRAM support (decode-dimms)
+
+-------------------------------------------------------------------

Old:
----
  i2c-tools-3.0.3.tar.bz2
  i2c-tools-3.0.3.tar.bz2.sig

New:
----
  i2c-tools-3.1.0.tar.bz2
  i2c-tools-3.1.0.tar.bz2.sig

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ i2c-tools.spec ++++++
--- /var/tmp/diff_new_pack.uvAG6B/_old  2011-12-06 18:00:00.000000000 +0100
+++ /var/tmp/diff_new_pack.uvAG6B/_new  2011-12-06 18:00:00.000000000 +0100
@@ -20,7 +20,7 @@
 
 Name:           i2c-tools
 Url:            http://www.lm-sensors.org/wiki/I2CTools
-Version:        3.0.3
+Version:        3.1.0
 Release:        1
 Summary:        A heterogeneous set of I2C tools for Linux
 License:        GPLv2+

++++++ i2c-tools-3.0.3.tar.bz2 -> i2c-tools-3.1.0.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-3.0.3/CHANGES new/i2c-tools-3.1.0/CHANGES
--- old/i2c-tools-3.0.3/CHANGES 2010-12-12 13:42:13.000000000 +0100
+++ new/i2c-tools-3.1.0/CHANGES 2011-12-04 18:33:54.000000000 +0100
@@ -1,6 +1,15 @@
 i2c-tools CHANGES
 -----------------
 
+3.1.0 (2011-12-04)
+  decode-dimms: Decode module configuration type of DDR SDRAM
+                Decode refresh rate of DDR SDRAM
+                Add support for the at24 kernel driver
+  i2c-dev.h: Make value arrays const for block write functions
+  i2cset: Add support for SMBus and I2C block writes
+          Removed obsolete method to specify value mask
+          More stringent parameter validation
+
 3.0.3 (2010-12-12)
   Makefile: Let the environment set CC and CFLAGS
             Integrate py-smbus into the build system
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-3.0.3/eeprom/decode-dimms 
new/i2c-tools-3.1.0/eeprom/decode-dimms
--- old/i2c-tools-3.0.3/eeprom/decode-dimms     2009-06-09 13:13:41.000000000 
+0200
+++ new/i2c-tools-3.1.0/eeprom/decode-dimms     2011-02-16 14:58:38.000000000 
+0100
@@ -5,7 +5,7 @@
 # Copyright 1998, 1999 Philip Edelbrock <[email protected]>
 # modified by Christian Zuckschwerdt <[email protected]>
 # modified by Burkart Lingner <[email protected]>
-# Copyright (C) 2005-2009  Jean Delvare <[email protected]>
+# Copyright (C) 2005-2011  Jean Delvare <[email protected]>
 #
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@
 use constant LITTLEENDIAN      => "little-endian";
 use constant BIGENDIAN         => "big-endian";
 
-$revision = '$Revision: 5733 $ ($Date: 2009-06-09 13:13:41 +0200 (mar. 09 juin 
2009) $)';
+$revision = '$Revision: 5929 $ ($Date: 2011-02-16 14:58:38 +0100 (mer. 16 
févr. 2011) $)';
 $revision =~ s/\$\w+: (.*?) \$/$1/g;
 $revision =~ s/ \([^()]*\)//;
 
@@ -525,6 +525,18 @@
        return ($_[0] < @levels) ? $levels[$_[0]] : "Undefined!";
 }
 
+# Common to SDR and DDR SDRAM
+sub sdram_module_configuration_type($)
+{
+       my @types = (
+               "No Parity",                    # 0
+               "Parity",                       # 1
+               "ECC",                          # 2
+       );
+
+       return ($_[0] < @types) ? $types[$_[0]] : "Undefined!";
+}
+
 # Parameter: EEPROM bytes 0-127 (using 3-62)
 sub decode_sdr_sdram($)
 {
@@ -596,25 +608,10 @@
        printl("Voltage Interface Level",
               sdram_voltage_interface_level($bytes->[8]));
 
-       if ($bytes->[11] == 0) { $temp = "No Parity"; }
-       elsif ($bytes->[11] == 1) { $temp = "Parity"; }
-       elsif ($bytes->[11] == 2) { $temp = "ECC";  }
-       else { $temp = "Undefined!"; }
-       printl("Module Configuration Type", $temp);
+       printl("Module Configuration Type",
+              sdram_module_configuration_type($bytes->[11]));
 
-       if ($bytes->[12] & 0x80) { $temp = "Self Refreshing"; }
-       else { $temp = "Not Self Refreshing"; }
-       printl("Refresh Type", $temp);
-
-       $temp = $bytes->[12] & 0x7f;
-       if ($temp == 0) { $temp = "Normal (15.625 us)"; }
-       elsif ($temp == 1) { $temp = "Reduced (3.9 us)"; }
-       elsif ($temp == 2) { $temp = "Reduced (7.8 us)"; }
-       elsif ($temp == 3) { $temp = "Extended (31.3 us)"; }
-       elsif ($temp == 4) { $temp = "Extended (62.5 us)"; }
-       elsif ($temp == 5) { $temp = "Extended (125 us)"; }
-       else { $temp = "Undefined!"; }
-       printl("Refresh Rate", $temp);
+       printl("Refresh Rate", ddr2_refresh_rate($bytes->[12]));
 
        if ($bytes->[13] & 0x80) { $temp = "Bank2 = 2 x Bank1"; }
        else { $temp = "No Bank2 OR Bank2 = Bank1 width"; }
@@ -821,6 +818,11 @@
        printl("Voltage Interface Level",
               sdram_voltage_interface_level($bytes->[8]));
 
+       printl("Module Configuration Type",
+              sdram_module_configuration_type($bytes->[11]));
+
+       printl("Refresh Rate", ddr2_refresh_rate($bytes->[12]));
+
        my $highestCAS = 0;
        my %cas;
        for ($ii = 0; $ii < 7; $ii++) {
@@ -949,6 +951,7 @@
        return @suptypes;
 }
 
+# Common to SDR, DDR and DDR2 SDRAM
 sub ddr2_refresh_rate($)
 {
        my $byte = shift;
@@ -1707,24 +1710,55 @@
 Jean Delvare, Trent Piepho and others');
 
 
+# From a sysfs device path and an attribute name, return the attribute
+# value, or undef (stolen from sensors-detect)
+sub sysfs_device_attribute
+{
+       my ($device, $attr) = @_;
+       my $value;
+
+       open(local *FILE, "$device/$attr") or return "";
+       $value = <FILE>;
+       close(FILE);
+       return unless defined $value;
+
+       chomp($value);
+       return $value;
+}
+
 sub get_dimm_list
 {
-       my ($dir, $file, @files);
+       my (@dirs, $dir, $file, @files);
 
        if ($use_sysfs) {
-               $dir = '/sys/bus/i2c/drivers/eeprom';
+               @dirs = ('/sys/bus/i2c/drivers/eeprom', 
'/sys/bus/i2c/drivers/at24');
        } else {
-               $dir = '/proc/sys/dev/sensors';
+               @dirs = ('/proc/sys/dev/sensors');
        }
 
-       if (opendir(local *DIR, $dir)) {
+       foreach $dir (@dirs) {
+               next unless opendir(local *DIR, $dir);
                while (defined($file = readdir(DIR))) {
-                       next if $use_sysfs && $file !~ /^\d+-[\da-f]+$/i;
-                       next if !$use_sysfs && $file !~ /^eeprom-/;
+                       if ($use_sysfs) {
+                               # We look for I2C devices like 0-0050 or 2-0051
+                               next unless $file =~ /^\d+-[\da-f]+$/i;
+                               next unless -d "$dir/$file";
+
+                               # Device name must be eeprom (driver eeprom)
+                               # or spd (driver at24)
+                               my $attr = sysfs_device_attribute("$dir/$file", 
"name");
+                               next unless defined $attr &&
+                                           ($attr eq "eeprom" || $attr eq 
"spd");
+                       } else {
+                               next unless $file =~ /^eeprom-/;
+                       }
                        push @files, { eeprom => "$file",
                                       file => "$dir/$file" };
                }
                close(DIR);
+       }
+
+       if (@files) {
                return sort { $a->{file} cmp $b->{file} } @files;
        } elsif (! -d '/sys/module/eeprom') {
                print "No EEPROM found, are you sure the eeprom module is 
loaded?\n";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-3.0.3/include/linux/i2c-dev.h 
new/i2c-tools-3.1.0/include/linux/i2c-dev.h
--- old/i2c-tools-3.0.3/include/linux/i2c-dev.h 2008-10-19 11:47:02.000000000 
+0200
+++ new/i2c-tools-3.1.0/include/linux/i2c-dev.h 2010-12-12 14:22:29.000000000 
+0100
@@ -20,7 +20,7 @@
     MA 02110-1301 USA.
 */
 
-/* $Id: i2c-dev.h 5361 2008-10-19 09:47:02Z khali $ */
+/* $Id: i2c-dev.h 5894 2010-12-12 13:22:29Z khali $ */
 
 #ifndef LIB_I2CDEV_H
 #define LIB_I2CDEV_H
@@ -258,7 +258,7 @@
 }
 
 static inline __s32 i2c_smbus_write_block_data(int file, __u8 command, 
-                                               __u8 length, __u8 *values)
+                                               __u8 length, const __u8 *values)
 {
        union i2c_smbus_data data;
        int i;
@@ -296,7 +296,8 @@
 }
 
 static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command,
-                                               __u8 length, __u8 *values)
+                                                   __u8 length,
+                                                   const __u8 *values)
 {
        union i2c_smbus_data data;
        int i;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-3.0.3/tools/i2cset.8 
new/i2c-tools-3.1.0/tools/i2cset.8
--- old/i2c-tools-3.0.3/tools/i2cset.8  2009-09-17 17:59:38.000000000 +0200
+++ new/i2c-tools-3.1.0/tools/i2cset.8  2011-01-29 18:15:01.000000000 +0100
@@ -12,6 +12,7 @@
 .I chip-address
 .I data-address
 .RI [ value ]
+.RI ...
 .RI [ mode ]
 .br
 .B i2cset
@@ -62,18 +63,24 @@
 integer between 0x00 and 0xFF.
 .PP
 The \fIvalue\fR parameter, if specified, is the value to write to that
-location on the chip. If this parameter is omited, then a short write is
+location on the chip. If this parameter is omitted, then a short write is
 issued. For most chips, it simply sets an internal pointer to the target
 location, but doesn't actually write to that location. For a few chips
 though, in particular simple ones with a single register, this short write
-is an actual write.
+is an actual write. If the mode parameter is \fBs\fP or \fBi\fP, multiple
+values can be specified.
 .PP
-The \fImode\fR parameter, if specified, is one of the letters \fBb\fP or
-\fBw\fP, corresponding to a write size of a single byte or a 16-bit word,
-respectively. A \fBp\fP can also be appended to the \fImode\fR parameter to
-enable PEC. If the \fImode\fR parameter is omitted, i2cset defaults to byte
+The \fImode\fR parameter, if specified, is one of the letters \fBb\fP,
+\fBw\fP, \fBs\fP, or \fBi\fP, corresponding to a write size of a single byte,
+a 16-bit word, a SMBus block write, or an I2C block write, respectively.
+For SMBus and I2C block writes, the write size is determined by the number
+of \fIvalue\fR parameters.
+Except for I2C block writes, a \fBp\fP can also be appended to the \fImode\fR
+parameter to enable PEC.
+If the \fImode\fR parameter is omitted, i2cset defaults to byte
 mode without PEC. The \fIvalue\fR provided must be within range for the
-specified data type (0x00-0xFF for bytes, 0x0000-0xFFFF for words).
+specified data type (0x00-0xFF for byte and block writes, 0x0000-0xFFFF
+for words).
 Another possible mode is \fBc\fP, which doesn't write any value (so-called
 short write). You usually don't have to specify this mode, as it is the
 default when no value is provided, unless you also want to enable PEC.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-3.0.3/tools/i2cset.c 
new/i2c-tools-3.1.0/tools/i2cset.c
--- old/i2c-tools-3.0.3/tools/i2cset.c  2010-11-26 11:25:32.000000000 +0100
+++ new/i2c-tools-3.1.0/tools/i2cset.c  2011-02-15 17:12:27.000000000 +0100
@@ -35,13 +35,15 @@
 static void help(void)
 {
        fprintf(stderr,
-               "Usage: i2cset [-f] [-y] [-m MASK] I2CBUS CHIP-ADDRESS 
DATA-ADDRESS [VALUE] [MODE]\n"
+               "Usage: i2cset [-f] [-y] [-m MASK] I2CBUS CHIP-ADDRESS 
DATA-ADDRESS [VALUE] ... [MODE]\n"
                "  I2CBUS is an integer or an I2C bus name\n"
                "  ADDRESS is an integer (0x03 - 0x77)\n"
                "  MODE is one of:\n"
                "    c (byte, no value)\n"
                "    b (byte data, default)\n"
                "    w (word data)\n"
+               "    i (I2C block data)\n"
+               "    s (SMBus block data)\n"
                "    Append p for SMBus PEC\n");
        exit(1);
 }
@@ -78,6 +80,19 @@
                        return -1;
                }
                break;
+
+       case I2C_SMBUS_BLOCK_DATA:
+               if (!(funcs & I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)) {
+                       fprintf(stderr, MISSING_FUNC_FMT, "SMBus block write");
+                       return -1;
+               }
+               break;
+       case I2C_SMBUS_I2C_BLOCK_DATA:
+               if (!(funcs & I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) {
+                       fprintf(stderr, MISSING_FUNC_FMT, "I2C block write");
+                       return -1;
+               }
+               break;
        }
 
        if (pec
@@ -90,7 +105,8 @@
 }
 
 static int confirm(const char *filename, int address, int size, int daddress,
-                  int value, int vmask, int pec)
+                  int value, int vmask, const unsigned char *block, int len,
+                  int pec)
 {
        int dont = 0;
 
@@ -109,7 +125,16 @@
                "0x%02x, data address\n0x%02x, ", filename, address, daddress);
        if (size == I2C_SMBUS_BYTE)
                fprintf(stderr, "no data.\n");
-       else
+       else if (size == I2C_SMBUS_BLOCK_DATA ||
+                size == I2C_SMBUS_I2C_BLOCK_DATA) {
+               int i;
+
+               fprintf(stderr, "data");
+               for (i = 0; i < len; i++)
+                       fprintf(stderr, " 0x%02x", block[i]);
+               fprintf(stderr, ", mode %s.\n", size == I2C_SMBUS_BLOCK_DATA
+                       ? "smbus block" : "i2c block");
+       } else
                fprintf(stderr, "data 0x%02x%s, mode %s.\n", value,
                        vmask ? " (masked)" : "",
                        size == I2C_SMBUS_BYTE_DATA ? "byte" : "word");
@@ -136,6 +161,8 @@
        int pec = 0;
        int flags = 0;
        int force = 0, yes = 0, version = 0, readback = 0;
+       unsigned char block[I2C_SMBUS_BLOCK_MAX];
+       int len;
 
        /* handle (optional) flags first */
        while (1+flags < argc && argv[1+flags][0] == '-') {
@@ -180,46 +207,91 @@
                help();
        }
 
-       if (argc > flags + 4) {
+       /* check for command/mode */
+       if (argc == flags + 4) {
+               /* Implicit "c" */
+               size = I2C_SMBUS_BYTE;
+       } else if (argc == flags + 5) {
+               /* "c", "cp",  or implicit "b" */
                if (!strcmp(argv[flags+4], "c")
                 || !strcmp(argv[flags+4], "cp")) {
                        size = I2C_SMBUS_BYTE;
-                       value = -1;
                        pec = argv[flags+4][1] == 'p';
                } else {
                        size = I2C_SMBUS_BYTE_DATA;
-                       value = strtol(argv[flags+4], &end, 0);
-                       if (*end || value < 0) {
-                               fprintf(stderr, "Error: Data value invalid!\n");
-                               help();
-                       }
                }
        } else {
-               size = I2C_SMBUS_BYTE;
-               value = -1;
-       }
-
-       if (argc > flags + 5) {
-               switch (argv[flags+5][0]) {
+               /* All other commands */
+               if (strlen(argv[argc-1]) > 2
+                   || (strlen(argv[argc-1]) == 2 && argv[argc-1][1] != 'p')) {
+                       fprintf(stderr, "Error: Invalid mode '%s'!\n", 
argv[argc-1]);
+                       help();
+               }
+               switch (argv[argc-1][0]) {
                case 'b': size = I2C_SMBUS_BYTE_DATA; break;
                case 'w': size = I2C_SMBUS_WORD_DATA; break;
+               case 's': size = I2C_SMBUS_BLOCK_DATA; break;
+               case 'i': size = I2C_SMBUS_I2C_BLOCK_DATA; break;
                default:
-                       fprintf(stderr, "Error: Invalid mode!\n");
+                       fprintf(stderr, "Error: Invalid mode '%s'!\n", 
argv[argc-1]);
+                       help();
+               }
+               pec = argv[argc-1][1] == 'p';
+               if (size == I2C_SMBUS_BLOCK_DATA || size == 
I2C_SMBUS_I2C_BLOCK_DATA) {
+                       if (pec && size == I2C_SMBUS_I2C_BLOCK_DATA) {
+                               fprintf(stderr, "Error: PEC not supported for 
I2C block writes!\n");
+                               help();
+                       }
+                       if (maskp) {
+                               fprintf(stderr, "Error: Mask not supported for 
block writes!\n");
+                               help();
+                       }
+                       if (argc > (int)sizeof(block) + flags + 5) {
+                               fprintf(stderr, "Error: Too many arguments!\n");
+                               help();
+                       }
+               } else if (argc != flags + 6) {
+                       fprintf(stderr, "Error: Too many arguments!\n");
                        help();
                }
-               pec = argv[flags+5][1] == 'p';
        }
 
-       /* Old method to provide the value mask, deprecated and no longer
-          documented but still supported for compatibility */
-       if (argc > flags + 6) {
-               if (maskp) {
-                       fprintf(stderr, "Error: Data value mask provided 
twice!\n");
+       len = 0; /* Must always initialize len since it is passed to confirm() 
*/
+
+       /* read values from command line */
+       switch (size) {
+       case I2C_SMBUS_BYTE_DATA:
+       case I2C_SMBUS_WORD_DATA:
+               value = strtol(argv[flags+4], &end, 0);
+               if (*end || value < 0) {
+                       fprintf(stderr, "Error: Data value invalid!\n");
                        help();
                }
-               fprintf(stderr, "Warning: Using deprecated way to set the data 
value mask!\n");
-               fprintf(stderr, "         Please switch to using -m.\n");
-               maskp = argv[flags+6];
+               if ((size == I2C_SMBUS_BYTE_DATA && value > 0xff)
+                   || (size == I2C_SMBUS_WORD_DATA && value > 0xffff)) {
+                       fprintf(stderr, "Error: Data value out of range!\n");
+                       help();
+               }
+               break;
+       case I2C_SMBUS_BLOCK_DATA:
+       case I2C_SMBUS_I2C_BLOCK_DATA:
+               for (len = 0; len + flags + 5 < argc; len++) {
+                       value = strtol(argv[flags + len + 4], &end, 0);
+                       if (*end || value < 0) {
+                               fprintf(stderr, "Error: Data value invalid!\n");
+                               help();
+                       }
+                       if (value > 0xff) {
+                               fprintf(stderr, "Error: Data value out of 
range!\n");
+                               help();
+                       }
+                       block[len] = value;
+               }
+               value = -1;
+               break;
+       default:
+               value = -1;
+               break;
        }
 
        if (maskp) {
@@ -228,12 +300,11 @@
                        fprintf(stderr, "Error: Data value mask invalid!\n");
                        help();
                }
-       }
-
-       if ((size == I2C_SMBUS_BYTE_DATA && value > 0xff)
-        || (size == I2C_SMBUS_WORD_DATA && value > 0xffff)) {
-               fprintf(stderr, "Error: Data value out of range!\n");
-               help();
+               if (((size == I2C_SMBUS_BYTE || size == I2C_SMBUS_BYTE_DATA)
+                    && vmask > 0xff) || vmask > 0xffff) {
+                       fprintf(stderr, "Error: Data value mask out of 
range!\n");
+                       help();
+               }
        }
 
        file = open_i2c_dev(i2cbus, filename, sizeof(filename), 0);
@@ -243,7 +314,7 @@
                exit(1);
 
        if (!yes && !confirm(filename, address, size, daddress,
-                            value, vmask, pec))
+                            value, vmask, block, len, pec))
                exit(0);
 
        if (vmask) {
@@ -299,8 +370,15 @@
        case I2C_SMBUS_WORD_DATA:
                res = i2c_smbus_write_word_data(file, daddress, value);
                break;
+       case I2C_SMBUS_BLOCK_DATA:
+               res = i2c_smbus_write_block_data(file, daddress, len, block);
+               break;
+       case I2C_SMBUS_I2C_BLOCK_DATA:
+               res = i2c_smbus_write_i2c_block_data(file, daddress, len, 
block);
+               break;
        default: /* I2C_SMBUS_BYTE_DATA */
                res = i2c_smbus_write_byte_data(file, daddress, value);
+               break;
        }
        if (res < 0) {
                fprintf(stderr, "Error: Write failed\n");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-3.0.3/version.h 
new/i2c-tools-3.1.0/version.h
--- old/i2c-tools-3.0.3/version.h       2010-12-12 13:42:13.000000000 +0100
+++ new/i2c-tools-3.1.0/version.h       2011-12-04 18:33:54.000000000 +0100
@@ -1 +1 @@
-#define VERSION "3.0.3"
+#define VERSION "3.1.0"

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to