Hello community,

here is the log from the commit of package i2c-tools for openSUSE:Factory 
checked in at 2018-12-10 12:26:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/i2c-tools (Old)
 and      /work/SRC/openSUSE:Factory/.i2c-tools.new.19453 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "i2c-tools"

Mon Dec 10 12:26:44 2018 rev:35 rq:653858 version:4.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/i2c-tools/i2c-tools.changes      2017-12-23 
12:16:31.400251875 +0100
+++ /work/SRC/openSUSE:Factory/.i2c-tools.new.19453/i2c-tools.changes   
2018-12-10 12:26:45.742621430 +0100
@@ -1,0 +2,22 @@
+Tue Dec  4 11:08:28 UTC 2018 - Jan Engelhardt <[email protected]>
+
+- Replace old $RPM_* shell vars; use macros where they are
+  normally used in other packages.
+
+-------------------------------------------------------------------
+Mon Dec  3 16:30:06 CET 2018 - [email protected]
+
+- Update to version 4.1:
+  * New option -a to allow using reserved address
+  * Several build races fixed
+  * Fix for potential buffer overflows
+  * Support for DDR4 SDRAM memory
+  * Updated list of memory vendors
+  * Clarify library license
+  * Fix error propagation in py-smbus
+- Removed obsolete build-lib-add-missing-dependencies.patch,
+  build-tools-add-missing-dependencies.patch,
+  decode-dimms-hackweek-DDR4.patch,
+  i2cbusses-path-overflows.patch (upstream)
+
+-------------------------------------------------------------------

Old:
----
  build-lib-add-missing-dependencies.patch
  build-tools-add-missing-dependencies.patch
  decode-dimms-hackweek-DDR4.patch
  i2c-tools-4.0.tar.sign
  i2c-tools-4.0.tar.xz
  i2cbusses-path-overflows.patch

New:
----
  i2c-tools-4.1.tar.sign
  i2c-tools-4.1.tar.xz

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

Other differences:
------------------
++++++ i2c-tools.spec ++++++
--- /var/tmp/diff_new_pack.0YLLqq/_old  2018-12-10 12:26:46.294620880 +0100
+++ /var/tmp/diff_new_pack.0YLLqq/_new  2018-12-10 12:26:46.298620875 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package i2c-tools
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,25 +12,21 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           i2c-tools
-Version:        4.0
+Version:        4.1
 Release:        0
 Summary:        A heterogeneous set of I2C tools for Linux
-License:        GPL-2.0+
+License:        GPL-2.0-or-later
 Group:          Development/Tools/Other
 Requires:       udev
 Recommends:     modules
 Url:            https://i2c.wiki.kernel.org/index.php/I2C_Tools
 Source0:        
https://www.kernel.org/pub/software/utils/i2c-tools/%{name}-%{version}.tar.xz
 Source1:        
https://www.kernel.org/pub/software/utils/i2c-tools/%{name}-%{version}.tar.sign
-Patch1:         i2cbusses-path-overflows.patch
-Patch2:         build-lib-add-missing-dependencies.patch
-Patch3:         decode-dimms-hackweek-DDR4.patch
-Patch4:         build-tools-add-missing-dependencies.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 ExcludeArch:    s390 s390x
 
@@ -41,7 +37,7 @@
 
 %package -n libi2c0
 Summary:        I2C/SMBus bus access library
-License:        LGPL-2.1+
+License:        LGPL-2.1-or-later
 Group:          System/Libraries
 
 %description -n libi2c0
@@ -49,8 +45,8 @@
 connected to the I2C or SMBus buses of the system.
 
 %package -n libi2c0-devel
-Summary:        I2C/SMBus bus access library
-License:        LGPL-2.1+
+Summary:        Development files for the I2C/SMBus bus access library
+License:        LGPL-2.1-or-later
 Group:          Development/Libraries/C and C++
 Requires:       glibc-devel
 Requires:       libi2c0 = %{version}
@@ -62,18 +58,14 @@
 
 %prep
 %setup -q
-%patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
 
 %build
-make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" CC="%{__cc}" BUILD_STATIC_LIB:=0
+make %{?_smp_mflags} CFLAGS="%{optflags}" CC="%{__cc}" BUILD_STATIC_LIB:=0
 
 %install
-make install DESTDIR=$RPM_BUILD_ROOT prefix=/usr libdir=%{_libdir} 
BUILD_STATIC_LIB:=0
+%make_install PREFIX=/usr libdir=%{_libdir} BUILD_STATIC_LIB:=0
 # cleanup
-rm -f $RPM_BUILD_ROOT/usr/bin/decode-edid
+rm -f "%{buildroot}/usr/bin/decode-edid"
 
 %post -n libi2c0 -p /sbin/ldconfig
 
@@ -81,17 +73,17 @@
 
 %files
 %defattr(-,root,root)
