debian/0000755000000000000000000000000012000305712007154 5ustar debian/rules0000755000000000000000000000516511602177031010253 0ustar #!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_HOST_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM) ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) CFLAGS += -g endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif PYVERS = $(shell pyversions -v -r debian/control) clean: dh_testdir dh_testroot $(MAKE) clean rm -rf py-smbus/build rm -f *-stamp* dh_clean # Build everything that goes into the Debian package. Use recursive make # invocations to build all of the interesting components. build: build-arch build-indep build-arch: build-stamp-binaries $(PYVERS:%=build-stamp-python-%) build-indep: build-stamp-binaries build-stamp-binaries: dh_testdir $(MAKE) CFLAGS="$(CFLAGS)" touch $@ build-stamp-python-%: dh_testdir cd py-smbus && \ CFLAGS="$(CFLAGS) -I../include" python$* setup.py build touch $@ install: install-stamp-binaries $(PYVERS:%=install-stamp-python-%) install-stamp-binaries: build-stamp-binaries dh_testdir dh_testroot dh_clean -k dh_installdirs $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp prefix=/usr dh_install --sourcedir=debian/tmp touch $@ install-stamp-python-%: build-stamp-python-% dh_testdir dh_testroot dh_installdirs $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp prefix=/usr cd py-smbus && \ CFLAGS="$(CFLAGS) -I../include" python$* setup.py install --install-layout=deb --root=$(CURDIR)/debian/python-smbus touch $@ # Build architecture-independent files here. binary-indep: build install dh_testdir dh_testroot dh_installchangelogs -i CHANGES dh_installdocs -i dh_installman -i dh_link -i dh_strip -i dh_compress -i dh_fixperms -i dh_installdeb -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i # Build architecture-dependant files that arn't kernel modules here. binary-arch: build install dh_testdir dh_testroot dh_installchangelogs -a CHANGES dh_installdocs -a dh_installman -a dh_installudev -a dh_link -a dh_strip -a dh_compress -a dh_fixperms -a dh_perl -a dh_makeshlibs -a dh_python2 -a dh_installdeb -a dh_shlibdeps -a dh_gencontrol -a dh_md5sums -a dh_builddeb -a binary: binary-arch binary-indep .PHONY: clean build build-arch build-indep install binary-indep binary-arch binary debian/i2c-tools.doc0000644000000000000000000000001611523532065011467 0ustar eeprom/README debian/changelog0000644000000000000000000000647112000305712011036 0ustar i2c-tools (3.1.0-2) unstable; urgency=low * decode-dimms: exit gracefully when no EEPROM are found on the system (Closes: #681057). -- Aurelien Jarno Sat, 14 Jul 2012 17:09:59 +0200 i2c-tools (3.1.0-1) unstable; urgency=low * New usptream version. (Closes: #670956). * Bump Standards-Version to 3.9.3 (no changes). -- Aurelien Jarno Tue, 01 May 2012 13:28:19 +0200 i2c-tools (3.0.3-5) unstable; urgency=low * Switch to dh_python2: - Build-depends on python-all-dev (>= 2.6.6-3~). - Drop build-depends on python-support. - Remove XB-Python-Version field. - Call dh_python2 instead of dh_pysupport. - Replace debian/pyversion by X-Python-Version. * Add build-arch and build-indep targets. -- Aurelien Jarno Mon, 27 Jun 2011 23:42:49 +0200 i2c-tools (3.0.3-4) unstable; urgency=low * Don't try to change the i2c devices permissions if MAKEDEV doesn't create them. (Closes: #622156). -- Aurelien Jarno Sun, 10 Apr 2011 19:19:15 +0200 i2c-tools (3.0.3-3) unstable; urgency=low * Fix inverted logic in postinst. (Closes: #621898). -- Aurelien Jarno Sun, 10 Apr 2011 10:47:39 +0200 i2c-tools (3.0.3-2) unstable; urgency=low * Fix a typo in i2cset manpage. (Closes: #602368). * Don't try to detect udev before creating a device, it's already done by MAKEDEV. (Closes: #620785). * Bump standard versions to 3.9.2 (no changes). -- Aurelien Jarno Sat, 09 Apr 2011 14:25:18 +0200 i2c-tools (3.0.3-1) unstable; urgency=low * New upstream version. * Bump standard versions to 3.9.1 (no changes). -- Aurelien Jarno Sun, 06 Feb 2011 15:44:11 +0100 i2c-tools (3.0.2-5) unstable; urgency=low * Add depends on adduser to i2ctools. (Closes: #608835). -- Aurelien Jarno Mon, 03 Jan 2011 23:22:26 +0100 i2c-tools (3.0.2-4) unstable; urgency=low * Add ${misc:Depends} to all binaries. * Create an i2c group on install, and add a udev file to set the group and the mode of /dev/i2c-* nodes. -- Aurelien Jarno Thu, 14 Jan 2010 06:39:06 +0100 i2c-tools (3.0.2-3) unstable; urgency=low * Correctly call dh_pysupport. (Closes: #556147). -- Aurelien Jarno Sat, 14 Nov 2009 14:27:26 +0100 i2c-tools (3.0.2-2) unstable; urgency=low * i2c-tools: depends on udev | makedev and create /dev/i2c-0 (Closes: bug#546871). * Bump standard versions to 3.8.3 (no changes). -- Aurelien Jarno Wed, 14 Oct 2009 00:19:49 +0200 i2c-tools (3.0.2-1) unstable; urgency=low * New upstream version. * Bump standard versions to 3.8.0 (no changes). -- Aurelien Jarno Wed, 28 Jan 2009 23:37:31 +0100 i2c-tools (3.0.1-1) unstable; urgency=low * New upstream version. -- Aurelien Jarno Fri, 04 Apr 2008 22:14:04 +0200 i2c-tools (3.0.0-2) unstable; urgency=low * Bump standard versions to 3.7.3 (no changes). * Fix python-pysmbus description. * Fix debian/copyright. -- Aurelien Jarno Sun, 02 Mar 2008 18:54:37 +0100 i2c-tools (3.0.0-1) unstable; urgency=low * New upstream package split from lm-sensors. -- Aurelien Jarno Tue, 27 Nov 2007 16:46:35 +0100 debian/patches/0000755000000000000000000000000012000306334010604 5ustar debian/patches/01-decode-dimms-no-eeprom.diff0000644000000000000000000000046412000306333016110 0ustar --- a/eeprom/decode-dimms +++ b/eeprom/decode-dimms @@ -1774,6 +1774,9 @@ } elsif (! -d '/sys/module/eeprom') { print "No EEPROM found, are you sure the eeprom module is loaded?\n"; exit; + } else { + print "No EEPROM found, the kernel probably does not support your hardware.\n"; + exit; } } debian/patches/series0000644000000000000000000000003712000305604012020 0ustar 01-decode-dimms-no-eeprom.diff debian/dev-interface0000644000000000000000000001423311523531601011625 0ustar Usually, i2c devices are controlled by a kernel driver. But it is also possible to access all devices on an adapter from userspace, through the /dev interface. You need to load module i2c-dev for this. Each registered i2c adapter gets a number, counting from 0. You can examine /sys/class/i2c-dev/ to see what number corresponds to which adapter. I2C device files are character device files with major device number 89 and a minor device number corresponding to the number assigned as explained above. They should be called "i2c-%d" (i2c-0, i2c-1, ..., i2c-10, ...). All 256 minor device numbers are reserved for i2c. C example ========= So let's say you want to access an i2c adapter from a C program. The first thing to do is "#include ". Please note that there are two files named "i2c-dev.h" out there, one is distributed with the Linux kernel and is meant to be included from kernel driver code, the other one is distributed with lm_sensors and is meant to be included from user-space programs. You obviously want the second one here. Now, you have to decide which adapter you want to access. You should inspect /sys/class/i2c-dev/ to decide this. Adapter numbers are assigned somewhat dynamically, so you can not even assume /dev/i2c-0 is the first adapter. Next thing, open the device file, as follows: int file; int adapter_nr = 2; /* probably dynamically determined */ char filename[20]; sprintf(filename,"/dev/i2c-%d",adapter_nr); if ((file = open(filename,O_RDWR)) < 0) { /* ERROR HANDLING; you can check errno to see what went wrong */ exit(1); } When you have opened the device, you must specify with what device address you want to communicate: int addr = 0x40; /* The I2C address */ if (ioctl(file,I2C_SLAVE,addr) < 0) { /* ERROR HANDLING; you can check errno to see what went wrong */ exit(1); } Well, you are all set up now. You can now use SMBus commands or plain I2C to communicate with your device. SMBus commands are preferred if the device supports them. Both are illustrated below. __u8 register = 0x10; /* Device register to access */ __s32 res; char buf[10]; /* Using SMBus commands */ res = i2c_smbus_read_word_data(file,register); if (res < 0) { /* ERROR HANDLING: i2c transaction failed */ } else { /* res contains the read word */ } /* Using I2C Write, equivalent of i2c_smbus_write_word_data(file,register,0x6543) */ buf[0] = register; buf[1] = 0x43; buf[2] = 0x65; if ( write(file,buf,3) != 3) { /* ERROR HANDLING: i2c transaction failed */ } /* Using I2C Read, equivalent of i2c_smbus_read_byte(file) */ if (read(file,buf,1) != 1) { /* ERROR HANDLING: i2c transaction failed */ } else { /* buf[0] contains the read byte */ } IMPORTANT: because of the use of inline functions, you *have* to use '-O' or some variation when you compile your program! Full interface description ========================== The following IOCTLs are defined and fully supported (see also i2c-dev.h): ioctl(file,I2C_SLAVE,long addr) Change slave address. The address is passed in the 7 lower bits of the argument (except for 10 bit addresses, passed in the 10 lower bits in this case). ioctl(file,I2C_TENBIT,long select) Selects ten bit addresses if select not equals 0, selects normal 7 bit addresses if select equals 0. Default 0. This request is only valid if the adapter has I2C_FUNC_10BIT_ADDR. ioctl(file,I2C_PEC,long select) Selects SMBus PEC (packet error checking) generation and verification if select not equals 0, disables if select equals 0. Default 0. Used only for SMBus transactions. This request only has an effect if the the adapter has I2C_FUNC_SMBUS_PEC; it is still safe if not, it just doesn't have any effect. ioctl(file,I2C_FUNCS,unsigned long *funcs) Gets the adapter functionality and puts it in *funcs. ioctl(file,I2C_RDWR,struct i2c_rdwr_ioctl_data *msgset) Do combined read/write transaction without stop in between. Only valid if the adapter has I2C_FUNC_I2C. The argument is a pointer to a struct i2c_rdwr_ioctl_data { struct i2c_msg *msgs; /* ptr to array of simple messages */ int nmsgs; /* number of messages to exchange */ } The msgs[] themselves contain further pointers into data buffers. The function will write or read data to or from that buffers depending on whether the I2C_M_RD flag is set in a particular message or not. The slave address and whether to use ten bit address mode has to be set in each message, overriding the values set with the above ioctl's. Other values are NOT supported at this moment, except for I2C_SMBUS, which you should never directly call; instead, use the access functions below. You can do plain i2c transactions by using read(2) and write(2) calls. You do not need to pass the address byte; instead, set it through ioctl I2C_SLAVE before you try to access the device. You can do SMBus level transactions (see documentation file smbus-protocol for details) through the following functions: __s32 i2c_smbus_write_quick(int file, __u8 value); __s32 i2c_smbus_read_byte(int file); __s32 i2c_smbus_write_byte(int file, __u8 value); __s32 i2c_smbus_read_byte_data(int file, __u8 command); __s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value); __s32 i2c_smbus_read_word_data(int file, __u8 command); __s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value); __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value); __s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 *values); __s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length, __u8 *values); All these transactions return -1 on failure; you can read errno to see what happened. The 'write' transactions return 0 on success; the 'read' transactions return the read value, except for read_block, which returns the number of values read. The block buffers need not be longer than 32 bytes. The above functions are all macros, that resolve to calls to the i2c_smbus_access function, that on its turn calls a specific ioctl with the data in a specific format. Read the source code if you want to know what happens behind the screens. debian/copyright0000644000000000000000000000272211523531601011121 0ustar This package was debianized by Aurelien Jarno . It was downloaded from http://www.lm-sensors.org/ Copyright Copyright (C) 1995-1997 Simon G. Vogl Copyright (C) 1998-2004 Frodo Looijaard Copyright (C) 1998, 1999 Philip Edelbrock Copyright (C) 1998-2004 Mark D. Studebaker Copyright (C) 2002 James Simmons Copyright (C) 2002-2007 Jean Delvare Copyright (c) 2003 Stefano Barbato Copyright (C) 2005-2007 Mark M. Hoffman License: 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 with the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA On Debian systems, the complete text of the GNU General Public License, version 2, can be found in /usr/share/common-licenses/GPL-2. debian/libi2c-dev.install0000644000000000000000000000003411523531601012470 0ustar usr/include/linux/i2c-dev.h debian/source/0000755000000000000000000000000011523531667010477 5ustar debian/source/format0000644000000000000000000000001411523531667011705 0ustar 3.0 (quilt) debian/libi2c-dev.preinst0000644000000000000000000000146611523531601012520 0ustar #! /bin/sh # preinst script for libi2c-dev # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `install' # * `install' # * `upgrade' # * `abort-upgrade' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package case "$1" in install|upgrade) dpkg-divert --package libi2c-dev --divert /usr/include/linux/i2c-dev.h.kernel --rename /usr/include/linux/i2c-dev.h ;; abort-upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 debian/control0000644000000000000000000000270511747577373010622 0ustar Source: i2c-tools Section: utils Priority: extra Build-Depends: debhelper (>= 5), python-all-dev (>= 2.6.6-3~) Maintainer: Aurelien Jarno Standards-Version: 3.9.3 Homepage: http://www.lm-sensors.org X-Python-Version: >= 2.2 Package: i2c-tools Architecture: any Section: utils Conflicts: lm-sensors (<< 1:3.0.0-1) Depends: ${shlibs:Depends}, ${perl:Depends}, ${misc:Depends}, adduser, udev | makedev Suggests: libi2c-dev, python-smbus Description: heterogeneous set of I2C tools for Linux This package contains a heterogeneous set of I2C tools for Linux: a bus probing tool, a chip dumper, register-level access helpers, EEPROM decoding scripts, and more. Package: libi2c-dev Architecture: all Depends: ${misc:Depends} Section: libdevel Recommends: i2c-tools Description: userspace I2C programming library development files I2C devices are usually controlled by a kernel driver. Using this library it is also possible to access all devices on an adapter from userspace and without the knowledge of Linux kernel internals. Package: python-smbus Architecture: any Section: python Depends: ${shlibs:Depends}, ${python:Depends}, ${misc:Depends} Provides: ${python:Provides} Recommends: i2c-tools Description: Python bindings for Linux SMBus access through i2c-dev This Python module allows SMBus access through the I2C /dev interface on Linux hosts. The host kernel must have I2C support, I2C device interface support, and a bus adapter driver. debian/libi2c-dev.docs0000644000000000000000000000002511523531601011752 0ustar debian/dev-interface debian/libi2c-dev.postrm0000644000000000000000000000071111523531601012350 0ustar #! /bin/sh # postrm script for lib-i2c-dev set -e case "$1" in remove|purge) dpkg-divert --package libi2c-dev --rename --remove /usr/include/linux/i2c-dev.h ;; upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 0 esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# debian/i2c-tools.udev0000644000000000000000000000005711523531601011665 0ustar KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660" debian/i2c-tools.postinst0000644000000000000000000000144711550363221012612 0ustar #!/bin/sh set -e case "$1" in configure) # Add the i2c group unless it's already there if ! getent group i2c >/dev/null; then addgroup --quiet --system i2c || true fi # Create the device node if MAKEDEV exists if [ -x /sbin/MAKEDEV ] && [ ! -c /dev/i2c-0 ]; then (cd /dev && MAKEDEV i2c) for i in `seq 1 16` ; do dev=/dev/i2c-$i if [ -c $dev ]; then chmod 0660 $dev chown root:i2c $dev fi done fi ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 debian/compat0000644000000000000000000000000211523531601010361 0ustar 5 debian/i2c-tools.install0000644000000000000000000000041311523531601012364 0ustar usr/bin/ddcmon usr/bin/decode-vaio usr/bin/decode-edid usr/bin/decode-dimms usr/share/man/man8/i2cset.8 usr/share/man/man8/i2cdump.8 usr/share/man/man8/i2cget.8 usr/share/man/man8/i2cdetect.8 usr/sbin/i2cset usr/sbin/i2cdetect usr/sbin/i2cget usr/sbin/i2cdump