Hello community, here is the log from the commit of package i2c-tools for openSUSE:Factory checked in at 2020-09-25 16:21:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/i2c-tools (Old) and /work/SRC/openSUSE:Factory/.i2c-tools.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "i2c-tools" Fri Sep 25 16:21:31 2020 rev:37 rq:836248 version:4.2 Changes: -------- --- /work/SRC/openSUSE:Factory/i2c-tools/i2c-tools.changes 2019-11-08 15:21:18.634714541 +0100 +++ /work/SRC/openSUSE:Factory/.i2c-tools.new.4249/i2c-tools.changes 2020-09-25 16:21:43.123368903 +0200 @@ -1,0 +2,14 @@ +Tue Sep 22 08:40:11 UTC 2020 - Jean Delvare <[email protected]> + +- Update to version 4.2: + * Restrict I2C addresses 0x03-0x07 + * Fix short writes with mask in i2cset + * Support messages using I2C_M_RECV_LEN in i2ctransfer + * Add check for returned length from driver in i2ctransfer + * Many improvements to decode-dimms, for both DDR3 and DDR4 + * Updated list of memory vendors + * Add at24 driver support to decode-vaio + * Add a manual page for libi2c + * Let i2c-stub-from-dump read dumps from hexdump -C + +------------------------------------------------------------------- Old: ---- i2c-tools-4.1.tar.sign i2c-tools-4.1.tar.xz New: ---- i2c-tools-4.2.tar.sign i2c-tools-4.2.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ i2c-tools.spec ++++++ --- /var/tmp/diff_new_pack.AUORod/_old 2020-09-25 16:21:44.379370015 +0200 +++ /var/tmp/diff_new_pack.AUORod/_new 2020-09-25 16:21:44.383370019 +0200 @@ -1,7 +1,7 @@ # # spec file for package i2c-tools # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,14 +24,14 @@ %endif Name: i2c-tools -Version: 4.1 +Version: 4.2 Release: 0 Summary: A heterogeneous set of I2C tools for Linux License: GPL-2.0-or-later Group: Development/Tools/Other Requires: udev Recommends: modules -Url: https://i2c.wiki.kernel.org/index.php/I2C_Tools +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 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -109,6 +109,7 @@ %{_bindir}/* %{_sbindir}/* %{_mandir}/man1/*.1.gz +%{_mandir}/man3/*.3.gz %{_mandir}/man8/*.8.gz %files -n libi2c0 ++++++ i2c-tools-4.1.tar.xz -> i2c-tools-4.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/CHANGES new/i2c-tools-4.2/CHANGES --- old/i2c-tools-4.1/CHANGES 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/CHANGES 2020-09-22 10:02:42.000000000 +0200 @@ -1,6 +1,34 @@ i2c-tools CHANGES ----------------- +4.2 (2020-09-22) + manpages: Add BUGS section to let people know how to contact us + Makefile: Allow to preset all CFLAGS and LDFLAGS variables + tools: Consistently use snprintf instead of sprintf + Restrict addresses 0x03-0x07, too (defined by I2C standard) + decode-dimms: Print SPD revision for DDR3 too + Print primary bus width for DDR3 and DDR4 + List ee1004 as a candidate driver + Display MAC for DDR3 + Add MAC abbreviation for DDR4 + Round DDR4 speed properly + Detect and report truncated input files + Print kernel driver used + Print DDR memory speed in MT/s + Add DDR5 memory types + Decode manufacturing data for LPDDR3 + Fix the version string + Point the user to the right drivers + Update the list of vendors to Jedec JEP106BB + decode-vaio: Add support for the at24 driver + Scan more i2c buses + i2cset: Fix short writes with mask + i2ctransfer: Mention '-a' everywhere in the manpage + Support messages using I2C_M_RECV_LEN + Add check for returned length from driver + i2c-stub-from-dump: Read dumps from hexdump -C + library: Add a manual page to document the API + 4.1 (2018-11-30) Makefile: Make STRIP, DESTDIR and PREFIX overridable tools: Fix potential buffer overflows in i2cbusses diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/Makefile new/i2c-tools-4.2/Makefile --- old/i2c-tools-4.1/Makefile 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/Makefile 2020-09-22 10:02:42.000000000 +0200 @@ -12,6 +12,7 @@ bindir = $(PREFIX)/bin sbindir = $(PREFIX)/sbin mandir = $(PREFIX)/share/man +man3dir = $(mandir)/man3 man8dir = $(mandir)/man8 incdir = $(PREFIX)/include libdir = $(PREFIX)/lib diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/README new/i2c-tools-4.2/README --- old/i2c-tools-4.1/README 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/README 2020-09-22 10:02:42.000000000 +0200 @@ -20,7 +20,8 @@ * eeprom Perl scripts for decoding different types of EEPROMs (SPD, EDID...) These - scripts rely on the "eeprom" kernel driver. They are installed by default. + scripts rely on the eeprom kernel drivers ("at24" and "ee1004", "eeprom" on + older kernels). They are installed by default. * eeprog, eepromer Tools for writing to EEPROMs. These tools rely on the "i2c-dev" kernel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/eeprog/Module.mk new/i2c-tools-4.2/eeprog/Module.mk --- old/i2c-tools-4.1/eeprog/Module.mk 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/eeprog/Module.mk 2020-09-22 10:02:42.000000000 +0200 @@ -7,11 +7,11 @@ EEPROG_DIR := eeprog -EEPROG_CFLAGS := -Iinclude +EEPROG_CFLAGS += -Iinclude ifeq ($(USE_STATIC_LIB),1) -EEPROG_LDFLAGS := $(LIB_DIR)/$(LIB_STLIBNAME) +EEPROG_LDFLAGS += $(LIB_DIR)/$(LIB_STLIBNAME) else -EEPROG_LDFLAGS := -L$(LIB_DIR) -li2c +EEPROG_LDFLAGS += -L$(LIB_DIR) -li2c endif EEPROG_TARGETS := eeprog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/eeprom/Module.mk new/i2c-tools-4.2/eeprom/Module.mk --- old/i2c-tools-4.1/eeprom/Module.mk 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/eeprom/Module.mk 2020-09-22 10:02:42.000000000 +0200 @@ -1,6 +1,6 @@ -# EEPROM decoding scripts for the Linux eeprom driver +# EEPROM decoding scripts for the Linux eeprom drivers # -# Copyright (C) 2007-2013 Jean Delvare <[email protected]> +# Copyright (C) 2007-2020 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/eeprom/decode-dimms new/i2c-tools-4.2/eeprom/decode-dimms --- old/i2c-tools-4.1/eeprom/decode-dimms 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/eeprom/decode-dimms 2020-09-22 10:02:42.000000000 +0200 @@ -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-2017 Jean Delvare <[email protected]> +# Copyright (C) 2005-2020 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 @@ -22,9 +22,12 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. # -# -# The eeprom driver must be loaded (unless option -x is used). For kernels -# older than 2.6.0, the eeprom driver can be found in the lm-sensors package. +# A kernel driver must be loaded (unless option -x is used). Up to DDR3, +# you need either the at24 driver (in the kernel tree since v2.6.27) or +# the legacy eeprom driver (in the kernel tree since v2.6.0). For kernels +# older than 2.6.0, the eeprom driver can be found in the lm-sensors 2 +# package. For DDR4, you need the ee1004 driver (in the kernel tree since +# kernel v4.20). # # References: # PC SDRAM Serial Presence @@ -43,14 +46,11 @@ use File::Basename; use vars qw($opt_html $opt_bodyonly $opt_side_by_side $opt_merge $opt_igncheck $use_sysfs $use_hexdump $sbs_col_width - @vendors %decode_callback $revision @dimm $current %hexdump_cache); + @vendors %decode_callback @dimm $current %hexdump_cache); use constant LITTLEENDIAN => "little-endian"; use constant BIGENDIAN => "big-endian"; - -$revision = '$Revision$ ($Date$)'; -$revision =~ s/\$\w+: (.*?) \$/$1/g; -$revision =~ s/ \([^()]*\)//; +use constant I2C_TOOLS_VER => "4.2"; @vendors = ( ["AMD", "AMI", "Fairchild", "Fujitsu", @@ -58,7 +58,7 @@ "Intel", "I.T.T.", "Intersil", "Monolithic Memories", "Mostek", "Freescale (former Motorola)", "National", "NEC", "RCA", "Raytheon", "Conexant (Rockwell)", "Seeq", - "NXP (former Signetics, Philips Semi.)", "Synertek", "Texas Instruments", "Toshiba", + "NXP (former Signetics, Philips Semi.)", "Synertek", "Texas Instruments", "Kioxia Corporation (former Toshiba Memory Corporation)", "Xicor", "Zilog", "Eurotechnique", "Mitsubishi", "Lucent (AT&T)", "Exel", "Atmel", "STMicroelectronics (former SGS/Thomson)", "Lattice Semi.", "NCR", "Wafer Scale Integration", "IBM", @@ -70,10 +70,10 @@ "Thinking Machine", "Thomson CSF", "Integrated CMOS (Vertex)", "Honeywell", "Tektronix", "Oracle Corporation (former Sun Microsystems)", "Silicon Storage Technology", "ProMos/Mosel Vitelic", "Infineon (former Siemens)", "Macronix", "Xerox", "Plus Logic", - "SunDisk", "Elan Circuit Tech.", "European Silicon Str.", "Apple Computer", + "Western Digital Technologies (former SanDisk Corporation)", "Elan Circuit Tech.", "European Silicon Str.", "Apple Computer", "Xilinx", "Compaq", "Protocol Engines", "SCI", "Seiko Instruments", "Samsung", "I3 Design System", "Klic", - "Crosspoint Solutions", "Alliance Semiconductor", "Tandem", "Hewlett-Packard", + "Crosspoint Solutions", "Alliance Memory Inc", "Tandem", "Hewlett-Packard", "Integrated Silicon Solutions", "Brooktree", "New Media", "MHS Electronic", "Performance Semi.", "Winbond Electronic", "Kawasaki Steel", "Bright Micro", "TECMAR", "Exar", "PCMCIA", "LG Semi (former Goldstar)", @@ -92,7 +92,7 @@ "DATARAM", "United Microelec Corp.", "TCSI", "Smart Modular", "Hughes Aircraft", "Lanstar Semiconductor", "Qlogic", "Kingston", "Music Semi", "Ericsson Components", "SpaSE", "Eon Silicon Devices", - "Programmable Micro Corp", "DoD", "Integ. Memories Tech.", "Corollary Inc.", + "Integrated Silicon Solution (ISSI) (former Programmable Micro Corp)", "DoD", "Integ. Memories Tech.", "Corollary Inc.", "Dallas Semiconductor", "Omnivision", "EIV(Switzerland)", "Novatel Wireless", "Zarlink (former Mitel)", "Clearpoint", "Cabletron", "STEC (former Silicon Technology)", "Vanguard", "Hagiwara Sys-Com", "Vantis", "Celestica", @@ -273,9 +273,9 @@ "PhotoFast Global Inc.", "InnoDisk Corporation", "Muscle Power", "Energy Micro", "Innofidei", "CopperGate Communications", "Holtek Semiconductor Inc.", "Myson Century, Inc.", "FIDELIX", "Red Digital Cinema", "Densbits Technology", "Zempro", "MoSys", "Provigent", "Triad Semiconductor, Inc."], -["Siklu Communication Ltd.", "A Force Manufacturing Ltd.", "Strontium", "Abilis Systems", "Siglead, Inc.", +["Siklu Communication Ltd.", "A Force Manufacturing Ltd.", "Strontium", "ALi Corp (former Abilis Systems)", "Siglead, Inc.", "Ubicom, Inc.", "Unifosa Corporation", "Stretch, Inc.", "Lantiq Deutschland GmbH", "Visipro", - "EKMemory", "Microelectronics Institute ZTE", "Cognovo Ltd.", "Carry Technology Co. Ltd.", "Nokia", + "EKMemory", "Microelectronics Institute ZTE", "u-blox AG (former Cognovo Ltd)", "Carry Technology Co. Ltd.", "Nokia", "King Tiger Technology", "Sierra Wireless", "HT Micron", "Albatron Technology Co. Ltd.", "Leica Geosystems AG", "BroadLight", "AEXEA", "ClariPhy Communications, Inc.", "Green Plug", "Design Art Networks", "Mach Xtreme Technology Ltd.", "ATO Solutions Co. Ltd.", "Ramsta", @@ -307,13 +307,13 @@ "AcSiP Technology Corporation", "Idea! Electronic Systems", "Gowe Technology Co. Ltd", "Hermes Testing Solutions Inc.", "Positivo BGH", "Intelligence Silicon Technology"], ["3D PLUS", "Diehl Aerospace", "Fairchild", "Mercury Systems", - "Sonics Inc.", "GE Intelligent Platforms GmbH & Co.", "Shenzhen Jinge Information Co. Ltd", + "Sonics Inc.", "Emerson Automation Solutions (former ICC/GE Intelligent Platforms)", "Shenzhen Jinge Information Co. Ltd", "SCWW", "Silicon Motion Inc.", "Anurag", "King Kong", "FROM30 Co. Ltd", "Gowin Semiconductor Corp", "Fremont Micro Devices Ltd", "Ericsson Modems", "Exelis", "Satixfy Ltd", "Galaxy Microsystems Ltd", "Gloway International Co. Ltd", "Lab", "Smart Energy Instruments", - "Approved Memory Corporation", "Axell Corporation", "ISD Technology Limited", - "Phytium", "Xi'an SinoChip Semiconductor", "Ambiq Micro", "eveRAM Technology Inc.", + "Approved Memory Corporation", "Axell Corporation", "Essencore Limited (former ISD Technology Limited)", + "Phytium", "Xi’an UniIC Semiconductors Co Ltd (former Xi'an SinoChip Semiconductor)", "Ambiq Micro", "eveRAM Technology Inc.", "Infomax", "Butterfly Network Inc.", "Shenzhen City Gcai Electronics", "Stack Devices Corporation", "ADK Media Group", "TSP Global Co. Ltd", "HighX", "Shenzhen Elicks Technology", "ISSI/Chingis", "Google Inc.", @@ -323,14 +323,14 @@ "Nuvoton", "Korea Uhbele International Group Ltd", "Ikegami Tsushinki Co. Ltd", "RelChip Inc.", "Baikal Electronics", "Nemostech Inc.", "Memorysolution GmbH", "Silicon Integrated Systems Corporation", - "Xiede", "Multilaser Components", "Flash Chi", "Jone", + "Xiede", "BRC (former Multilaser Components)", "Flash Chi", "Jone", "GCT Semiconductor Inc.", "Hong Kong Zetta Device Technology", "Unimemory Technology(s) Pte Ltd", "Cuso", "Kuso", "Uniquify Inc.", "Skymedi Corporation", "Core Chance Co. Ltd", "Tekism Co. Ltd", "Seagate Technology PLC", "Hong Kong Gaia Group Co. Limited", "Gigacom Semiconductor LLC", "V2 Technologies", "TLi", "Neotion", "Lenovo", "Shenzhen Zhongteng Electronic Corp. Ltd", "Compound Photonics", - "Cognimem Technologies Inc.", "Shenzhen Pango Microsystems Co. Ltd", + "In2H2 Inc (former Cognimem Technologies Inc)", "Shenzhen Pango Microsystems Co. Ltd", "Vasekey", "Cal-Comp Industria de Semicondutores", "Eyenix Co. Ltd", "Heoriady", "Accelerated Memory Production Inc.", "INVECAS Inc.", "AP Memory", "Douqi Technology", "Etron Technology Inc.", @@ -371,7 +371,7 @@ "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", + "SemsoTai (SZ) 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", @@ -390,12 +390,12 @@ "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", +["Foerd Technology Co Ltd", "KingSpec", "Codasip GmbH", "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", + "Shenzhen Huafeng Science Technology", "CXMT (former 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", @@ -415,9 +415,88 @@ "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"] + "Thermaltake Technology Co Ltd", "Shenzhen O'Yang Maile Technology Ltd", "UPMEM", + "Chun Well Technology Holding Limited", "Astera Labs Inc", "Winconway", + "Advantech Co Ltd", "Chengdu Fengcai Electronic Technology", "The Boeing Company", + "Blaize Inc", "Ramonster Technology Co Ltd", "Wuhan Naonongmai Technology Co Ltd", + "Shenzhen Hui ShingTong Technology", "Yourlyon", "Fabu Technology", + "Shenzhen Yikesheng Technology Co Ltd", "NOR-MEM", "Cervoz Co Ltd", + "Bitmain Technologies Inc", "Facebook Inc", "Shenzhen Longsys Electronics Co Ltd", + "Guangzhou Siye Electronic Technology", "Silergy", "Adamway", + "PZG", "Shenzhen King Power Electronics", "Guangzhou ZiaoFu Tranding Co Ltd", + "Shenzhen SKIHOTAR Semiconductor", "PulseRain Technology", "Seeker Technology Limited", + "Shenzhen OSCOO Tech Co Ltd", "Shenzhen Yze Technology Co Ltd", + "Shenzhen Jieshuo Electronic Commerce", "Gazda", "Hua Wei Technology Co Ltd", + "Esperanto Technologies", "JinSheng Electronic (Shenzhen) Co Ltd", + "Shenzhen Shi Bolunshuai Technology", "Shanghai Rei Zuan Information Tech", + "Fraunhofer IIS", "Kandou Bus SA", "Acer", "Artmem Technology Co Ltd", + "Gstar Semiconductor Co Ltd", "ShineDisk", "Shenzhen CHN Technology Co Ltd", + "UnionChip Semiconductor Co Ltd", "Tanbassh", "Shenzhen Tianyu Jieyun Intl Logistics", + "MCLogic Inc", "Eorex Corporation", "Arm Technology (China) Co Ltd", "Lexar Co Limited", + "QinetiQ Group PLC", "Exascend", "Hong Kong Hyunion Electronics Co Ltd", + "Shenzhen Banghong Electronics Co Ltd", "MBit Wireless Inc", "Hex Five Security Inc", + "ShenZhen Juhor Precision Tech Co Ltd", "Shenzhen Reeinno Technology Co Ltd"], +["ABIT Electronics (Shenzhen) Co Ltd", "Semidrive", "MyTek Electronics Corp", + "Wxilicon Technology Co Ltd", "Shenzhen Meixin Electronics Ltd", "Ghost Wolf", + "LiSion Technologies Inc", "Power Active Co Ltd", "Pioneer High Fidelity Taiwan Co. Ltd", + "LuoSilk", "Shenzhen Chuangshifeida Technology", "Black Sesame Technologies Inc", + "Jiangsu Xinsheng Intelligent Technology", "MLOONG", "Quadratica LLC", + "Anpec Electronics", "Xi’an Morebeck Semiconductor Tech Co", "Kingbank Technology Co Ltd", + "ITRenew Inc", "Shenzhen Eaget Innovation Tech Ltd", "Jazer", + "Xiamen Semiconductor Investment Group", "Guangzhou Longdao Network Tech Co", + "Shenzhen Futian SEC Electronic Market", "Allegro Microsystems LLC", + "Hunan RunCore Innovation Technology", "C-Corsa Technology", + "Zhuhai Chuangfeixin Technology Co Ltd", "Beijing InnoMem Technologies Co Ltd", + "YooTin", "Shenzhen Pengxiong Technology Co Ltd", "Dongguan Yingbang Commercial Trading Co", + "Shenzhen Ronisys Electronics Co Ltd", "Hongkong Xinlan Guangke Co Ltd", + "Apex Microelectronics Co Ltd", "Beijing Hongda Jinming Technology Co Ltd", + "Ling Rui Technology (Shenzhen) Co Ltd", "Hongkong Hyunion Electronics Co Ltd", + "Starsystems Inc", "Shenzhen Yingjiaxun Industrial Co Ltd", + "Dongguan Crown Code Electronic Commerce", "Monolithic Power Systems Inc", + "WuHan SenNaiBo E-Commerce Co Ltd", "Hangzhou Hikstorage Technology Co", + "Shenzhen Goodix Technology Co Ltd", "Aigo Electronic Technology Co Ltd", + "Hefei Konsemi Storage Technology Co Ltd", "Cactus Technologies Limited", + "DSIN", "Blu Wireless Technology", "Nanjing UCUN Technology Inc", + "Acacia Communications", "Beijinjinshengyihe Technology Co Ltd", "Zyzyx", + "T-HEAD Semiconductor Co Ltd", "Shenzhen Hystou Technology Co Ltd", "Syzexion", + "Kembona", "Qingdao Thunderobot Technology Co Ltd", "Morse Micro", + "Shenzhen Envida Technology Co Ltd", "UDStore Solution Limited", "Shunlie", + "Shenzhen Xin Hong Rui Tech Ltd", "Shenzhen Yze Technology Co Ltd", + "Shenzhen Huang Pu He Xin Technology", "Xiamen Pengpai Microelectronics Co Ltd", + "JISHUN", "Shenzhen WODPOSIT Technology Co", "Unistar", "UNICORE Electronic (Suzhou) Co Ltd", + "Axonne Inc", "Shenzhen SOVERECA Technology Co", "Dire Wolf", "Whampoa Core Technology Co Ltd", + "CSI Halbleiter GmbH", "ONE Semiconductor", "SimpleMachines Inc", + "Shenzhen Chengyi Qingdian Electronic", "Shenzhen Xinlianxin Network Technology", + "Vayyar Imaging Ltd", "Paisen Network Technology Co Ltd", + "Shenzhen Fengwensi Technology Co Ltd", "Caplink Technology Limited", "JJT Solution Co Ltd", + "HOSIN Global Electronics Co Ltd", "Shenzhen KingDisk Century Technology", "SOYO", + "DIT Technology Co Ltd", "iFound", "Aril Computer Company", "ASUS", + "Shenzhen Ruiyingtong Technology Co", "HANA Micron", "RANSOR", "Axiado Corporation", + "Tesla Corporation", "Pingtouge (Shanghai) Semiconductor Co", "S3Plus Technologies SA", + "Integrated Silicon Solution Israel Ltd", "GreenWaves Technologies", "NUVIA Inc", + "Guangzhou Shuvrwine Technology Co", "Shenzhen Hangshun Chip Technology", + "Chengboliwei Electronic Business", "Kowin Memory Technology Co Ltd", "Euronet Technology Inc", + "SCY", "Shenzhen Xinhongyusheng Electrical", "PICOCOM", "Shenzhen Toooogo Memory Technology", + "VLSI Solution", "Costar Electronics Inc", "Shenzhen Huatop Technology Co Ltd", + "Inspur Electronic Information Industry", "Shenzhen Boyuan Computer Technology", + "Beijing Welldisk Electronics Co Ltd", "Suzhou EP Semicon Co Ltd", + "Zhejiang Dahua Memory Technology", "Virtu Financial", "Datotek International Co Ltd", + "Telecom and Microelectronics Industries", "Echo Technology Ltd", "APEX-INFO", + "Yingpark", "Shenzhen Bigway Tech Co Ltd"], +["Beijing Haawking Technology Co Ltd", "Open HW Group", "JHICC", "ncoder AG", + "ThinkTech Information Technology Co", "Shenzhen Chixingzhe Technology Co Ltd", + "Skywalker", "Shenzhen Kaizhuoyue Electronics Co Ltd", + "Shenzhen YC Storage Technology Co Ltd", "Shenzhen Chixingzhe Technology Co", + "Wink Semiconductor (Shenzhen) Co Ltd", "AISTOR", "Palma Ceia SemiDesign", + "EM Microelectronic-Marin SA", "Shenzhen Monarch Memory Technology"] ); +# Validate the vendors array, it's so easy to get wrong +# All pages but the last should be full +for (my $page = 0; $page < @vendors - 1; $page++) { + die "Unexpected number of vendor names in page $page" unless @{$vendors[$page]} == 126; +} + $use_sysfs = -d '/sys/bus'; # We consider that no data was written to this area of the SPD EEPROM if @@ -741,7 +820,7 @@ return join ", ", @edc; } -# Parameter: EEPROM bytes 0-127 (using 3-62) +# Parameter: EEPROM bytes 0-127 (using 3-62 and 126-127) sub decode_sdr_sdram($) { my $bytes = shift; @@ -1000,6 +1079,9 @@ $temp = (($bytes->[35] & 0x7f) >> 4) + ($bytes->[35] & 0xf) * 0.1; printl_cond(($bytes->[35] & 0xf) <= 9, "Data Signal Hold Time", (($bytes->[35] >> 7) ? -$temp : $temp) . " ns"); + +# Last 2 bytes (126-127) are reserved, Intel used them as an extension + decode_intel_spec_freq($bytes); } sub as_ddr($$) @@ -1040,7 +1122,7 @@ $pcclk += 100 if ($pcclk % 100) >= 50; # Round properly $pcclk = $pcclk - ($pcclk % 100); $ddrclk = int ($ddrclk); - printl("Maximum module speed", "$ddrclk MHz (PC${pcclk})"); + printl("Maximum module speed", "$ddrclk MT/s (PC${pcclk})"); #size computation my $k = 0; @@ -1293,7 +1375,7 @@ # Round down to comply with Jedec $pcclk = $pcclk - ($pcclk % 100); $ddrclk = int ($ddrclk); - printl("Maximum module speed", "$ddrclk MHz (PC2-${pcclk})"); + printl("Maximum module speed", "$ddrclk MT/s (PC2-${pcclk})"); #size computation my $k = 0; @@ -1551,7 +1633,25 @@ use constant DDR3_CLOCKED => 3; use constant DDR3_LOAD_REDUCED => 4; -# Parameter: EEPROM bytes 0-127 (using 3-76) +sub ddr3_adjust_ctime($$) +{ + my ($ctime, $ftb) = @_; + my $ii; + + # Starting with DDR3-1866, vendors may start approximating the + # minimum cycle time. Try to guess what they really meant so + # that the reported speed matches the standard. + for ($ii = 7; $ii < 15; $ii++) { + if ($ctime > 7.5/$ii - $ftb/1000 && $ctime < 7.5/$ii + $ftb/1000) { + $ctime = 7.5/$ii; + last; + } + } + + return $ctime; +} + +# Parameter: EEPROM bytes 0-127 (using 1-68) sub decode_ddr3_sdram($) { my $bytes = shift; @@ -1577,6 +1677,10 @@ { type => "32b-SO-DIMM", width => "67.6 mm", family => DDR3_UNBUFFERED }, ); +# SPD revision + printl_cond($bytes->[1] != 0xff, "SPD Revision", + ($bytes->[1] >> 4) . "." . ($bytes->[1] & 0xf)); + printl("Module Type", ($bytes->[3] <= $#module_types) ? $module_types[$bytes->[3]]->{type} : sprintf("Reserved (0x%.2X)", $bytes->[3])); @@ -1593,15 +1697,7 @@ prints("Memory Characteristics"); $ctime = ddr3_mtb_ftb($bytes->[12], $bytes->[34], $mtb, $ftb); - # Starting with DDR3-1866, vendors may start approximating the - # minimum cycle time. Try to guess what they really meant so - # that the reported speed matches the standard. - for ($ii = 7; $ii < 15; $ii++) { - if ($ctime > 7.5/$ii - $ftb/1000 && $ctime < 7.5/$ii + $ftb/1000) { - $ctime = 7.5/$ii; - last; - } - } + $ctime = ddr3_adjust_ctime($ctime, $ftb); my $ddrclk = 2 * (1000 / $ctime); my $tbits = 1 << (($bytes->[8] & 7) + 3); @@ -1609,7 +1705,7 @@ # Round down to comply with Jedec $pcclk = $pcclk - ($pcclk % 100); $ddrclk = int ($ddrclk); - printl("Maximum module speed", "$ddrclk MHz (PC3-${pcclk})"); + printl("Maximum module speed", "$ddrclk MT/s (PC3-${pcclk})"); # Size computation @@ -1629,7 +1725,8 @@ printl("SDRAM Device Width", (1 << (($bytes->[7] & 7) + 2))." bits"); - printl("Bus Width Extension", ($bytes->[8] & 24)." bits"); + printl("Primary Bus Width", (8 << ($bytes->[8] & 7))." bits"); + printl_cond($bytes->[8] & 24, "Bus Width Extension", ($bytes->[8] & 24)." bits"); my $taa; my $trcd; @@ -1727,6 +1824,12 @@ ($bytes->[32] & 128) ? "Yes" : "No"); printl("SDRAM Device Type", ddr3_device_type($bytes->[33])); + my @mac = ("Untested", + "700 K", "600 K", "500 K", "400 K", "300 K", "200 K", + undef, "Unlimited"); + my $mac = $bytes->[41] & 0x0f; + printl_cond(defined $mac[$mac], "Maximum Activate Count (MAC)", $mac[$mac]); + # Following bytes are type-specific, so don't continue if type # isn't known. return if $bytes->[3] == 0 || $bytes->[3] > $#module_types; @@ -1860,7 +1963,9 @@ prints("Memory Characteristics"); $ctime = ddr4_mtb_ftb($bytes->[18], $bytes->[125], $mtb, $ftb); + $ctime = ddr3_adjust_ctime($ctime, $ftb); $ctime_max = ddr4_mtb_ftb($bytes->[19], $bytes->[124], $mtb, $ftb); + $ctime_max = ddr3_adjust_ctime($ctime_max, $ftb); my $ddrclk = 2 * (1000 / $ctime); my $tbits = 8 << ($bytes->[13] & 7); @@ -1868,7 +1973,7 @@ # Round down to comply with Jedec $pcclk = $pcclk - ($pcclk % 100); $ddrclk = int ($ddrclk); - printl("Maximum module speed", "$ddrclk MHz (PC4-${pcclk})"); + printl("Maximum module speed", "$ddrclk MT/s (PC4-${pcclk})"); # Size computation my $sdram_width = 4 << ($bytes->[12] & 0x07); @@ -1891,6 +1996,7 @@ printl("Ranks", $ranks); printl_cond($ranks > 1, "Rank Mix", $bytes->[12] & 0x40 ? "Asymmetrical" : "Symmetrical"); + printl("Primary Bus Width", (8 << ($bytes->[13] & 7))." bits"); printl_cond($bytes->[13] & 0x18, "Bus Width Extension", ($bytes->[13] & 0x18)." bits"); my $taa; @@ -1988,7 +2094,7 @@ "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]); + printl_cond(defined $mac[$mac], "Maximum Activate Count (MAC)", $mac[$mac]); my $ppr = $bytes->[9] >> 6; printl("Post Package Repair", @@ -2335,9 +2441,13 @@ sub readspd($$$) { my ($offset, $size, $dimm_i) = @_; - my @bytes; + my (@bytes, $read); if ($use_hexdump) { @bytes = read_hexdump($dimm_i); + if (@bytes < $offset + $size) { + print STDERR "WARNING: Dump file $dimm_i is truncated\n"; + $size = @bytes - $offset; + } return @bytes[$offset..($offset + $size - 1)]; } elsif ($use_sysfs) { # Kernel 2.6 with sysfs @@ -2346,9 +2456,12 @@ binmode HANDLE; sysseek(HANDLE, $offset, SEEK_SET) or die "Cannot seek $dimm_i/eeprom"; - sysread(HANDLE, my $eeprom, $size) - or die "Cannot read $dimm_i/eeprom"; + $read = sysread(HANDLE, my $eeprom, $size) + or die "Cannot read $dimm_i/eeprom"; close HANDLE; + if ($read < $size) { + print STDERR "WARNING: $dimm_i/eeprom is smaller than expected\n"; + } @bytes = unpack("C*", $eeprom); } else { # Kernel 2.4 with procfs @@ -2503,17 +2616,22 @@ sub get_dimm_list { - my (@dirs, $dir, $opened, $file, @files); + my (@drivers, $driver, $dir, $opened, $file, @files); if ($use_sysfs) { - @dirs = ('/sys/bus/i2c/drivers/eeprom', - '/sys/bus/i2c/drivers/at24', - '/sys/bus/i2c/drivers/ee1004'); # DDR4 + @drivers = ('eeprom', + 'at24', + 'ee1004'); # DDR4 } else { - @dirs = ('/proc/sys/dev/sensors'); + @drivers = ('eeprom'); + $dir = '/proc/sys/dev/sensors'; } - foreach $dir (@dirs) { + foreach $driver (@drivers) { + if ($use_sysfs) { + $dir = "/sys/bus/i2c/drivers/$driver"; + } + next unless opendir(local *DIR, $dir); $opened++; while (defined($file = readdir(DIR))) { @@ -2523,7 +2641,7 @@ next unless -d "$dir/$file"; # Device name must be eeprom (driver eeprom) - # or spd (driver at24) + # spd (driver at24) or ee1004 (driver ee1004) my $attr = sysfs_device_attribute("$dir/$file", "name"); next unless defined $attr && ($attr eq "eeprom" || @@ -2533,13 +2651,14 @@ next unless $file =~ /^eeprom-/; } push @files, { eeprom => "$file", - file => "$dir/$file" }; + file => "$dir/$file", + driver => "$driver" }; } close(DIR); } if (!$opened) { - print STDERR "No EEPROM found, try loading the eeprom or at24 module\n"; + print STDERR "No EEPROM found, try loading the eeprom, at24 or ee1004 module\n"; exit; } @@ -2550,6 +2669,7 @@ # Each hash has the following keys: # * eeprom: Name of the eeprom data file # * file: Full path to the eeprom data file +# * driver: Driver used to retrieve the data (undef for dump files) # * bytes: The EEPROM data (array) # * is_rambus: Whether this is a RAMBUS DIMM or not (boolean) # * chk_label: The label to display for the checksum or CRC @@ -2596,7 +2716,7 @@ "<body>\n"; } -printc("decode-dimms version $revision"); +printc("decode-dimms version ".I2C_TOOLS_VER); printh('Memory Serial Presence Detect Decoder', 'By Philip Edelbrock, Christian Zuckschwerdt, Burkart Lingner, Jean Delvare, Trent Piepho and others'); @@ -2616,6 +2736,7 @@ printl("Guessing DIMM is in", "bank $dimm_num"); } } + printl("Kernel driver used", $dimm[$current]->{driver}); } # Decode first 3 bytes (0-2) @@ -2639,11 +2760,14 @@ printl("Total number of bytes in EEPROM", $spd_size); # If there's more data than what we've read, let's - # read it now. DDR3 will need this data. + # read it now. DDR3 and DDR4 will need this data. if ($spd_used > @bytes) { push (@bytes, readspd(@bytes, $spd_used - @bytes, $dimm[$current]->{file})); + if (@bytes < $spd_used) { + print STDERR "WARNING: Fewer data bytes available (".(scalar @bytes).") than needed ($spd_used)\n"; + } } } @@ -2662,6 +2786,7 @@ "DDR4 SDRAM", "Reserved", # 12, 13 "DDR4E SDRAM", "LPDDR3 SDRAM", # 14, 15 "LPDDR4 SDRAM", "LPDDR4X SDRAM", # 16, 17 + "DDR5 SDRAM", "LPDDR5 SDRAM", # 18, 19 ); if ($bytes[2] < @type_list) { $type = $type_list[$bytes[2]]; @@ -2673,29 +2798,29 @@ $decode_callback{$type}->(\@bytes) if exists $decode_callback{$type}; - if ($type eq "DDR3 SDRAM") { + if ($type eq "DDR3 SDRAM" || + $type eq "LPDDR3 SDRAM") { # Decode DDR3-specific manufacturing data in bytes # 117-149 - decode_ddr3_mfg_data(\@bytes) + if (@bytes >= 150) { + 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) + if (@bytes >= 384) { + decode_ddr4_mfg_data(\@bytes); + } elsif (!$use_hexdump && $dimm[$current]->{driver} ne "ee1004") { + print STDERR "HINT: You should be using the ee1004 driver instead of the $dimm[$current]->{driver} driver\n"; + } } else { # Decode next 35 bytes (64-98, common to most # memory types) decode_manufacturing_information(\@bytes); } - -# Next 27 bytes (99-125) are manufacturer specific, can't decode - -# Last 2 bytes (126-127) are reserved, Intel used them as an extension - if ($type eq "SDR SDRAM") { - decode_intel_spec_freq(\@bytes); - } } # Side-by-side output format is only possible if all DIMMs have a similar diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/eeprom/decode-dimms.1 new/i2c-tools-4.2/eeprom/decode-dimms.1 --- old/i2c-tools-4.1/eeprom/decode-dimms.1 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/eeprom/decode-dimms.1 2020-09-22 10:02:42.000000000 +0200 @@ -62,6 +62,10 @@ .TP .B \-h, --help Display the usage summary +.SH BUGS +To report bugs or send fixes, please write to the Linux I2C mailing list +<[email protected]> with Cc to the current maintainer: +Jean Delvare <[email protected]>. .SH SEE ALSO .BR decode-vaio (1) .SH AUTHORS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/eeprom/decode-vaio new/i2c-tools-4.2/eeprom/decode-vaio --- old/i2c-tools-4.1/eeprom/decode-vaio 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/eeprom/decode-vaio 2020-09-22 10:02:42.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # -# Copyright (C) 2002-2008 Jean Delvare <[email protected]> +# Copyright (C) 2002-2020 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 @@ -19,7 +19,7 @@ # # EEPROM data decoding for Sony Vaio laptops. # -# The eeprom driver must be loaded. For kernels older than 2.6.0, the +# The at24 or eeprom driver must be loaded. For kernels older than 2.6.0, the # eeprom driver can be found in the lm-sensors package. # # Please note that this is a guess-only work. Sony support refused to help @@ -53,11 +53,39 @@ use strict; use Fcntl qw(:DEFAULT :seek); +use File::Basename; use vars qw($sysfs $found); -use constant VERSION => "1.6"; +use constant VERSION => "1.7"; use constant ONLYROOT => "Readable only by root"; +# 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; +} + +# From a sysfs device path, return the driver name, or undef (stolen from +# sensors-detect) +sub sysfs_device_driver +{ + my $device = shift; + + my $link = readlink("$device/driver"); + return unless defined $link; + return basename($link); +} + sub print_item { my ($label,$value) = @_; @@ -209,10 +237,15 @@ print("\n"); } -for (my $i = 0, $found=0; $i <= 4 && !$found; $i++) +for (my $i = 0, $found=0; $i <= 31 && !$found; $i++) { if (-r "/sys/bus/i2c/devices/$i-0057/eeprom") { + my $driver = sysfs_device_driver("/sys/bus/i2c/devices/$i-0057"); + my $name = sysfs_device_attribute("/sys/bus/i2c/devices/$i-0057", "name"); + next unless ($driver eq "at24" || $driver eq "eeprom"); + next if ($driver eq "at24" && $name ne "24c02-vaio"); + $sysfs = 1; $found += vaio_decode($i, '57'); } @@ -233,5 +266,5 @@ if (!$found) { - print("Vaio EEPROM not found. Please make sure that the eeprom module is loaded.\n"); + print("Vaio EEPROM not found. Please make sure that the at24 or eeprom module is loaded.\n"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/eeprom/decode-vaio.1 new/i2c-tools-4.2/eeprom/decode-vaio.1 --- old/i2c-tools-4.1/eeprom/decode-vaio.1 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/eeprom/decode-vaio.1 2020-09-22 10:02:42.000000000 +0200 @@ -29,6 +29,10 @@ tool is to decode the information found in the Sony Vaio laptop identification EEPROMs. The tool requires the eeprom kernel module to be loaded. +.SH BUGS +To report bugs or send fixes, please write to the Linux I2C mailing list +<[email protected]> with Cc to the current maintainer: +Jean Delvare <[email protected]>. .SH SEE ALSO .BR decode-dimms (1) .SH AUTHOR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/lib/Module.mk new/i2c-tools-4.2/lib/Module.mk --- old/i2c-tools-4.1/lib/Module.mk 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/lib/Module.mk 2020-09-22 10:02:42.000000000 +0200 @@ -1,6 +1,6 @@ # I2C library for Linux # -# Copyright (C) 2012 Jean Delvare <[email protected]> +# Copyright (C) 2012-2020 Jean Delvare <[email protected]> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published @@ -9,7 +9,7 @@ LIB_DIR := lib -LIB_CFLAGS := -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ +LIB_CFLAGS += -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ -Wcast-align -Wwrite-strings -Wnested-externs -Winline \ -W -Wundef -Wmissing-prototypes -Iinclude @@ -87,7 +87,7 @@ $(RM) $(addprefix $(LIB_DIR)/,*.o *.ao $(LIB_TARGETS) $(LIB_LINKS)) install-lib: $(addprefix $(LIB_DIR)/,$(LIB_TARGETS)) - $(INSTALL_DIR) $(DESTDIR)$(libdir) + $(INSTALL_DIR) $(DESTDIR)$(libdir) $(DESTDIR)$(man3dir) ifeq ($(BUILD_DYNAMIC_LIB),1) $(INSTALL_PROGRAM) $(LIB_DIR)/$(LIB_SHLIBNAME) $(DESTDIR)$(libdir) $(LN) $(LIB_SHLIBNAME) $(DESTDIR)$(libdir)/$(LIB_SHSONAME) @@ -96,10 +96,12 @@ ifeq ($(BUILD_STATIC_LIB),1) $(INSTALL_DATA) $(LIB_DIR)/$(LIB_STLIBNAME) $(DESTDIR)$(libdir) endif + $(INSTALL_DATA) $(LIB_DIR)/libi2c.3 $(DESTDIR)$(man3dir) uninstall-lib: for library in $(LIB_TARGETS) $(LIB_LINKS) ; do \ $(RM) $(DESTDIR)$(libdir)/$$library ; done + $(RM) $(DESTDIR)$(man3dir)/libi2c.3 all: all-lib diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/lib/libi2c.3 new/i2c-tools-4.2/lib/libi2c.3 --- old/i2c-tools-4.1/lib/libi2c.3 1970-01-01 01:00:00.000000000 +0100 +++ new/i2c-tools-4.2/lib/libi2c.3 2020-09-22 10:02:42.000000000 +0200 @@ -0,0 +1,142 @@ +.\" Copyright (C) 2019-2020 Jean Delvare <[email protected]> +.\" libi2c is distributed under the LGPL +.TH libi2c 3 "September 2020" "i2c-tools" "Linux Programmer's Manual" + +.SH NAME +libi2c \- publicly accessible functions provided by the i2c library + +.SH SYNOPSIS +.nf +.B #include <linux/i2c.h> +.B #include <i2c/smbus.h> + +/* Universal SMBus transaction */ +.BI "__s32 i2c_smbus_access(int " file ", char " read_write ", __u8 " command "," +.BI " int " size ", union i2c_smbus_data *" data ");" + +/* Simple SMBus transactions */ +.BI "__s32 i2c_smbus_write_quick(int " file ", __u8 " value ");" +.BI "__s32 i2c_smbus_read_byte(int " file ");" +.BI "__s32 i2c_smbus_write_byte(int " file ", __u8 " value ");" +.BI "__s32 i2c_smbus_read_byte_data(int " file ", __u8 " command ");" +.BI "__s32 i2c_smbus_write_byte_data(int " file ", __u8 " command ", __u8 " value ");" +.BI "__s32 i2c_smbus_read_word_data(int " file ", __u8 " command ");" +.BI "__s32 i2c_smbus_write_word_data(int " file ", __u8 " command ", __u16 " value ");" +.BI "__s32 i2c_smbus_process_call(int " file ", __u8 " command ", __u16 " value ");" + +/* Block SMBus (and non-SMBus) transactions */ +.BI "__s32 i2c_smbus_read_block_data(int " file ", __u8 " command ", __u8 *" values ");" +.BI "__s32 i2c_smbus_write_block_data(int " file ", __u8 " command ", __u8 " length "," +.BI " const __u8 *" values ");" +.BI "__s32 i2c_smbus_block_process_call(int " file ", __u8 " command ", __u8 " length "," +.BI " __u8 *" values ");" +.BI "__s32 i2c_smbus_read_i2c_block_data(int " file ", __u8 " command ", __u8 " length "," +.BI " __u8 *" values ");" +.BI "__s32 i2c_smbus_write_i2c_block_data(int " file ", __u8 " command ", __u8 " length "," +.BI " const __u8 *" values ");" + +.SH DESCRIPTION +This library offers to user-space an SMBus-level API similar to the in-kernel +one. +Each function is a wrapper around the appropriate ioctl call for i2c-dev to +process. +The i2c-dev kernel driver will convert the ioctl to its in-kernel +equivalent function call, and pass the result back to the user-space caller. + +.B i2c_smbus_access() +is the universal function to run any SMBus transaction. +You have to fill out and link the data structures yourself. +It returns 0 on success, or a negative \fBerrno\fR value on error. +In practice you should never need to call this function directly, instead use +one of the specific functions below, which will prepare the data and then +call it for you. + +.B i2c_smbus_write_quick() +runs an SMBus "Quick command" transaction. + +.B i2c_smbus_write_byte() +runs an SMBus "Send byte" transaction. + +.B i2c_smbus_write_byte_data() +runs an SMBus "Write byte" transaction. + +.B i2c_smbus_write_word_data() +runs an SMBus "Write word" transaction. + +These write transaction functions return 0 on success. +On error, a negative \fBerrno\fR value is returned. + +.B i2c_smbus_read_byte() +runs an SMBus "Receive byte" transaction. + +.B i2c_smbus_read_byte_data() +runs an SMBus "Read byte" transaction. + +.B i2c_smbus_read_word_data() +runs an SMBus "Read word" transaction. + +.B i2c_smbus_process_call() +runs an SMBus "Process call" transaction. + +These read transaction functions return the read byte or word value on success. +On error, a negative \fBerrno\fR value is returned. + +.B i2c_smbus_write_block_data() +runs an SMBus "Block write" transaction. + +.B i2c_smbus_read_block_data() +runs an SMBus "Block read" transaction. + +.B i2c_smbus_block_process_call() +runs an SMBus "Block write-block read process call" transaction. + +These block transaction functions return 0 on success. +On error, a negative \fBerrno\fR value is returned. +The block length is limited to 32 bytes. + +.B i2c_smbus_write_i2c_block_data() +runs an "I2C block write" transaction. This is typically used to write to +an EEPROM up to 4 kb in size. + +.B i2c_smbus_read_i2c_block_data() +runs an "I2C block read" transaction. This is typically used to read from +an EEPROM up to 4 kb in size. + +While technically not part of the SMBus specification, these I2C block +transactions are supported by many SMBus host controllers. +These block transaction functions return 0 on success. +On error, a negative \fBerrno\fR value is returned. +Like their SMBus counterparts, the block length is limited to 32 bytes. + +.SH DATA STRUCTURES + +Structure \fBi2c_smbus_ioctl_data\fR is used to send data to and retrieve +data from the kernel through the i2c-dev driver. +It will be filled out for you by \fBi2c_smbus_access()\fR so you do not need +to care about the details. + +Union \fBi2c_smbus_data\fR is used to store all possible SMBus data. + +union \fBi2c_smbus_data\fR { +.br + \fB__u8\fR byte; +.br + \fB__u16\fR word; +.br + \fB__u8\fR block[I2C_SMBUS_BLOCK_MAX + 2]; +.br +}; + +\fBblock[0]\fR is used for length and the last byte is reserved. +If you use the higher-level functions, this structure will be filled out for +you so you do not have to care about the details. +Only if you call \fBi2c_smbus_access()\fR directly, you need to fill it out +yourself. + +.SH BUGS +To report bugs or send fixes, please write to the Linux I2C mailing list +<[email protected]> with Cc to the current maintainer: +Jean Delvare <[email protected]>. + +.SH AUTHOR +Simon G. Vogl, Frodo Looijaard, Jean Delvare and others diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/stub/i2c-stub-from-dump new/i2c-tools-4.2/stub/i2c-stub-from-dump --- old/i2c-tools-4.1/stub/i2c-stub-from-dump 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/stub/i2c-stub-from-dump 2020-09-22 10:02:42.000000000 +0200 @@ -127,10 +127,10 @@ open(DUMP, $dump) || die "Can't open $dump: $!\n"; OUTER_LOOP: while (<DUMP>) { - if (m/^([0-9a-f]0) ?[:|](( [0-9a-fX]{2}){16})/i) { + if (m/^([0-9a-f]+0)[ :|]?(( ?[0-9a-fX]{2}){16})/i) { # Byte dump my $offset = hex($1); - my @values = split(/ /, $2); + my @values = split(/ ?/, $2); shift(@values); for (my $i = 0; $i < 16 && (my $val = shift(@values)); $i++) { next if $val =~ m/X/; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/stub/i2c-stub-from-dump.8 new/i2c-tools-4.2/stub/i2c-stub-from-dump.8 --- old/i2c-tools-4.1/stub/i2c-stub-from-dump.8 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/stub/i2c-stub-from-dump.8 2020-09-22 10:02:42.000000000 +0200 @@ -45,6 +45,11 @@ .IP \(bu Device must not have banks (as most Winbond devices do). +.SH BUGS +To report bugs or send fixes, please write to the Linux I2C mailing list +<[email protected]> with Cc to the current maintainer: +Jean Delvare <[email protected]>. + .SH SEE ALSO i2cdump(8), i2cdetect(8), i2cset(8) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/tools/Module.mk new/i2c-tools-4.2/tools/Module.mk --- old/i2c-tools-4.1/tools/Module.mk 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/tools/Module.mk 2020-09-22 10:02:42.000000000 +0200 @@ -9,13 +9,13 @@ TOOLS_DIR := tools -TOOLS_CFLAGS := -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ +TOOLS_CFLAGS += -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ -Wcast-align -Wwrite-strings -Wnested-externs -Winline \ -W -Wundef -Wmissing-prototypes -Iinclude ifeq ($(USE_STATIC_LIB),1) -TOOLS_LDFLAGS := $(LIB_DIR)/$(LIB_STLIBNAME) +TOOLS_LDFLAGS += $(LIB_DIR)/$(LIB_STLIBNAME) else -TOOLS_LDFLAGS := -L$(LIB_DIR) -li2c +TOOLS_LDFLAGS += -L$(LIB_DIR) -li2c endif TOOLS_TARGETS := i2cdetect i2cdump i2cset i2cget i2ctransfer diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/tools/i2cbusses.c new/i2c-tools-4.2/tools/i2cbusses.c --- old/i2c-tools-4.1/tools/i2cbusses.c 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/tools/i2cbusses.c 2020-09-22 10:02:42.000000000 +0200 @@ -381,7 +381,7 @@ { long address; char *end; - long min_addr = 0x03; + long min_addr = 0x08; long max_addr = 0x77; address = strtol(address_arg, &end, 0); @@ -406,14 +406,21 @@ int open_i2c_dev(int i2cbus, char *filename, size_t size, int quiet) { - int file; + int file, len; - snprintf(filename, size, "/dev/i2c/%d", i2cbus); - filename[size - 1] = '\0'; + len = snprintf(filename, size, "/dev/i2c/%d", i2cbus); + if (len >= (int)size) { + fprintf(stderr, "%s: path truncated\n", filename); + return -EOVERFLOW; + } file = open(filename, O_RDWR); if (file < 0 && (errno == ENOENT || errno == ENOTDIR)) { - sprintf(filename, "/dev/i2c-%d", i2cbus); + len = snprintf(filename, size, "/dev/i2c-%d", i2cbus); + if (len >= (int)size) { + fprintf(stderr, "%s: path truncated\n", filename); + return -EOVERFLOW; + } file = open(filename, O_RDWR); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/tools/i2cdetect.8 new/i2c-tools-4.2/tools/i2cdetect.8 --- old/i2c-tools-4.1/tools/i2cdetect.8 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/tools/i2cdetect.8 2020-09-22 10:02:42.000000000 +0200 @@ -26,7 +26,7 @@ \fIi2cbus\fR indicates the number or name of the I2C bus to be scanned, and should correspond to one of the busses listed by \fIi2cdetect -l\fR. The optional parameters \fIfirst\fR and \fIlast\fR restrict the scanning -range (default: from 0x03 to 0x77). +range (default: from 0x08 to 0x77). .PP As there is no standard I2C detection command, i2cdetect uses arbitrary SMBus commands (namely SMBus quick write and SMBus receive byte) to probe @@ -113,6 +113,11 @@ .RE .fi +.SH BUGS +To report bugs or send fixes, please write to the Linux I2C mailing list +<[email protected]> with Cc to the current maintainer: +Jean Delvare <[email protected]>. + .SH SEE ALSO i2cdump(8), i2cget(8), i2cset(8), i2ctransfer(8), sensors-detect(8) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/tools/i2cdetect.c new/i2c-tools-4.2/tools/i2cdetect.c --- old/i2c-tools-4.1/tools/i2cdetect.c 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/tools/i2cdetect.c 2020-09-22 10:02:42.000000000 +0200 @@ -204,7 +204,7 @@ char filename[20]; unsigned long funcs; int mode = MODE_AUTO; - int first = 0x03, last = 0x77; + int first = 0x08, last = 0x77; int flags = 0; int yes = 0, version = 0, list = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/tools/i2cdump.8 new/i2c-tools-4.2/tools/i2cdump.8 --- old/i2c-tools-4.1/tools/i2cdump.8 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/tools/i2cdump.8 2020-09-22 10:02:42.000000000 +0200 @@ -43,12 +43,12 @@ scripts. .TP .B -a -Allow using addresses between 0x00 - 0x02 and 0x78 - 0x7f. Not recommended. +Allow using addresses between 0x00 - 0x07 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 of the busses listed by \fIi2cdetect -l\fR. \fIaddress\fR indicates the -address to be scanned on that bus, and is an integer between 0x03 and 0x77. +address to be scanned on that bus, and is an integer between 0x08 and 0x77. .PP The \fImode\fR parameter, if specified, is one of the letters \fBb\fP, \fBw\fP, \fBs\fP, or \fBi\fP, corresponding to a read size of a single byte, a 16-bit @@ -116,6 +116,11 @@ .RE .fi +.SH BUGS +To report bugs or send fixes, please write to the Linux I2C mailing list +<[email protected]> with Cc to the current maintainer: +Jean Delvare <[email protected]>. + .SH SEE ALSO i2cdetect(8), i2cget(8), i2cset(8), i2ctransfer(8), isadump(8) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/tools/i2cdump.c new/i2c-tools-4.2/tools/i2cdump.c --- old/i2c-tools-4.1/tools/i2cdump.c 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/tools/i2cdump.c 2020-09-22 10:02:42.000000000 +0200 @@ -38,7 +38,7 @@ fprintf(stderr, "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, or 0x00 - 0x7f if -a is given)\n" + " ADDRESS is an integer (0x08 - 0x77, or 0x00 - 0x7f if -a is given)\n" " MODE is one of:\n" " b (byte, default)\n" " w (word)\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/tools/i2cget.8 new/i2c-tools-4.2/tools/i2cget.8 --- old/i2c-tools-4.1/tools/i2cget.8 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/tools/i2cget.8 2020-09-22 10:02:42.000000000 +0200 @@ -37,12 +37,12 @@ scripts. Use with caution. .TP .B -a -Allow using addresses between 0x00 - 0x02 and 0x78 - 0x7f. Not recommended. +Allow using addresses between 0x00 - 0x07 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 the busses listed by \fIi2cdetect -l\fR. \fIchip-address\fR specifies the -address of the chip on that bus, and is an integer between 0x03 and 0x77. +address of the chip on that bus, and is an integer between 0x08 and 0x77. .PP \fIdata-address\fR specifies the address on that chip to read from, and is an integer between 0x00 and 0xFF. If omitted, the currently active register @@ -113,6 +113,11 @@ master isn't fully I2C capable. With a fully I2C capable master, you would use \fIi2ctransfer\fR to achieve the same in a safe and faster way. +.SH BUGS +To report bugs or send fixes, please write to the Linux I2C mailing list +<[email protected]> with Cc to the current maintainer: +Jean Delvare <[email protected]>. + .SH SEE ALSO i2cdetect(8), i2cdump(8), i2cset(8), i2ctransfer(8) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/tools/i2cget.c new/i2c-tools-4.2/tools/i2cget.c --- old/i2c-tools-4.1/tools/i2cget.c 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/tools/i2cget.c 2020-09-22 10:02:42.000000000 +0200 @@ -43,7 +43,7 @@ fprintf(stderr, "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, or 0x00 - 0x7f if -a is given)\n" + " ADDRESS is an integer (0x08 - 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" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/tools/i2cset.8 new/i2c-tools-4.2/tools/i2cset.8 --- old/i2c-tools-4.1/tools/i2cset.8 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/tools/i2cset.8 2020-09-22 10:02:42.000000000 +0200 @@ -57,12 +57,12 @@ apply as those of option \fB-m\fR. .TP .B -a -Allow using addresses between 0x00 - 0x02 and 0x78 - 0x7f. Not recommended. +Allow using addresses between 0x00 - 0x07 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 the busses listed by \fIi2cdetect -l\fR. \fIchip-address\fR specifies the -address of the chip on that bus, and is an integer between 0x03 and 0x77. +address of the chip on that bus, and is an integer between 0x08 and 0x77. \fIdata-address\fR specifies the address on that chip to write to, and is an integer between 0x00 and 0xFF. .PP @@ -125,6 +125,11 @@ Also see i2cget(8) for examples of combined usage of \fIi2cset\fR and \fIi2cget\fR. +.SH BUGS +To report bugs or send fixes, please write to the Linux I2C mailing list +<[email protected]> with Cc to the current maintainer: +Jean Delvare <[email protected]>. + .SH SEE ALSO i2cdetect(8), i2cdump(8), i2cget(8), i2ctransfer(8), isaset(8) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/tools/i2cset.c new/i2c-tools-4.2/tools/i2cset.c --- old/i2c-tools-4.1/tools/i2cset.c 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/tools/i2cset.c 2020-09-22 10:02:42.000000000 +0200 @@ -40,7 +40,7 @@ fprintf(stderr, "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, or 0x00 - 0x7f if -a is given)\n" + " ADDRESS is an integer (0x08 - 0x77, or 0x00 - 0x7f if -a is given)\n" " MODE is one of:\n" " c (byte, no value)\n" " b (byte data, default)\n" @@ -125,11 +125,11 @@ } fprintf(stderr, "I will write to device file %s, chip address " - "0x%02x, data address\n0x%02x, ", filename, address, daddress); - if (size == I2C_SMBUS_BYTE) - fprintf(stderr, "no data.\n"); - else if (size == I2C_SMBUS_BLOCK_DATA || - size == I2C_SMBUS_I2C_BLOCK_DATA) { + "0x%02x,\n", filename, address); + if (size != I2C_SMBUS_BYTE) + fprintf(stderr, "data address 0x%02x, ", daddress); + if (size == I2C_SMBUS_BLOCK_DATA || + size == I2C_SMBUS_I2C_BLOCK_DATA) { int i; fprintf(stderr, "data"); @@ -140,7 +140,7 @@ } else fprintf(stderr, "data 0x%02x%s, mode %s.\n", value, vmask ? " (masked)" : "", - size == I2C_SMBUS_BYTE_DATA ? "byte" : "word"); + size == I2C_SMBUS_WORD_DATA ? "word" : "byte"); if (pec) fprintf(stderr, "PEC checking enabled.\n"); @@ -264,6 +264,10 @@ /* read values from command line */ switch (size) { + case I2C_SMBUS_BYTE: + /* short write: data address was not really data address */ + value = daddress; + break; case I2C_SMBUS_BYTE_DATA: case I2C_SMBUS_WORD_DATA: value = strtol(argv[flags+4], &end, 0); @@ -344,12 +348,10 @@ if (!yes) { fprintf(stderr, "Old value 0x%0*x, write mask " - "0x%0*x: Will write 0x%0*x to register " - "0x%02x\n", + "0x%0*x, will write 0x%0*x\n", size == I2C_SMBUS_WORD_DATA ? 4 : 2, oldvalue, size == I2C_SMBUS_WORD_DATA ? 4 : 2, vmask, - size == I2C_SMBUS_WORD_DATA ? 4 : 2, value, - daddress); + size == I2C_SMBUS_WORD_DATA ? 4 : 2, value); fprintf(stderr, "Continue? [Y/n] "); fflush(stderr); @@ -369,7 +371,7 @@ switch (size) { case I2C_SMBUS_BYTE: - res = i2c_smbus_write_byte(file, daddress); + res = i2c_smbus_write_byte(file, value); break; case I2C_SMBUS_WORD_DATA: res = i2c_smbus_write_word_data(file, daddress, value); @@ -407,7 +409,6 @@ switch (size) { case I2C_SMBUS_BYTE: res = i2c_smbus_read_byte(file); - value = daddress; break; case I2C_SMBUS_WORD_DATA: res = i2c_smbus_read_word_data(file, daddress); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/tools/i2ctransfer.8 new/i2c-tools-4.2/tools/i2ctransfer.8 --- old/i2c-tools-4.1/tools/i2ctransfer.8 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/tools/i2ctransfer.8 2020-09-22 10:02:42.000000000 +0200 @@ -64,7 +64,7 @@ Display the version and exit. .TP .B -a -Allow using addresses between 0x00 - 0x02 and 0x78 - 0x7f. Not recommended. +Allow using addresses between 0x00 - 0x07 and 0x78 - 0x7f. Not recommended. .SH ARGUMENTS .PP @@ -91,15 +91,18 @@ .B <length_of_message> specifies the number of bytes read or written in this message. It is parsed as an unsigned 16 bit integer, but note that the Linux Kernel applies an additional upper limit (8192 as of v4.10). +For read messages to targets which support SMBus Block transactions, it can also be '?', then the target will determine the length. .TP .B [@address] specifies the 7-bit address of the chip to be accessed for this message, and is an integer. If omitted, reuse the previous address. -Normally, addresses outside the range of 0x03-0x77 and addresses with a kernel driver attached to them will be blocked. -With +Normally, addresses outside the range of 0x08-0x77 and addresses with a kernel driver attached to them will be blocked. +This can be overridden with +.I -a +(all) or .I -f -(force), all addresses can be used. -Be very careful when using that! +(force). +Be very careful when using these! 10-bit addresses are currently not supported at all. .PP @@ -149,6 +152,11 @@ Writing to a serial EEPROM on a memory DIMM (chip addresses between 0x50 and 0x57) may DESTROY your memory, leaving your system unbootable! Be extremely careful using this program. +.SH BUGS +To report bugs or send fixes, please write to the Linux I2C mailing list +<[email protected]> with Cc to the current maintainer: +Jean Delvare <[email protected]>. + .SH AUTHORS Wolfram Sang, based on .B i2cget diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/tools/i2ctransfer.c new/i2c-tools-4.2/tools/i2ctransfer.c --- old/i2c-tools-4.1/tools/i2ctransfer.c 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/tools/i2ctransfer.c 2020-09-22 10:02:42.000000000 +0200 @@ -45,7 +45,8 @@ "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" + " 1) read/write-flag 2) LENGTH (range 0-65535, or '?')\n" + " 3) I2C address (use last one if omitted)\n" " DATA are LENGTH bytes for a write message. They can be shortened by a suffix:\n" " = (keep value constant until LENGTH)\n" " + (increase value by 1 until LENGTH)\n" @@ -84,17 +85,29 @@ for (i = 0; i < nmsgs; i++) { int read = msgs[i].flags & I2C_M_RD; + int recv_len = msgs[i].flags & I2C_M_RECV_LEN; int print_buf = (read && (flags & PRINT_READ_BUF)) || (!read && (flags & PRINT_WRITE_BUF)); + __u16 len = msgs[i].len; - if (flags & PRINT_HEADER) - fprintf(output, "msg %u: addr 0x%02x, %s, len %u", - i, msgs[i].addr, read ? "read" : "write", msgs[i].len); + if (recv_len && print_buf && len != msgs[i].buf[0] + 1) { + fprintf(stderr, "Correcting wrong msg length after recv_len! Please fix the I2C driver and/or report.\n"); + len = msgs[i].buf[0] + 1; + } + + if (flags & PRINT_HEADER) { + fprintf(output, "msg %u: addr 0x%02x, %s, len ", + i, msgs[i].addr, read ? "read" : "write"); + if (!recv_len || flags & PRINT_READ_BUF) + fprintf(output, "%u", len); + else + fprintf(output, "TBD"); + } - if (msgs[i].len && print_buf) { + if (len && print_buf) { if (flags & PRINT_HEADER) fprintf(output, ", buf "); - for (j = 0; j < msgs[i].len - 1; j++) + for (j = 0; j < len - 1; j++) fprintf(output, "0x%02x ", msgs[i].buf[j]); /* Print final byte with newline */ fprintf(output, "0x%02x\n", msgs[i].buf[j]); @@ -192,13 +205,23 @@ goto err_out_with_arg; } - len = strtoul(arg_ptr, &end, 0); - if (len > 0xffff || arg_ptr == end) { - fprintf(stderr, "Error: Length invalid\n"); - goto err_out_with_arg; + if (*arg_ptr == '?') { + if (!(flags & I2C_M_RD)) { + fprintf(stderr, "Error: variable length not allowed with write\n"); + goto err_out_with_arg; + } + len = 256; /* SMBUS3_MAX_BLOCK_LEN + 1 */ + flags |= I2C_M_RECV_LEN; + arg_ptr++; + } else { + len = strtoul(arg_ptr, &end, 0); + if (len > 0xffff || arg_ptr == end) { + fprintf(stderr, "Error: Length invalid\n"); + goto err_out_with_arg; + } + arg_ptr = end; } - arg_ptr = end; if (*arg_ptr) { if (*arg_ptr++ != '@') { fprintf(stderr, "Error: Unknown separator after length\n"); @@ -237,6 +260,8 @@ } memset(buf, 0, len); msgs[nmsgs].buf = buf; + if (flags & I2C_M_RECV_LEN) + buf[0] = 1; /* number of extra bytes */ } if (flags & I2C_M_RD || len == 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i2c-tools-4.1/version.h new/i2c-tools-4.2/version.h --- old/i2c-tools-4.1/version.h 2018-11-30 15:15:21.000000000 +0100 +++ new/i2c-tools-4.2/version.h 2020-09-22 10:02:42.000000000 +0200 @@ -1 +1 @@ -#define VERSION "4.1" +#define VERSION "4.2"