-/usr/bin/*
-/usr/sbin/*
-%doc /usr/share/man/man1/*.1.gz
-%doc /usr/share/man/man8/*.8.gz
+%{_bindir}/*
+%{_sbindir}/*
+%{_mandir}/man1/*.1.gz
+%{_mandir}/man8/*.8.gz
 
 %files -n libi2c0
 %{_libdir}/libi2c.so.0*
 
 %files -n libi2c0-devel
 %{_libdir}/libi2c.so
-%dir /usr/include/i2c
-/usr/include/i2c/smbus.h
+%dir %{_includedir}/i2c
+%{_includedir}/i2c/smbus.h
 
 %changelog

++++++ i2c-tools-4.0.tar.xz -> i2c-tools-4.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/CHANGES new/i2c-tools-4.1/CHANGES
--- old/i2c-tools-4.0/CHANGES   2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/CHANGES   2018-11-30 15:15:21.000000000 +0100
@@ -1,6 +1,27 @@
 i2c-tools CHANGES
 -----------------
 
+4.1 (2018-11-30)
+  Makefile: Make STRIP, DESTDIR and PREFIX overridable
+  tools: Fix potential buffer overflows in i2cbusses
+         Fix build race
+         Allow usage of reserved addresses with the '-a' flag
+  decode-dimms: Add preliminary DDR4 support
+                Decode size and timings of DDR4
+                Decode misc parameters of DDR4
+                Decode physical characteristics of DDR4
+                Documentation update for DDR4
+                Verify the CRC of DDR4 data block 1
+                Update manufacturer IDs (JEP106AX)
+  eeprog: Fix ambiguous parentheses
+          Fix build race
+  i2ctransfer: Rename option '-f' to '-a' for consistency
+  i2c-dev.h: Delete
+  library: Fix build race
+           Allow disabling the dynamic flavor
+           Mention the correct license in source files
+  py-smbus: Fix i2c_smbus_* error propagation
+
 4.0 (2017-10-30)
   tools: Fix build with recent compilers (gcc 4.6+)
          Add examples to the manual pages
@@ -54,6 +75,7 @@
             Marked as deprecated
   i2cdetect: Do a best effort detection if functionality is missing
              Clarify the SMBus commands used for probing by default
+  i2ctransfer: New tool to send user-defined I2C messages in one transfer
   i2c-dev.h: Minimize differences with kernel flavor
              Move SMBus helper functions to include/i2c/smbus.h
   i2c-stub-from-dump: Be more tolerant on input dump format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/Makefile new/i2c-tools-4.1/Makefile
--- old/i2c-tools-4.0/Makefile  2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/Makefile  2018-11-30 15:15:21.000000000 +0100
@@ -7,14 +7,14 @@
 # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
 
-DESTDIR        =
-prefix = /usr/local
-bindir = $(prefix)/bin
-sbindir        = $(prefix)/sbin
-mandir = $(prefix)/share/man
+DESTDIR        ?=
+PREFIX ?= /usr/local
+bindir = $(PREFIX)/bin
+sbindir        = $(PREFIX)/sbin
+mandir = $(PREFIX)/share/man
 man8dir        = $(mandir)/man8
-incdir = $(prefix)/include
-libdir = $(prefix)/lib
+incdir = $(PREFIX)/include
+libdir = $(PREFIX)/lib
 
 INSTALL                := install
 INSTALL_DATA   := $(INSTALL) -m 644
@@ -25,6 +25,7 @@
 
 CC     ?= gcc
 AR     ?= ar
+STRIP  ?= strip
 
 CFLAGS         ?= -O2
 # When debugging, use the following instead
@@ -32,12 +33,22 @@
 CFLAGS         += -Wall
 SOCFLAGS       := -fpic -D_REENTRANT $(CFLAGS)
 
-USE_STATIC_LIB ?= 0
+BUILD_DYNAMIC_LIB ?= 1
 BUILD_STATIC_LIB ?= 1
+USE_STATIC_LIB ?= 0
+
 ifeq ($(USE_STATIC_LIB),1)
 BUILD_STATIC_LIB := 1
 endif
 
+ifeq ($(BUILD_DYNAMIC_LIB),0)
+ifeq ($(BUILD_STATIC_LIB),0)
+$(error BUILD_DYNAMIC_LIB and BUILD_STATIC_LIB cannot be disabled at the same 
time)
+else
+USE_STATIC_LIB := 1
+endif
+endif
+
 KERNELVERSION  := $(shell uname -r)
 
 .PHONY: all strip clean install uninstall
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/README new/i2c-tools-4.1/README
--- old/i2c-tools-4.0/README    2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/README    2018-11-30 15:15:21.000000000 +0100
@@ -62,9 +62,19 @@
 tools, and "make install" to install them. You also can use "make uninstall"
 to remove all the files you installed. By default, files are installed in
 /usr/local but you can change the location by editing the Makefile file and
-setting prefix to wherever you want. You may change the C compiler and the
-compilation flags as well, and also decide whether to build the static
-library or not.
+setting PREFIX to wherever you want (or setting its value on the make
+command line). You may change the C compiler and the compilation flags as
+well, and also decide which flavors of the library will be built.
+
+In cases where you need to compile only the static or dynamic variant of
+the library, you can use BUILD_STATIC_LIB and BUILD_DYNAMIC_LIB at compile
+time:
+  $ make BUILD_DYNAMIC_LIB=1 BUILD_STATIC_LIB=0
+If you disable both, the compilation will abort with an error message.
+
+If you want to compile the tools against the static version of the library
+you can do:
+  $ make USE_STATIC_LIB=1
 
 Optionally, you can run "make strip" prior to "make install" if you want
 smaller binaries. However, be aware that this will prevent any further
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/eeprog/24cXX.c 
new/i2c-tools-4.1/eeprog/24cXX.c
--- old/i2c-tools-4.0/eeprog/24cXX.c    2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/eeprog/24cXX.c    2018-11-30 15:15:21.000000000 +0100
@@ -87,7 +87,8 @@
                return -1;
 
        // get funcs list
-       if((r = ioctl(fd, I2C_FUNCS, &funcs) < 0))
+       r = ioctl(fd, I2C_FUNCS, &funcs);
+       if (r < 0)
                return r;
 
        
@@ -100,7 +101,8 @@
        CHECK_I2C_FUNC( funcs, I2C_FUNC_SMBUS_WRITE_WORD_DATA );
 
        // set working device
-       if( ( r = ioctl(fd, I2C_SLAVE, addr)) < 0)
+       r = ioctl(fd, I2C_SLAVE, addr);
+       if (r < 0)
                return r;
        e->fd = fd;
        e->addr = addr;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/eeprog/Module.mk 
new/i2c-tools-4.1/eeprog/Module.mk
--- old/i2c-tools-4.0/eeprog/Module.mk  2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/eeprog/Module.mk  2018-11-30 15:15:21.000000000 +0100
@@ -20,7 +20,7 @@
 # Programs
 #
 
-$(EEPROG_DIR)/eeprog: $(EEPROG_DIR)/eeprog.o $(EEPROG_DIR)/24cXX.o
+$(EEPROG_DIR)/eeprog: $(EEPROG_DIR)/eeprog.o $(EEPROG_DIR)/24cXX.o $(LIB_DEPS)
        $(CC) $(LDFLAGS) -o $@ $^ $(EEPROG_LDFLAGS)
 
 #
@@ -40,7 +40,7 @@
 all-eeprog: $(addprefix $(EEPROG_DIR)/,$(EEPROG_TARGETS))
 
 strip-eeprog: $(addprefix $(EEPROG_DIR)/,$(EEPROG_TARGETS))
-       strip $(addprefix $(EEPROG_DIR)/,$(EEPROG_TARGETS))
+       $(STRIP) $(addprefix $(EEPROG_DIR)/,$(EEPROG_TARGETS))
 
 clean-eeprog:
        $(RM) $(addprefix $(EEPROG_DIR)/,*.o $(EEPROG_TARGETS))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/eeprom/decode-dimms 
new/i2c-tools-4.1/eeprom/decode-dimms
--- old/i2c-tools-4.0/eeprom/decode-dimms       2017-10-30 10:07:20.000000000 
+0100
+++ new/i2c-tools-4.1/eeprom/decode-dimms       2018-11-30 15:15:21.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-2013  Jean Delvare <[email protected]>
+# Copyright (C) 2005-2017  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
@@ -336,8 +336,86 @@
  "AP Memory", "Douqi Technology", "Etron Technology Inc.",
  "Indie Semiconductor", "Socionext Inc.", "HGST", "EVGA",
  "Audience Inc.", "EpicGear", "Vitesse Enterprise Co.",
- "Foxtronn International Corporation", "Bretelon Inc.",
- "Zbit Semiconductor Inc."]
+ "Foxtronn International Corporation", "Bretelon Inc.", "Graphcore", "Eoplex 
Inc",
+ "MaxLinear Inc", "ETA Devices", "LOKI", "IMS Electronics Co Ltd",
+ "Dosilicon Co Ltd", "Dolphin Integration", "Shenzhen Mic Electronics 
Technolog",
+ "Boya Microelectronics Inc", "Geniachip (Roche)", "Axign", "Kingred 
Electronic Technology Ltd",
+ "Chao Yue Zhuo Computer Business Dept.", "Guangzhou Si Nuo Electronic 
Technology.",
+ "Crocus Technology Inc", "Creative Chips GmbH", "GE Aviation Systems LLC.",
+ "Asgard", "Good Wealth Technology Ltd", "TriCor Technologies", "Nova-Systems 
GmbH",
+ "JUHOR", "Zhuhai Douke Commerce Co Ltd", "DSL Memory", "Anvo-Systems Dresden 
GmbH",
+ "Realtek", "AltoBeam", "Wave Computing", "Beijing TrustNet Technology Co Ltd",
+ "Innovium Inc", "Starsway Technology Limited"],
+["Weltronics Co LTD", "VMware Inc", "Hewlett Packard Enterprise", "INTENSO",
+ "Puya Semiconductor", "MEMORFI", "MSC Technologies GmbH", "Txrui",
+ "SiFive Inc", "Spreadtrum Communications", "XTX Technology Limited",
+ "UMAX Technology", "Shenzhen Yong Sheng Technology", "SNOAMOO (Shenzhen Kai 
Zhuo Yue)",
+ "Daten Tecnologia LTDA", "Shenzhen XinRuiYan Electronics", "Eta Compute",
+ "Energous", "Raspberry Pi Trading Ltd", "Shenzhen Chixingzhe Tech Co Ltd",
+ "Silicon Mobility", "IQ-Analog Corporation", "Uhnder Inc", "Impinj",
+ "DEPO Computers", "Nespeed Sysems", "Yangtze Memory Technologies Co Ltd",
+ "MemxPro Inc", "Tammuz Co Ltd", "Allwinner Technology",
+ "Shenzhen City Futian District Qing Xuan Tong Computer Trading Firm", "XMC",
+ "Teclast", "Maxsun", "Haiguang Integrated Circuit Design", "RamCENTER 
Technology",
+ "Phison Electronics Corporation", "Guizhou Huaxintong Semi-Conductor",
+ "Network Intelligence", "Continental Technology (Holdings)",
+ "Guangzhou Huayan Suning Electronic", "Guangzhou Zhouji Electronic Co Ltd",
+ "Shenzhen Giant Hui Kang Tech Co Ltd", "Shenzhen Yilong Innovative Co Ltd",
+ "Neo Forza", "Lyontek Inc", "Shanghai Kuxin Microelectronics Ltd",
+ "Shenzhen Larix Technology Co Ltd", "Qbit Semiconductor Ltd",
+ "Insignis Technology Corporation", "Lanson Memory Co Ltd",
+ "Shenzhen Superway Electronics Co Ltd", "Canaan-Creative Co Ltd",
+ "Black Diamond Memory", "Shenzhen City Parker Baking Electronics",
+ "Shenzhen Baihong Technology Co Ltd", "GEO Semiconductors", "OCPC", "Artery 
Technology Co Ltd",
+ "Jinyu", "ShenzhenYing Chi Technology Development", "Shenzhen Pengcheng Xin 
Technology",
+ "Pegasus Semiconductor (Shanghai) Co", "Mythic Inc", "Elmos Semiconductor AG",
+ "Kllisre", "Shenzhen Winconway Technology", "Shenzhen Xingmem Technology 
Corp",
+ "Gold Key Technology Co Ltd", "Habana Labs Ltd", "Hoodisk Electronics Co Ltd",
+ "SemsoTai (HK) Technology Co Ltd", "OM Nanotech Pvt. Ltd",
+ "Shenzhen Zhifeng Weiye Technology", "Xinshirui (Shenzhen) Electronics Co",
+ "Guangzhou Zhong Hao Tian Electronic", "Shenzhen Longsys Electronics Co Ltd",
+ "Deciso B.V.", "Puya Semiconductor (Shenzhen)", "Shenzhen Veineda Technology 
Co Ltd",
+ "Antec Memory", "Cortus SAS", "Dust Leopard", "MyWo AS",
+ "J&A Information Inc", "Shenzhen JIEPEI Technology Co Ltd", "Heidelberg 
University",
+ "Flexxon PTE Ltd", "Wiliot", "Raysun Electronics International Ltd",
+ "Aquarius Production Company LLC", "MACNICA DHW LTDA", "Intelimem",
+ "Zbit Semiconductor Inc", "Shenzhen Technology Co Ltd", "Signalchip",
+ "Shenzen Recadata Storage Technology", "Hyundai Technology",
+ "Shanghai Fudi Investment Development", "Aixi Technology", "Tecon MT",
+ "Onda Electric Co Ltd", "Jinshen", "Kimtigo Semiconductor (HK) Limited",
+ "IIT Madras", "Shenshan (Shenzhen) Electronic", "Hefei Core Storage 
Electronic Limited",
+ "Colorful Technology Ltd", "Visenta (Xiamen) Technology Co Ltd", "Roa Logic 
BV",
+ "NSITEXE Inc", "Hong Kong Hyunion Electronics", "ASK Technology Group 
Limited",
+ "GIGA-BYTE Technology Co Ltd", "Terabyte Co Ltd", "Hyundai Inc", "EXCELERAM",
+ "PsiKick", "Netac Technology Co Ltd", "PCCOOLER", "Jiangsu Huacun Electronic 
Technology",
+ "Shenzhen Micro Innovation Industry", "Beijing Tongfang Microelectronics Co",
+ "XZN Storage Technology", "ChipCraft Sp. z.o.o.", "ALLFLASH Technology 
Limited"],
+["Foerd Technology Co Ltd", "KingSpec", "Codasip Ltd", "SL Link Co Ltd",
+ "Shenzhen Kefu Technology Co Limited", "Shenzhen ZST Electronics Technology",
+ "Kyokuto Electronic Inc", "Warrior Technology", "TRINAMIC Motion Control GmbH 
& Co",
+ "PixelDisplay Inc", "Shenzhen Futian District Bo Yueda Elec", "Richtek Power",
+ "Shenzhen LianTeng Electronics Co Ltd", "AITC Memory", "UNIC Memory 
Technology Co Ltd",
+ "Shenzhen Huafeng Science Technology", "Innotron Memory Co Ltd",
+ "Guangzhou Xinyi Heng Computer Trading Firm", "SambaNova Systems", "V-GEN",
+ "Jump Trading", "Ampere Computing", "Shenzhen Zhongshi Technology Co Ltd",
+ "Shenzhen Zhongtian Bozhong Technology", "Tri-Tech International",
+ "Silicon Intergrated Systems Corporation", "Shenzhen HongDingChen 
Information",
+ "Plexton Holdings Limited", "AMS (Jiangsu Advanced Memory Semi)",
+ "Wuhan Jing Tian Interconnected Tech Co", "Axia Memory Technology",
+ "Chipset Technology Holding Limited", "Shenzhen Xinshida Technology Co Ltd",
+ "Shenzhen Chuangshifeida Technology", "Guangzhou MiaoYuanJi Technology", 
"ADVAN Inc",
+ "Shenzhen Qianhai Weishengda Electronic Commerce Company Ltd", "Guangzhou 
Guang Xie Cheng Trading",
+ "StarRam International Co Ltd", "Shen Zhen XinShenHua Tech Co Ltd",
+ "UltraMemory Inc", "New Coastline Global Tech Industry Co", "Sinker", 
"Diamond",
+ "PUSKILL", "Guangzhou Hao Jia Ye Technology Co", "Ming Xin Limited", 
"Barefoot Networks",
+ "Biwin Semiconductor (HK) Co Ltd", "UD INFO Corporation", "Trek Technology 
(S) PTE Ltd",
+ "Xiamen Kingblaze Technology Co Ltd", "Shenzhen Lomica Technology Co Ltd",
+ "Nuclei System Technology Co Ltd", "Wuhan Xun Zhan Electronic Technology",
+ "Shenzhen Ingacom Semiconductor Ltd", "Zotac Technology Ltd", "Foxline",
+ "Shenzhen Farasia Science Technology", "Efinix Inc", "Hua Nan San Xian 
Technology Co Ltd",
+ "Goldtech Electronics Co Ltd", "Shanghai Han Rong Microelectronics Co",
+ "Shenzhen Zhongguang Yunhe Trading", "Smart Shine(QingDao) Microelectronics",
+ "Thermaltake Technology Co Ltd", "Shenzhen O'Yang Maile Technology Ltd", 
"UPMEM"]
 );
 
 $use_sysfs = -d '/sys/bus';
@@ -1404,6 +1482,7 @@
        return $byte1 * $mtb + $byte2 * $ftb / 1000;
 }
 
+# Also works for DDR4
 sub ddr3_reference_card($$)
 {
        my ($rrc, $ext) = @_;
@@ -1702,6 +1781,251 @@
 
 }
 
+# Return combined time in ns
+sub ddr4_mtb_ftb($$$$)
+{
+       my ($byte1, $byte2, $mtb, $ftb) = @_;
+
+       # byte1 is unsigned in ps, but byte2 is signed in ps
+       $byte2 -= 0x100 if $byte2 & 0x80;
+
+       return ($byte1 * $mtb + $byte2 * $ftb) / 1000;
+}
+
+# Rounded per DDR4 specifications
+sub ddr4_core_timings($$$$$)
+{
+       my ($cas, $ctime, $trcd, $trp, $tras) = @_;
+
+       return $cas . "-" . ceil($trcd/$ctime - 0.025) .
+                     "-" . ceil($trp/$ctime - 0.025) .
+                     "-" . ceil($tras/$ctime - 0.025);
+}
+
+use constant DDR4_UNBUFFERED   => 1;
+use constant DDR4_REGISTERED   => 2;
+use constant DDR4_LOAD_REDUCED => 4;
+
+# Parameter: EEPROM bytes 0-383 (using 1-255)
+sub decode_ddr4_sdram($)
+{
+       my $bytes = shift;
+       my ($ctime, $ctime_max);
+       my ($ftb, $mtb);
+       my $ii;
+
+       my @module_types = (
+               { type => "Extended type",      },
+               { type => "RDIMM",              family => DDR4_REGISTERED },
+               { type => "UDIMM",              family => DDR4_UNBUFFERED },
+               { type => "SO-DIMM",            family => DDR4_UNBUFFERED },
+               { type => "LRDIMM",             family => DDR4_LOAD_REDUCED },
+               { type => "Mini-RDIMM",         family => DDR4_REGISTERED },
+               { type => "Mini-UDIMM",         family => DDR4_UNBUFFERED },
+               { type => "Reserved (0x07)",    },
+               { type => "72b-SO-RDIMM",       family => DDR4_REGISTERED },
+               { type => "72b-SO-UDIMM",       family => DDR4_UNBUFFERED },
+               { type => "Reserved (0x0A)",    },
+               { type => "Reserved (0x0B)",    },
+               { type => "16b-SO-DIMM",        family => DDR4_UNBUFFERED },
+               { type => "32b-SO-DIMM",        family => DDR4_UNBUFFERED },
+               { type => "Reserved (0x0E)",    },
+               { type => "No base memory",     },
+       );
+
+# SPD revision
+       printl_cond($bytes->[1] != 0xff, "SPD Revision",
+                   ($bytes->[1] >> 4) . "." . ($bytes->[1] & 0xf));
+
+       printl("Module Type", $module_types[$bytes->[3] & 0x0f]->{type});
+
+# CRC of block 1
+       my $crc_calc = calculate_crc($bytes, 128, 126);
+       my $crc_spd = ($bytes->[255] << 8) | $bytes->[254];
+       my $crc_block_1_ok = $crc_calc == $crc_spd;
+       printl("EEPROM CRC of bytes 128-253", $crc_block_1_ok ?
+               sprintf("OK (0x\%04X)", $crc_calc) :
+               sprintf("Bad\n(found 0x\%04X, calculated 0x\%04X)",
+                       $crc_spd, $crc_calc));
+
+# time bases
+       if (($bytes->[17] & 0x03) != 0x00 || ($bytes->[17] & 0xc0) != 0x00) {
+               print STDERR "Unknown time base values, can't decode\n";
+               return;
+       }
+       $ftb = 1;       # ps
+       $mtb = 125;     # ps
+
+# speed
+       prints("Memory Characteristics");
+
+       $ctime = ddr4_mtb_ftb($bytes->[18], $bytes->[125], $mtb, $ftb);
+       $ctime_max = ddr4_mtb_ftb($bytes->[19], $bytes->[124], $mtb, $ftb);
+
+       my $ddrclk = 2 * (1000 / $ctime);
+       my $tbits = 8 << ($bytes->[13] & 7);
+       my $pcclk = int ($ddrclk * $tbits / 8);
+       # Round down to comply with Jedec
+       $pcclk = $pcclk - ($pcclk % 100);
+       $ddrclk = int ($ddrclk);
+       printl("Maximum module speed", "$ddrclk MHz (PC4-${pcclk})");
+
+# Size computation
+       my $sdram_width = 4 << ($bytes->[12] & 0x07);
+       my $ranks = (($bytes->[12] >> 3) & 0x07) + 1;
+       my $signal_loading = $bytes->[6] & 0x03;
+       my $die_count = (($bytes->[6] >> 4) & 0x07) + 1;
+       my $cap = (256 << ($bytes->[4] & 0x0f)) / 8;
+       $cap *= (8 << ($bytes->[13] & 0x07)) / $sdram_width;
+       $cap *= $ranks;
+       $cap *= $die_count if $signal_loading == 0x02;          # 3DS
+       printl("Size", $cap . " MB");
+
+       printl("Banks x Rows x Columns x Bits",
+              join(' x ', (1 << ($bytes->[4] >> 6)) * (4 << (($bytes->[4] >> 
4) & 0x03)),
+                          ((($bytes->[5] >> 3) & 7) + 12),
+                          ( ($bytes->[5]       & 7) +  9),
+                          (8 << ($bytes->[13] & 0x07))));
+
+       printl("SDRAM Device Width", "$sdram_width bits");
+       printl("Ranks", $ranks);
+       printl_cond($ranks > 1, "Rank Mix",
+                   $bytes->[12] & 0x40 ? "Asymmetrical" : "Symmetrical");
+       printl_cond($bytes->[13] & 0x18, "Bus Width Extension", ($bytes->[13] & 
0x18)." bits");
+
+       my $taa;
+       my $trcd;
+       my $trp;
+       my $tras;
+
+       $taa  = ddr4_mtb_ftb($bytes->[24], $bytes->[123], $mtb, $ftb);
+       $trcd = ddr4_mtb_ftb($bytes->[25], $bytes->[122], $mtb, $ftb);
+       $trp  = ddr4_mtb_ftb($bytes->[26], $bytes->[121], $mtb, $ftb);
+       $tras = ((($bytes->[27] & 0x0f) << 8) + $bytes->[28]) * $mtb / 1000;
+
+       printl("AA-RCD-RP-RAS (cycles)",
+              ddr4_core_timings(ceil($taa/$ctime - 0.025), $ctime,
+                                $trcd, $trp, $tras));
+
+# latencies
+       my %cas;
+       my $cas_sup = ($bytes->[23] << 24) + ($bytes->[22] << 16) +
+                     ($bytes->[21] << 8) + $bytes->[20];
+       my $base_cas = $bytes->[23] & 0x80 ? 23 : 7;
+
+       for ($ii = 0; $ii < 30; $ii++) {
+               if ($cas_sup & (1 << $ii)) {
+                       $cas{$base_cas + $ii}++;
+               }
+       }
+       printl("Supported CAS Latencies", cas_latencies(keys %cas));
+
+# standard DDR4 speeds
+       prints("Timings at Standard Speeds");
+       foreach my $ctime_at_speed (15/24, 15/22, 15/20, 15/18, 15/16, 15/14, 
15/12) {
+               my $best_cas = 0;
+
+               # Find min CAS latency at this speed
+               for ($ii = 29; $ii >= 0; $ii--) {
+                       next unless ($cas_sup & (1 << $ii));
+                       if (ceil($taa/$ctime_at_speed - 0.025) <= $base_cas + 
$ii) {
+                               $best_cas = $base_cas + $ii;
+                       }
+               }
+
+               printl_cond($best_cas && $ctime_at_speed >= $ctime
+                                     && $ctime_at_speed <= $ctime_max,
+                           "AA-RCD-RP-RAS (cycles)" . as_ddr(4, 
$ctime_at_speed),
+                           ddr4_core_timings($best_cas, $ctime_at_speed,
+                                            $trcd, $trp, $tras));
+       }
+
+# more timing information
+       prints("Timing Parameters");
+
+       printl("Minimum Cycle Time (tCKmin)", tns3($ctime));
+       printl("Maximum Cycle Time (tCKmax)", tns3($ctime_max));
+       printl("Minimum CAS Latency Time (tAA)", tns3($taa));
+       printl("Minimum RAS to CAS Delay (tRCD)", tns3($trcd));
+       printl("Minimum Row Precharge Delay (tRP)", tns3($trp));
+       printl("Minimum Active to Precharge Delay (tRAS)", tns3($tras));
+       printl("Minimum Active to Auto-Refresh Delay (tRC)",
+               tns3(ddr4_mtb_ftb((($bytes->[27] & 0xf0) << 4) + $bytes->[29],
+                                 $bytes->[120], $mtb, $ftb)));
+       printl("Minimum Recovery Delay (tRFC1)",
+               tns3((($bytes->[31] << 8) + $bytes->[30]) * $mtb / 1000));
+       printl("Minimum Recovery Delay (tRFC2)",
+               tns3((($bytes->[33] << 8) + $bytes->[32]) * $mtb / 1000));
+       printl("Minimum Recovery Delay (tRFC4)",
+               tns3((($bytes->[35] << 8) + $bytes->[34]) * $mtb / 1000));
+       printl("Minimum Four Activate Window Delay (tFAW)",
+               tns3(((($bytes->[36] & 0x0f) << 8) + $bytes->[37]) * $mtb / 
1000));
+       printl("Minimum Row Active to Row Active Delay (tRRD_S)",
+               tns3(ddr4_mtb_ftb($bytes->[38], $bytes->[119], $mtb, $ftb)));
+       printl("Minimum Row Active to Row Active Delay (tRRD_L)",
+               tns3(ddr4_mtb_ftb($bytes->[39], $bytes->[118], $mtb, $ftb)));
+       printl("Minimum CAS to CAS Delay (tCCD_L)",
+               tns3(ddr4_mtb_ftb($bytes->[40], $bytes->[117], $mtb, $ftb)));
+
+       # Optional?
+       my $twr = ((($bytes->[41] & 0x0f) << 8) + $bytes->[42]) * $mtb / 1000;
+       printl_cond($twr, "Minimum Write Recovery Time (tWR)", tns3($twr));
+       my $twtr = ((($bytes->[43] & 0x0f) << 8) + $bytes->[44]) * $mtb / 1000;
+       printl_cond($twtr, "Minimum Write to Read Time (tWTR_S)", tns3($twtr));
+       $twtr = ((($bytes->[43] & 0xf0) << 4) + $bytes->[45]) * $mtb / 1000;
+       printl_cond($twtr, "Minimum Write to Read Time (tWTR_L)", tns3($twtr));
+
+# miscellaneous stuff
+       prints("Other Information");
+
+       my $package_type = ($bytes->[6] & 0x80) == 0x00 ? "Monolithic" :
+                          $signal_loading == 0x01 ? "Multi-load stack" :
+                          $signal_loading == 0x02 ? "3DS" : "Unknown";
+       $package_type .= sprintf(" (%u dies)", $die_count) if $die_count >= 2;
+       printl("Package Type", $package_type);
+
+       my @mac = ("Untested",
+                  "700 K", "600 K", "500 K", "400 K", "300 K", "200 K",
+                  undef, "Unlimited");
+       my $mac = $bytes->[7] & 0x0f;
+       printl_cond(defined $mac[$mac], "Maximum Activate Count", $mac[$mac]);
+
+       my $ppr = $bytes->[9] >> 6;
+       printl("Post Package Repair",
+              $ppr == 0x00 ? "Not supported" :
+              $ppr == 0x01 ? "One row per bank group" : "Unknown");
+       printl_cond($ppr != 0x00, "Soft PPR", $bytes->[9] & 0x20 ?
+                   "Supported" : "Not Supported");
+
+       printl("Module Nominal Voltage",
+              $bytes->[11] & 0x01 ? "1.2 V" :
+              $bytes->[11] & 0x02 ? "Unknown (1.2 V endurant)" : "Unknown");
+
+       printl("Thermal Sensor",
+              $bytes->[14] & 0x80 ? "TSE2004 compliant" : "No");
+
+# type-specific settings
+       return unless $crc_block_1_ok || $opt_igncheck;
+
+       if ($module_types[$bytes->[3] & 0x0f]->{family} == DDR4_UNBUFFERED ||
+           $module_types[$bytes->[3] & 0x0f]->{family} == DDR4_REGISTERED ||
+           $module_types[$bytes->[3] & 0x0f]->{family} == DDR4_LOAD_REDUCED) {
+               prints("Physical Characteristics");
+
+               my $height = $bytes->[128] & 0x1f;
+               printl("Module Height",
+                      $height == 0x00 ? "15 mm or less" :
+                      $height == 0x1f ? "more than 45 mm" :
+                      sprintf("%u mm", $height + 15));
+               printl("Module Thickness",
+                      sprintf("%d mm front, %d mm back",
+                              ($bytes->[129] & 0x0f) + 1,
+                              (($bytes->[129] >> 4) & 15) + 1));
+               printl("Module Reference Card",
+                      ddr3_reference_card($bytes->[130], $bytes->[128]));
+       }
+}
+
 # Parameter: EEPROM bytes 0-127 (using 4-5)
 sub decode_direct_rambus($)
 {
@@ -1747,6 +2071,10 @@
        "DDR SDRAM"     => \&decode_ddr_sdram,
        "DDR2 SDRAM"    => \&decode_ddr2_sdram,
        "DDR3 SDRAM"    => \&decode_ddr3_sdram,
+       "DDR4 SDRAM"    => \&decode_ddr4_sdram,
+       "DDR4E SDRAM"   => \&decode_ddr4_sdram,
+       "LPDDR4 SDRAM"  => \&decode_ddr4_sdram,
+       "LPDDR4X SDRAM" => \&decode_ddr4_sdram,
        "Direct Rambus" => \&decode_direct_rambus,
        "Rambus"        => \&decode_rambus,
 );
@@ -1819,6 +2147,35 @@
                    sprintf("0x%02X%02X", $bytes->[146], $bytes->[147]));
 }
 
+# Parameter: EEPROM bytes 0-383 (using 320-351)
+sub decode_ddr4_mfg_data($)
+{
+       my $bytes = shift;
+
+       prints("Manufacturer Data");
+
+       printl("Module Manufacturer",
+              manufacturer_ddr3($bytes->[320], $bytes->[321]));
+
+       printl_cond(spd_written(@{$bytes}[350..351]),
+                   "DRAM Manufacturer",
+                   manufacturer_ddr3($bytes->[350], $bytes->[351]));
+
+       printl_mfg_location_code($bytes->[322]);
+
+       printl_cond(spd_written(@{$bytes}[323..324]),
+                   "Manufacturing Date",
+                   manufacture_date($bytes->[323], $bytes->[324]));
+
+       printl_mfg_assembly_serial(@{$bytes}[325..328]);
+
+       printl("Part Number", part_number(@{$bytes}[329..348]));
+
+       printl_cond(spd_written(@{$bytes}[349]),
+                   "Revision Code",
+                   sprintf("0x%02X", $bytes->[349]));
+}
+
 # Parameter: EEPROM bytes 0-127 (using 64-98)
 sub decode_manufacturing_information($)
 {
@@ -1941,8 +2298,14 @@
 sub spd_sizes($)
 {
        my $bytes = shift;
+       my $type = $bytes->[2];
 
-       if ($bytes->[2] >= 9) {
+       if ($type == 12 || $type == 14 || $type == 16 || $type == 17) {
+               # DDR4
+               my $spd_len = 256 * (($bytes->[0] >> 4) & 7);
+               my $used = 128 * ($bytes->[0] & 15);
+               return ($spd_len, $used);
+       } elsif ($type >= 9) {
                # For FB-DIMM and newer, decode number of bytes written
                my $spd_len = ($bytes->[0] >> 4) & 7;
                my $size = 64 << ($bytes->[0] & 15);
@@ -2014,15 +2377,14 @@
 }
 
 # Calculate and verify CRC
-sub check_crc($)
+sub calculate_crc($$$)
 {
-       my $bytes = shift;
+       my ($bytes, $start, $len) = @_;
        my $crc = 0;
-       my $crc_cover = $bytes->[0] & 0x80 ? 116 : 125;
-       my $crc_ptr = 0;
+       my $crc_ptr = $start;
        my $crc_bit;
 
-       while ($crc_ptr <= $crc_cover) {
+       while ($crc_ptr < $start + $len) {
                $crc = $crc ^ ($bytes->[$crc_ptr] << 8);
                for ($crc_bit = 0; $crc_bit < 8; $crc_bit++) {
                        if ($crc & 0x8000) {
@@ -2033,7 +2395,15 @@
                }
                $crc_ptr++;
        }
-       $crc &= 0xffff;
+
+       return $crc & 0xffff;
+}
+
+sub check_crc($)
+{
+       my $bytes = shift;
+       my $crc_cover = $bytes->[0] & 0x80 ? 116 : 125;
+       my $crc = calculate_crc($bytes, 0, $crc_cover + 1);
 
        my $dimm_crc = ($bytes->[127] << 8) | $bytes->[126];
        return ("EEPROM CRC of bytes 0-$crc_cover",
@@ -2136,7 +2506,9 @@
        my (@dirs, $dir, $opened, $file, @files);
 
        if ($use_sysfs) {
-               @dirs = ('/sys/bus/i2c/drivers/eeprom', 
'/sys/bus/i2c/drivers/at24');
+               @dirs = ('/sys/bus/i2c/drivers/eeprom',
+                        '/sys/bus/i2c/drivers/at24',
+                        '/sys/bus/i2c/drivers/ee1004');        # DDR4
        } else {
                @dirs = ('/proc/sys/dev/sensors');
        }
@@ -2154,7 +2526,9 @@
                                # or spd (driver at24)
                                my $attr = sysfs_device_attribute("$dir/$file", 
"name");
                                next unless defined $attr &&
-                                           ($attr eq "eeprom" || $attr eq 
"spd");
+                                           ($attr eq "eeprom" ||
+                                            $attr eq "spd" ||
+                                            $attr eq "ee1004");        # DDR4
                        } else {
                                next unless $file =~ /^eeprom-/;
                        }
@@ -2285,6 +2659,9 @@
                        "DDR SGRAM", "DDR SDRAM",       # 6, 7
                        "DDR2 SDRAM", "FB-DIMM",        # 8, 9
                        "FB-DIMM Probe", "DDR3 SDRAM",  # 10, 11
+                       "DDR4 SDRAM", "Reserved",       # 12, 13
+                       "DDR4E SDRAM", "LPDDR3 SDRAM",  # 14, 15
+                       "LPDDR4 SDRAM", "LPDDR4X SDRAM", # 16, 17
                );
                if ($bytes[2] < @type_list) {
                        $type = $type_list[$bytes[2]];
@@ -2300,6 +2677,13 @@
                # Decode DDR3-specific manufacturing data in bytes
                # 117-149
                decode_ddr3_mfg_data(\@bytes)
+       } elsif ($type eq "DDR4 SDRAM" ||
+                $type eq "DDR4E SDRAM" ||
+                $type eq "LPDDR4 SDRAM" ||
+                $type eq "LPDDR4X SDRAM") {
+               # Decode DDR4-specific manufacturing data in bytes
+               # 320-383
+               decode_ddr4_mfg_data(\@bytes)
        } else {
                # Decode next 35 bytes (64-98, common to most
                # memory types)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/eeprom/decode-dimms.1 
new/i2c-tools-4.1/eeprom/decode-dimms.1
--- old/i2c-tools-4.0/eeprom/decode-dimms.1     2017-10-30 10:07:20.000000000 
+0100
+++ new/i2c-tools-4.1/eeprom/decode-dimms.1     2018-11-30 15:15:21.000000000 
+0100
@@ -1,6 +1,7 @@
 .\"
 .\"  decode-dimms.1 - manpage for the i2c-tools/decode-dimms utility
 .\"  Copyright (C) 2013  Jaromir Capik
+.\"  Copyright (C) 2017  Jean Delvare
 .\"
 .\"  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
@@ -16,7 +17,7 @@
 .\"  with this program; if not, write to the Free Software Foundation, Inc.,
 .\"  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 .\"
-.TH decode-dimms 1 "Oct 2013" "i2c-tools" "User Commands"
+.TH decode-dimms 1 "Nov 2017" "i2c-tools" "User Commands"
 .SH NAME
 decode-dimms \- decode the information found in memory module SPD EEPROMs
 .SH SYNOPSIS
@@ -31,8 +32,8 @@
 .B decode-dimms
 tool is to decode the information found in memory module SPD EEPROMs.
 The SPD data is read either from the running system or dump files.
-In the former case, the tool requires either the eeprom kernel module
-or the at24 kernel module to be loaded.
+In the former case, the tool requires a kernel module to be loaded:
+eeprom, at24 or ee1004 (for DDR4 SDRAM.)
 .SH PARAMETERS
 .TP
 .B \-f, --format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/include/i2c/smbus.h 
new/i2c-tools-4.1/include/i2c/smbus.h
--- old/i2c-tools-4.0/include/i2c/smbus.h       2017-10-30 10:07:20.000000000 
+0100
+++ new/i2c-tools-4.1/include/i2c/smbus.h       2018-11-30 15:15:21.000000000 
+0100
@@ -1,23 +1,14 @@
 /*
     smbus.h - SMBus level access helper functions
 
-    Copyright (C) 1995-97 Simon G. Vogl
-    Copyright (C) 1998-99 Frodo Looijaard <[email protected]>
+    Copyright (C) 1995-1997  Simon G. Vogl
+    Copyright (C) 1998-1999  Frodo Looijaard <[email protected]>
+    Copyright (C) 2012-2017  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
-    the Free Software Foundation; either version 2 of the License, or
+    This library is free software; you can redistribute it and/or modify
+    it under the terms of the GNU Lesser General Public License as published
+    by the Free Software Foundation; either version 2.1 of the License, or
     (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-    MA 02110-1301 USA.
 */
 
 #ifndef LIB_I2C_SMBUS_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/include/linux/i2c-dev.h 
new/i2c-tools-4.1/include/linux/i2c-dev.h
--- old/i2c-tools-4.0/include/linux/i2c-dev.h   2017-10-30 10:07:20.000000000 
+0100
+++ new/i2c-tools-4.1/include/linux/i2c-dev.h   1970-01-01 01:00:00.000000000 
+0100
@@ -1,72 +0,0 @@
-/*
-    i2c-dev.h - i2c-bus driver, char device interface
-
-    Copyright (C) 1995-97 Simon G. Vogl
-    Copyright (C) 1998-99 Frodo Looijaard <[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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-    MA 02110-1301 USA.
-*/
-
-#ifndef _LINUX_I2C_DEV_H
-#define _LINUX_I2C_DEV_H
-
-#include <linux/types.h>
-
-
-/* /dev/i2c-X ioctl commands.  The ioctl's parameter is always an
- * unsigned long, except for:
- *     - I2C_FUNCS, takes pointer to an unsigned long
- *     - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data
- *     - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data
- */
-#define I2C_RETRIES    0x0701  /* number of times a device address should
-                                  be polled when not acknowledging */
-#define I2C_TIMEOUT    0x0702  /* set timeout in units of 10 ms */
-
-/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses
- * are NOT supported! (due to code brokenness)
- */
-#define I2C_SLAVE      0x0703  /* Use this slave address */
-#define I2C_SLAVE_FORCE        0x0706  /* Use this slave address, even if it
-                                  is already in use by a driver! */
-#define I2C_TENBIT     0x0704  /* 0 for 7 bit addrs, != 0 for 10 bit */
-
-#define I2C_FUNCS      0x0705  /* Get the adapter functionality mask */
-
-#define I2C_RDWR       0x0707  /* Combined R/W transfer (one STOP only) */
-
-#define I2C_PEC                0x0708  /* != 0 to use PEC with SMBus */
-#define I2C_SMBUS      0x0720  /* SMBus transfer */
-
-
-/* This is the structure as used in the I2C_SMBUS ioctl call */
-struct i2c_smbus_ioctl_data {
-       __u8 read_write;
-       __u8 command;
-       __u32 size;
-       union i2c_smbus_data *data;
-};
-
-/* This is the structure as used in the I2C_RDWR ioctl call */
-struct i2c_rdwr_ioctl_data {
-       struct i2c_msg *msgs;   /* pointers to i2c_msgs */
-       __u32 nmsgs;                    /* number of i2c_msgs */
-};
-
-#define  I2C_RDRW_IOCTL_MAX_MSGS       42
-
-
-#endif /* _LINUX_I2C_DEV_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/lib/Module.mk 
new/i2c-tools-4.1/lib/Module.mk
--- old/i2c-tools-4.0/lib/Module.mk     2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/lib/Module.mk     2018-11-30 15:15:21.000000000 +0100
@@ -18,7 +18,7 @@
 # interface is changed in a backward incompatible way.  The interface is
 # defined by the public header files - in this case they are only smbus.h.
 LIB_MAINVER    := 0
-LIB_MINORVER   := 1.0
+LIB_MINORVER   := 1.1
 LIB_VER                := $(LIB_MAINVER).$(LIB_MINORVER)
 
 # The shared and static library names
@@ -27,12 +27,20 @@
 LIB_SHLIBNAME  := $(LIB_SHBASENAME).$(LIB_VER)
 LIB_STLIBNAME  := libi2c.a
 
-LIB_TARGETS    := $(LIB_SHLIBNAME)
+LIB_TARGETS    :=
+ifeq ($(BUILD_DYNAMIC_LIB),1)
 LIB_LINKS      := $(LIB_SHSONAME) $(LIB_SHBASENAME)
-LIB_OBJECTS    := smbus.o
+LIB_TARGETS    += $(LIB_SHLIBNAME)
+endif
 ifeq ($(BUILD_STATIC_LIB),1)
 LIB_TARGETS    += $(LIB_STLIBNAME)
-LIB_OBJECTS    += smbus.ao
+endif
+
+# Library file to link against (static or dynamic)
+ifeq ($(USE_STATIC_LIB),1)
+LIB_DEPS       := $(LIB_DIR)/$(LIB_STLIBNAME)
+else
+LIB_DEPS       := $(LIB_DIR)/$(LIB_SHBASENAME)
 endif
 
 #
@@ -42,11 +50,11 @@
 $(LIB_DIR)/$(LIB_SHLIBNAME): $(LIB_DIR)/smbus.o
        $(CC) -shared $(LDFLAGS) -Wl,--version-script=$(LIB_DIR)/libi2c.map 
-Wl,-soname,$(LIB_SHSONAME) -o $@ $^ -lc
 
-$(LIB_DIR)/$(LIB_SHSONAME):
+$(LIB_DIR)/$(LIB_SHSONAME): $(LIB_DIR)/$(LIB_SHLIBNAME)
        $(RM) $@
        $(LN) $(LIB_SHLIBNAME) $@
 
-$(LIB_DIR)/$(LIB_SHBASENAME):
+$(LIB_DIR)/$(LIB_SHBASENAME): $(LIB_DIR)/$(LIB_SHLIBNAME)
        $(RM) $@
        $(LN) $(LIB_SHLIBNAME) $@
 
@@ -73,16 +81,18 @@
 all-lib: $(addprefix $(LIB_DIR)/,$(LIB_TARGETS) $(LIB_LINKS))
 
 strip-lib: $(addprefix $(LIB_DIR)/,$(LIB_TARGETS))
-       strip $(addprefix $(LIB_DIR)/,$(LIB_TARGETS))
+       $(STRIP) $(addprefix $(LIB_DIR)/,$(LIB_TARGETS))
 
 clean-lib:
        $(RM) $(addprefix $(LIB_DIR)/,*.o *.ao $(LIB_TARGETS) $(LIB_LINKS))
 
 install-lib: $(addprefix $(LIB_DIR)/,$(LIB_TARGETS))
        $(INSTALL_DIR) $(DESTDIR)$(libdir)
+ifeq ($(BUILD_DYNAMIC_LIB),1)
        $(INSTALL_PROGRAM) $(LIB_DIR)/$(LIB_SHLIBNAME) $(DESTDIR)$(libdir)
        $(LN) $(LIB_SHLIBNAME) $(DESTDIR)$(libdir)/$(LIB_SHSONAME)
        $(LN) $(LIB_SHSONAME) $(DESTDIR)$(libdir)/$(LIB_SHBASENAME)
+endif
 ifeq ($(BUILD_STATIC_LIB),1)
        $(INSTALL_DATA) $(LIB_DIR)/$(LIB_STLIBNAME) $(DESTDIR)$(libdir)
 endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/lib/smbus.c 
new/i2c-tools-4.1/lib/smbus.c
--- old/i2c-tools-4.0/lib/smbus.c       2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/lib/smbus.c       2018-11-30 15:15:21.000000000 +0100
@@ -5,20 +5,10 @@
     Copyright (C) 1998-1999  Frodo Looijaard <[email protected]>
     Copyright (C) 2012-2013  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
-    the Free Software Foundation; either version 2 of the License, or
+    This library is free software; you can redistribute it and/or modify
+    it under the terms of the GNU Lesser General Public License as published
+    by the Free Software Foundation; either version 2.1 of the License, or
     (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-    MA 02110-1301 USA.
 */
 
 #include <errno.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/py-smbus/smbusmodule.c 
new/i2c-tools-4.1/py-smbus/smbusmodule.c
--- old/i2c-tools-4.0/py-smbus/smbusmodule.c    2017-10-30 10:07:20.000000000 
+0100
+++ new/i2c-tools-4.1/py-smbus/smbusmodule.c    2018-11-30 15:15:21.000000000 
+0100
@@ -13,7 +13,8 @@
  * 
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
  */
 
 #include <Python.h>
@@ -215,7 +216,7 @@
 
        SMBus_SET_ADDR(self, addr);
 
-       if ((result = i2c_smbus_read_byte(self->fd)) == -1) {
+       if ((result = i2c_smbus_read_byte(self->fd)) < 0) {
                PyErr_SetFromErrno(PyExc_IOError);
                return NULL;
        }
@@ -238,7 +239,7 @@
 
        SMBus_SET_ADDR(self, addr);
 
-       if ((result = i2c_smbus_write_byte(self->fd, (__u8)val)) == -1) {
+       if ((result = i2c_smbus_write_byte(self->fd, (__u8)val)) < 0) {
                PyErr_SetFromErrno(PyExc_IOError);
                return NULL;
        }
@@ -262,7 +263,7 @@
 
        SMBus_SET_ADDR(self, addr);
 
-       if ((result = i2c_smbus_read_byte_data(self->fd, (__u8)cmd)) == -1) {
+       if ((result = i2c_smbus_read_byte_data(self->fd, (__u8)cmd)) < 0) {
                PyErr_SetFromErrno(PyExc_IOError);
                return NULL;
        }
@@ -286,7 +287,7 @@
        SMBus_SET_ADDR(self, addr);
 
        if ((result = i2c_smbus_write_byte_data(self->fd,
-                               (__u8)cmd, (__u8)val)) == -1) {
+                               (__u8)cmd, (__u8)val)) < 0) {
                PyErr_SetFromErrno(PyExc_IOError);
                return NULL;
        }
@@ -310,7 +311,7 @@
 
        SMBus_SET_ADDR(self, addr);
 
-       if ((result = i2c_smbus_read_word_data(self->fd, (__u8)cmd)) == -1) {
+       if ((result = i2c_smbus_read_word_data(self->fd, (__u8)cmd)) < 0) {
                PyErr_SetFromErrno(PyExc_IOError);
                return NULL;
        }
@@ -334,7 +335,7 @@
        SMBus_SET_ADDR(self, addr);
 
        if ((result = i2c_smbus_write_word_data(self->fd,
-                               (__u8)cmd, (__u16)val)) == -1) {
+                               (__u8)cmd, (__u16)val)) < 0) {
                PyErr_SetFromErrno(PyExc_IOError);
                return NULL;
        }
@@ -359,7 +360,7 @@
        SMBus_SET_ADDR(self, addr);
 
        if ((result = i2c_smbus_process_call(self->fd,
-                               (__u8)cmd, (__u16)val)) == -1) {
+                               (__u8)cmd, (__u16)val)) < 0) {
                PyErr_SetFromErrno(PyExc_IOError);
                return NULL;
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/tools/Module.mk 
new/i2c-tools-4.1/tools/Module.mk
--- old/i2c-tools-4.0/tools/Module.mk   2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/tools/Module.mk   2018-11-30 15:15:21.000000000 +0100
@@ -24,19 +24,19 @@
 # Programs
 #
 
-$(TOOLS_DIR)/i2cdetect: $(TOOLS_DIR)/i2cdetect.o $(TOOLS_DIR)/i2cbusses.o
+$(TOOLS_DIR)/i2cdetect: $(TOOLS_DIR)/i2cdetect.o $(TOOLS_DIR)/i2cbusses.o 
$(LIB_DEPS)
        $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
-$(TOOLS_DIR)/i2cdump: $(TOOLS_DIR)/i2cdump.o $(TOOLS_DIR)/i2cbusses.o 
$(TOOLS_DIR)/util.o
+$(TOOLS_DIR)/i2cdump: $(TOOLS_DIR)/i2cdump.o $(TOOLS_DIR)/i2cbusses.o 
$(TOOLS_DIR)/util.o $(LIB_DEPS)
        $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
-$(TOOLS_DIR)/i2cset: $(TOOLS_DIR)/i2cset.o $(TOOLS_DIR)/i2cbusses.o 
$(TOOLS_DIR)/util.o
+$(TOOLS_DIR)/i2cset: $(TOOLS_DIR)/i2cset.o $(TOOLS_DIR)/i2cbusses.o 
$(TOOLS_DIR)/util.o $(LIB_DEPS)
        $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
-$(TOOLS_DIR)/i2cget: $(TOOLS_DIR)/i2cget.o $(TOOLS_DIR)/i2cbusses.o 
$(TOOLS_DIR)/util.o
+$(TOOLS_DIR)/i2cget: $(TOOLS_DIR)/i2cget.o $(TOOLS_DIR)/i2cbusses.o 
$(TOOLS_DIR)/util.o $(LIB_DEPS)
        $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
-$(TOOLS_DIR)/i2ctransfer: $(TOOLS_DIR)/i2ctransfer.o $(TOOLS_DIR)/i2cbusses.o 
$(TOOLS_DIR)/util.o
+$(TOOLS_DIR)/i2ctransfer: $(TOOLS_DIR)/i2ctransfer.o $(TOOLS_DIR)/i2cbusses.o 
$(TOOLS_DIR)/util.o $(LIB_DEPS)
        $(CC) $(LDFLAGS) -o $@ $^ $(TOOLS_LDFLAGS)
 
 #
@@ -71,7 +71,7 @@
 all-tools: $(addprefix $(TOOLS_DIR)/,$(TOOLS_TARGETS))
 
 strip-tools: $(addprefix $(TOOLS_DIR)/,$(TOOLS_TARGETS))
-       strip $(addprefix $(TOOLS_DIR)/,$(TOOLS_TARGETS))
+       $(STRIP) $(addprefix $(TOOLS_DIR)/,$(TOOLS_TARGETS))
 
 clean-tools:
        $(RM) $(addprefix $(TOOLS_DIR)/,*.o $(TOOLS_TARGETS))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/tools/i2cbusses.c 
new/i2c-tools-4.1/tools/i2cbusses.c
--- old/i2c-tools-4.0/tools/i2cbusses.c 2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/tools/i2cbusses.c 2018-11-30 15:15:21.000000000 +0100
@@ -137,7 +137,7 @@
        FILE *f;
        char fstype[NAME_MAX], sysfs[NAME_MAX], n[NAME_MAX];
        int foundsysfs = 0;
-       int count=0;
+       int len, count = 0;
        struct i2c_adap *adapters;
 
        adapters = calloc(BUNCH, sizeof(struct i2c_adap));
@@ -220,18 +220,32 @@
 
                /* this should work for kernels 2.6.5 or higher and */
                /* is preferred because is unambiguous */
-               sprintf(n, "%s/%s/name", sysfs, de->d_name);
+               len = snprintf(n, NAME_MAX, "%s/%s/name", sysfs, de->d_name);
+               if (len >= NAME_MAX) {
+                       fprintf(stderr, "%s: path truncated\n", n);
+                       continue;
+               }
                f = fopen(n, "r");
                /* this seems to work for ISA */
                if(f == NULL) {
-                       sprintf(n, "%s/%s/device/name", sysfs, de->d_name);
+                       len = snprintf(n, NAME_MAX, "%s/%s/device/name", sysfs,
+                                      de->d_name);
+                       if (len >= NAME_MAX) {
+                               fprintf(stderr, "%s: path truncated\n", n);
+                               continue;
+                       }
                        f = fopen(n, "r");
                }
                /* non-ISA is much harder */
                /* and this won't find the correct bus name if a driver
                   has more than one bus */
                if(f == NULL) {
-                       sprintf(n, "%s/%s/device", sysfs, de->d_name);
+                       len = snprintf(n, NAME_MAX, "%s/%s/device", sysfs,
+                                      de->d_name);
+                       if (len >= NAME_MAX) {
+                               fprintf(stderr, "%s: path truncated\n", n);
+                               continue;
+                       }
                        if(!(ddir = opendir(n)))
                                continue;
                        while ((dde = readdir(ddir)) != NULL) {
@@ -240,8 +254,16 @@
                                if (!strcmp(dde->d_name, ".."))
                                        continue;
                                if ((!strncmp(dde->d_name, "i2c-", 4))) {
-                                       sprintf(n, "%s/%s/device/%s/name",
-                                               sysfs, de->d_name, dde->d_name);
+                                       len = snprintf(n, NAME_MAX,
+                                                      "%s/%s/device/%s/name",
+                                                      sysfs, de->d_name,
+                                                      dde->d_name);
+                                       if (len >= NAME_MAX) {
+                                               fprintf(stderr,
+                                                       "%s: path truncated\n",
+                                                       n);
+                                               continue;
+                                       }
                                        if((f = fopen(n, "r")))
                                                goto found;
                                }
@@ -355,19 +377,27 @@
  * Parse a CHIP-ADDRESS command line argument and return the corresponding
  * chip address, or a negative value if the address is invalid.
  */
-int parse_i2c_address(const char *address_arg)
+int parse_i2c_address(const char *address_arg, int all_addrs)
 {
        long address;
        char *end;
+       long min_addr = 0x03;
+       long max_addr = 0x77;
 
        address = strtol(address_arg, &end, 0);
        if (*end || !*address_arg) {
                fprintf(stderr, "Error: Chip address is not a number!\n");
                return -1;
        }
-       if (address < 0x03 || address > 0x77) {
+
+       if (all_addrs) {
+               min_addr = 0x00;
+               max_addr = 0x7f;
+       }
+
+       if (address < min_addr || address > max_addr) {
                fprintf(stderr, "Error: Chip address out of range "
-                       "(0x03-0x77)!\n");
+                       "(0x%02lx-0x%02lx)!\n", min_addr, max_addr);
                return -2;
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/tools/i2cbusses.h 
new/i2c-tools-4.1/tools/i2cbusses.h
--- old/i2c-tools-4.0/tools/i2cbusses.h 2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/tools/i2cbusses.h 2018-11-30 15:15:21.000000000 +0100
@@ -35,7 +35,7 @@
 void free_adapters(struct i2c_adap *adapters);
 
 int lookup_i2c_bus(const char *i2cbus_arg);
-int parse_i2c_address(const char *address_arg);
+int parse_i2c_address(const char *address_arg, int all_addrs);
 int open_i2c_dev(int i2cbus, char *filename, size_t size, int quiet);
 int set_slave_addr(int file, int address, int force);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/tools/i2cdump.8 
new/i2c-tools-4.1/tools/i2cdump.8
--- old/i2c-tools-4.0/tools/i2cdump.8   2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/tools/i2cdump.8   2018-11-30 15:15:21.000000000 +0100
@@ -7,6 +7,7 @@
 .RB [ -f ]
 .RB [ "-r first-last" ]
 .RB [ -y ]
+.RB [ -a ]
 .I i2cbus
 .I address
 .RI [ "mode " [ "bank " [ bankreg ]]]
@@ -40,6 +41,9 @@
 from the user before messing with the I2C bus. When this flag is used, it
 will perform the operation directly. This is mainly meant to be used in
 scripts.
+.TP
+.B -a
+Allow using addresses between 0x00 - 0x02 and 0x78 - 0x7f. Not recommended.
 .PP
 At least two options must be provided to i2cdump. \fIi2cbus\fR indicates the
 number or name of the I2C bus to be scanned. This number should correspond to 
one
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/tools/i2cdump.c 
new/i2c-tools-4.1/tools/i2cdump.c
--- old/i2c-tools-4.0/tools/i2cdump.c   2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/tools/i2cdump.c   2018-11-30 15:15:21.000000000 +0100
@@ -36,9 +36,9 @@
 static void help(void)
 {
        fprintf(stderr,
-               "Usage: i2cdump [-f] [-y] [-r first-last] I2CBUS ADDRESS [MODE 
[BANK [BANKREG]]]\n"
+               "Usage: i2cdump [-f] [-y] [-r first-last] [-a] I2CBUS ADDRESS 
[MODE [BANK [BANKREG]]]\n"
                "  I2CBUS is an integer or an I2C bus name\n"
-               "  ADDRESS is an integer (0x03 - 0x77)\n"
+               "  ADDRESS is an integer (0x03 - 0x77, or 0x00 - 0x7f if -a is 
given)\n"
                "  MODE is one of:\n"
                "    b (byte, default)\n"
                "    w (word)\n"
@@ -119,7 +119,7 @@
        int block[256], s_length = 0;
        int pec = 0, even = 0;
        int flags = 0;
-       int force = 0, yes = 0, version = 0;
+       int force = 0, yes = 0, version = 0, all_addrs = 0;
        const char *range = NULL;
        int first = 0x00, last = 0xff;
 
@@ -130,6 +130,7 @@
                case 'f': force = 1; break;
                case 'r': range = argv[1+(++flags)]; break;
                case 'y': yes = 1; break;
+               case 'a': all_addrs = 1; break;
                default:
                        fprintf(stderr, "Error: Unsupported option "
                                "\"%s\"!\n", argv[1+flags]);
@@ -160,7 +161,7 @@
                help();
                exit(1);
        }
-       address = parse_i2c_address(argv[flags+2]);
+       address = parse_i2c_address(argv[flags+2], all_addrs);
        if (address < 0) {
                help();
                exit(1);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/tools/i2cget.8 
new/i2c-tools-4.1/tools/i2cget.8
--- old/i2c-tools-4.0/tools/i2cget.8    2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/tools/i2cget.8    2018-11-30 15:15:21.000000000 +0100
@@ -6,6 +6,7 @@
 .B i2cget
 .RB [ -f ]
 .RB [ -y ]
+.RB [ -a ]
 .I i2cbus
 .I chip-address
 .RI [ "data-address " [ mode ]]
@@ -34,6 +35,9 @@
 from the user before messing with the I2C bus. When this flag is used, it
 will perform the operation directly. This is mainly meant to be used in
 scripts. Use with caution.
+.TP
+.B -a
+Allow using addresses between 0x00 - 0x02 and 0x78 - 0x7f. Not recommended.
 .PP
 There are two required options to i2cget. \fIi2cbus\fR indicates the number
 or name of the I2C bus to be scanned.  This number should correspond to one of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/tools/i2cget.c 
new/i2c-tools-4.1/tools/i2cget.c
--- old/i2c-tools-4.0/tools/i2cget.c    2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/tools/i2cget.c    2018-11-30 15:15:21.000000000 +0100
@@ -41,9 +41,9 @@
 static void help(void)
 {
        fprintf(stderr,
-               "Usage: i2cget [-f] [-y] I2CBUS CHIP-ADDRESS [DATA-ADDRESS 
[MODE]]\n"
+               "Usage: i2cget [-f] [-y] [-a] I2CBUS CHIP-ADDRESS [DATA-ADDRESS 
[MODE]]\n"
                "  I2CBUS is an integer or an I2C bus name\n"
-               "  ADDRESS is an integer (0x03 - 0x77)\n"
+               "  ADDRESS is an integer (0x03 - 0x77, or 0x00 - 0x7f if -a is 
given)\n"
                "  MODE is one of:\n"
                "    b (read byte data, default)\n"
                "    w (read word data)\n"
@@ -158,7 +158,7 @@
        char filename[20];
        int pec = 0;
        int flags = 0;
-       int force = 0, yes = 0, version = 0;
+       int force = 0, yes = 0, version = 0, all_addrs = 0;
 
        /* handle (optional) flags first */
        while (1+flags < argc && argv[1+flags][0] == '-') {
@@ -166,6 +166,7 @@
                case 'V': version = 1; break;
                case 'f': force = 1; break;
                case 'y': yes = 1; break;
+               case 'a': all_addrs = 1; break;
                default:
                        fprintf(stderr, "Error: Unsupported option "
                                "\"%s\"!\n", argv[1+flags]);
@@ -187,7 +188,7 @@
        if (i2cbus < 0)
                help();
 
-       address = parse_i2c_address(argv[flags+2]);
+       address = parse_i2c_address(argv[flags+2], all_addrs);
        if (address < 0)
                help();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/tools/i2cset.8 
new/i2c-tools-4.1/tools/i2cset.8
--- old/i2c-tools-4.0/tools/i2cset.8    2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/tools/i2cset.8    2018-11-30 15:15:21.000000000 +0100
@@ -8,6 +8,7 @@
 .RB [ -y ]
 .RB [ "-m mask" ]
 .RB [ -r ]
+.RB [ -a ]
 .I i2cbus
 .I chip-address
 .I data-address
@@ -54,6 +55,9 @@
 Read back the value right after writing it, and compare the result with the
 value written. This used to be the default behavior. The same limitations
 apply as those of option \fB-m\fR.
+.TP
+.B -a
+Allow using addresses between 0x00 - 0x02 and 0x78 - 0x7f. Not recommended.
 .PP
 There are three required options to i2cset. \fIi2cbus\fR indicates the number
 or name of the I2C bus to be scanned.  This number should correspond to one of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/tools/i2cset.c 
new/i2c-tools-4.1/tools/i2cset.c
--- old/i2c-tools-4.0/tools/i2cset.c    2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/tools/i2cset.c    2018-11-30 15:15:21.000000000 +0100
@@ -38,9 +38,9 @@
 static void help(void)
 {
        fprintf(stderr,
-               "Usage: i2cset [-f] [-y] [-m MASK] [-r] I2CBUS CHIP-ADDRESS 
DATA-ADDRESS [VALUE] ... [MODE]\n"
+               "Usage: i2cset [-f] [-y] [-m MASK] [-r] [-a] 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"
+               "  ADDRESS is an integer (0x03 - 0x77, or 0x00 - 0x7f if -a is 
given)\n"
                "  MODE is one of:\n"
                "    c (byte, no value)\n"
                "    b (byte data, default)\n"
@@ -163,7 +163,7 @@
        char filename[20];
        int pec = 0;
        int flags = 0;
-       int force = 0, yes = 0, version = 0, readback = 0;
+       int force = 0, yes = 0, version = 0, readback = 0, all_addrs = 0;
        unsigned char block[I2C_SMBUS_BLOCK_MAX];
        int len;
 
@@ -179,6 +179,7 @@
                        flags++;
                        break;
                case 'r': readback = 1; break;
+               case 'a': all_addrs = 1; break;
                default:
                        fprintf(stderr, "Error: Unsupported option "
                                "\"%s\"!\n", argv[1+flags]);
@@ -200,7 +201,7 @@
        if (i2cbus < 0)
                help();
 
-       address = parse_i2c_address(argv[flags+2]);
+       address = parse_i2c_address(argv[flags+2], all_addrs);
        if (address < 0)
                help();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/tools/i2ctransfer.8 
new/i2c-tools-4.1/tools/i2ctransfer.8
--- old/i2c-tools-4.0/tools/i2ctransfer.8       2017-10-30 10:07:20.000000000 
+0100
+++ new/i2c-tools-4.1/tools/i2ctransfer.8       2018-11-30 15:15:21.000000000 
+0100
@@ -7,6 +7,7 @@
 .RB [ -f ]
 .RB [ -y ]
 .RB [ -v ]
+.RB [ -a ]
 .I i2cbus desc
 .RI [ data ]
 .RI [ desc
@@ -40,7 +41,7 @@
 Force access to the device even if it is already busy.
 By default,
 .B i2ctransfer
-will refuse to access addresses marked as reserved by the I2C standard or to a 
device which is already under the control of a kernel driver.
+will refuse to access a device which is already under the control of a kernel 
driver.
 Using this flag is dangerous, it can seriously confuse the kernel driver in 
question.
 It can also cause
 .B i2ctransfer
@@ -61,6 +62,9 @@
 .TP
 .B -V
 Display the version and exit.
+.TP
+.B -a
+Allow using addresses between 0x00 - 0x02 and 0x78 - 0x7f. Not recommended.
 
 .SH ARGUMENTS
 .PP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/tools/i2ctransfer.c 
new/i2c-tools-4.1/tools/i2ctransfer.c
--- old/i2c-tools-4.0/tools/i2ctransfer.c       2017-10-30 10:07:20.000000000 
+0100
+++ new/i2c-tools-4.1/tools/i2ctransfer.c       2018-11-30 15:15:21.000000000 
+0100
@@ -42,7 +42,7 @@
 static void help(void)
 {
        fprintf(stderr,
-               "Usage: i2ctransfer [-f] [-y] [-v] [-V] I2CBUS DESC [DATA] 
[DESC [DATA]]...\n"
+               "Usage: i2ctransfer [-f] [-y] [-v] [-V] [-a] I2CBUS DESC [DATA] 
[DESC [DATA]]...\n"
                "  I2CBUS is an integer or an I2C bus name\n"
                "  DESC describes the transfer in the form: 
{r|w}LENGTH[@address]\n"
                "    1) read/write-flag 2) LENGTH (range 0-65535) 3) I2C 
address (use last one if omitted)\n"
@@ -124,7 +124,7 @@
 {
        char filename[20];
        int i2cbus, address = -1, file, arg_idx = 1, nmsgs = 0, nmsgs_sent, i;
-       int force = 0, yes = 0, version = 0, verbose = 0;
+       int force = 0, yes = 0, version = 0, verbose = 0, all_addrs = 0;
        struct i2c_msg msgs[I2C_RDRW_IOCTL_MAX_MSGS];
        enum parse_state state = PARSE_GET_DESC;
        unsigned buf_idx = 0;
@@ -139,6 +139,7 @@
                case 'v': verbose = 1; break;
                case 'f': force = 1; break;
                case 'y': yes = 1; break;
+               case 'a': all_addrs = 1; break;
                default:
                        fprintf(stderr, "Error: Unsupported option \"%s\"!\n",
                                argv[arg_idx]);
@@ -209,22 +210,13 @@
                                 * the address here.
                                 */
 
-                               if (!force) {
-                                       address = parse_i2c_address(arg_ptr);
-                                       if (address < 0)
-                                               goto err_out_with_arg;
-
-                                       /* Ensure address is not busy */
-                                       if (set_slave_addr(file, address, 0))
-                                               goto err_out_with_arg;
-                               } else {
-                                       /* 'force' allows whole address range */
-                                       address = strtol(arg_ptr, &end, 0);
-                                       if (arg_ptr == end || *end || address > 
0x7f) {
-                                               fprintf(stderr, "Error: Invalid 
chip address\n");
-                                               goto err_out_with_arg;
-                                       }
-                               }
+                               address = parse_i2c_address(arg_ptr, all_addrs);
+                               if (address < 0)
+                                       goto err_out_with_arg;
+
+                               /* Ensure address is not busy */
+                               if (!force && set_slave_addr(file, address, 0))
+                                       goto err_out_with_arg;
                        } else {
                                /* Reuse last address if possible */
                                if (address < 0) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/i2c-tools-4.0/version.h new/i2c-tools-4.1/version.h
--- old/i2c-tools-4.0/version.h 2017-10-30 10:07:20.000000000 +0100
+++ new/i2c-tools-4.1/version.h 2018-11-30 15:15:21.000000000 +0100
@@ -1 +1 @@
-#define VERSION "4.0"
+#define VERSION "4.1"


Reply via email to