Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7d17254
Modified smbusmodule.c to add support for python3 and modified setup.…
Apr 11, 2014
c7858bb
Fixed python module.mk to use the proper root and prefix
Apr 12, 2014
044b3af
i2cget: Add support for i2c block data
May 9, 2016
97e6cc3
Removing warning in gcc version 4.9.2 (Sourcery CodeBench Lite 2015.0…
per-ok Jun 28, 2016
45e28fb
Made it possible to strip cross compile code.
per-ok Jun 28, 2016
fde8f79
Made it possible to choose root install folder.
per-ok Jun 28, 2016
700c58e
Allow python to open forcefully i2c device address
GssMahadevan Aug 14, 2016
048e249
Remove stray character in source
GssMahadevan Aug 14, 2016
558fa46
Update README
GssMahadevan Aug 14, 2016
02cad51
Update README
GssMahadevan Aug 14, 2016
c8190c2
Update README
GssMahadevan Aug 14, 2016
bf3ea29
Merge https://github.com/cdleonard/i2c-tools
kaklik Nov 9, 2016
e2d40b3
FIX: function names mismatch.
kaklik Nov 9, 2016
10e8ade
Version string increased. Man page required for installation created.
kaklik Nov 9, 2016
bf3a387
Merge https://github.com/GssMahadevan/i2c-tools
kaklik Nov 9, 2016
fe91627
First implementation of Simple send transaction and Simple receive tr…
kaklik Nov 9, 2016
c466ecf
Merge https://github.com/per-ok/i2c-tools
kaklik Nov 11, 2016
8bd04c7
properly link against the libi2c library
kaklik Nov 11, 2016
907ac87
Merge https://github.com/impakt73/i2c-tools
kaklik Nov 11, 2016
ec9e822
eeprog cleanup activated in Makefile.
kaklik Nov 11, 2016
f1e7e9b
use correct write and read functions instead of i2c_master_send and …
kaklik Nov 21, 2016
87d93d0
FIX: wrong types casting from python to C.
kaklik Nov 21, 2016
14770f9
FIX: correct writing to I2C bus in write_i2c_block function.
kaklik Nov 22, 2016
c232eef
The first working code with sht31 MLAB example.
kaklik Nov 22, 2016
e66fe48
resolved problem with incorrect block lenght detection in C code.
kaklik Nov 22, 2016
fde1567
Fix compilation error when Python 3 is used.
kaklik Dec 6, 2016
57d7491
Travis testing suite activated.
kaklik Dec 11, 2016
571573f
Fix of Travis test setup.
kaklik Dec 11, 2016
951f07f
Travis build icon is in README.
kaklik Dec 11, 2016
54f3c0e
Update README.md
kaklik Oct 19, 2018
e45c4b6
Update README.md
roman-dvorak Feb 20, 2021
7381a02
Update README.md
kaklik Sep 2, 2022
bfe8a57
Update README.md
kaklik Sep 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: c
compiler:
- gcc

script: make EXTRA="py-smbus" && sudo make install && cd py-smbus && sudo python setup.py install

sudo: required

10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# I2C tools for Linux
#
# Copyright (C) 2007-2012 Jean Delvare <jdelvare@suse.de>
# Copyright (C) 2014 Danielle Costantino <danielle.costantino@gmail.com>
#
# 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.

DESTDIR =
DESTDIR ?=
prefix = /usr/local
bindir = $(prefix)/bin
sbindir = $(prefix)/sbin
Expand Down Expand Up @@ -38,6 +37,7 @@ AS ?= $(CROSS_COMPILE)as
LD ?= $(CROSS_COMPILE)ld
CC ?= $(CROSS_COMPILE)gcc
AR ?= $(CROSS_COMPILE)ar
STRIP ?= $(CROSS_COMPILE)strip

CFLAGS ?= -O2
# When debugging, use the following instead
Expand All @@ -57,7 +57,7 @@ KERNELVERSION := $(shell uname -r)

all:

#EXTRA :=
EXTRA += eeprog py-smbus
SRCDIRS := include lib eeprom stub tools $(EXTRA)
EXTRA :=
#EXTRA += eeprog py-smbus
SRCDIRS := include lib eeprom eeprog stub tools $(EXTRA)
include $(SRCDIRS:%=%/Module.mk)
47 changes: 28 additions & 19 deletions README → README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/MLAB-project/i2c-tools.svg?branch=master)](https://travis-ci.org/MLAB-project/i2c-tools)

I2C TOOLS FOR LINUX
===================

Expand All @@ -6,42 +8,45 @@ as well as an I2C library. The tools were originally part of the lm-sensors
project but were finally split into their own package for convenience. The
library is used by some of the tools, but can also be used by third-party
applications. The tools and library compile, run and have been tested on
GNU/Linux.
GNU/Linux on ODROID, Raspberry Pi and Beaglebone boards.

## Implemented Changes

The latest version of the code can be downloaded from:
http://www.lm-sensors.org/wiki/I2CTools
* By default i2-tools/py-smbus module does not provide an option to forcefully open a i2c-device-address (for safe reasons). But i2get command gives option `-y` to read/write.
* Added the `write_i2c_block` and `read_i2c_block` methods

At now the python-smbus seems to be surpassed by new implementation [python-smbus2](https://github.com/kplindegaard/smbus2) which is a drop in replacement in most cases.

CONTENTS
--------

The various tools included in this package are grouped by category, each
category has its own sub-directory:

* eeprom
* eeprom\
Perl scripts for decoding different types of EEPROMs (SPD, EDID...) These
scripts rely on the "eeprom" kernel driver. They are installed by default.

* eeprog, eepromer
* eeprog, eepromer\
Tools for writing to EEPROMs. These tools rely on the "i2c-dev" kernel
driver. They are not installed by default.

* include
* include\
C/C++ header files for I2C and SMBus access over i2c-dev. Installed by
default.

* lib
* lib\
The I2C library, used by eeprog, py-smbus and tools. Installed by
default.

* py-smbus
* py-smbus\
Python wrapper for SMBus access over i2c-dev. Not installed by default.

* stub
* stub\
A helper script to use with the i2c-stub kernel driver. Installed by
default.

* tools
* tools\
I2C device detection and register dump tools. These tools rely on the
"i2c-dev" kernel driver. They are installed by default.

Expand All @@ -58,28 +63,33 @@ exceptions.
INSTALLATION
------------

There's no configure script, so simply run "make" to build the library and
tools, and "make install" to install them. You also can use "make uninstall"
There's no configure script, so simply run `make` to build the library and
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.

Optionally, you can run "make strip" prior to "make install" if you want
Optionally, you can run `make strip` prior to `make install` if you want
smaller binaries. However, be aware that this will prevent any further
attempt to debug the library and tools.

In case of installation on Ubuntu, is useffull to use [checkinstall utility](https://help.ubuntu.com/community/CheckInstall), which installs the i2c-tools as a deb package.

If you wish to include sub-directories that are not enabled by default, then
just set them via the EXTRA make variable. For example, to build py-smbus,
do:
```
$ make EXTRA="py-smbus"
```

Do not forget to run `sudo ldconfig` after `make install` and `sudo python setup.py install`

DOCUMENTATION
-------------

The main tools have manual pages, which are installed by "make install".
The main tools have manual pages, which are installed by `make install`.
See these manual pages for command line interface details and tool specific
information.

Expand All @@ -89,9 +99,8 @@ The other tools come with simple text documentation, which isn't installed.
QUESTIONS AND BUG REPORTS
-------------------------

Please post your questions and bug reports to the linux-i2c mailing list:
linux-i2c@vger.kernel.org
with Cc to the current maintainer:
Jean Delvare <jdelvare@suse.de>
Please post your questions and bug reports to the linux-i2c mailing list: linux-i2c@vger.kernel.org\
with Cc to the current maintainer: Jakub Kakona <kaklik@mlab.cz>

For additional information about this list, see:
http://vger.kernel.org/vger-lists.html#linux-i2c
http://vger.kernel.org/vger-lists.html#linux-i2c/
2 changes: 1 addition & 1 deletion eeprog/Module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $(EEPROG_DIR)/24cXX.o: $(EEPROG_DIR)/24cXX.c $(EEPROG_DIR)/24cXX.h $(INCLUDE_DIR
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))
Expand Down
2 changes: 1 addition & 1 deletion lib/Module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ $(LIB_DIR)/busses.ao: $(LIB_DIR)/busses.c $(INCLUDE_DIR)/i2c/busses.h
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))
Expand Down
2 changes: 1 addition & 1 deletion py-smbus/Module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ clean-python:
rm -rf py-smbus/build

install-python:
$(DISTUTILS) install
$(DISTUTILS) install --root=$(DESTDIR) --prefix=$(prefix)

all: all-python

Expand Down
20 changes: 12 additions & 8 deletions py-smbus/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
from distutils.core import setup, Extension

setup( name="smbus",
version="1.1",
version="1.2",
description="Python bindings for Linux SMBus access through i2c-dev",
author="Mark M. Hoffman",
author_email="mhoffman@lightlink.com",
maintainer="Mark M. Hoffman",
maintainer_email="linux-i2c@vger.kernel.org",
license="GPLv2",
url="http://lm-sensors.org/",
ext_modules=[Extension(
"smbus",
["smbusmodule.c"],
extra_compile_args=['-I../include'],
extra_link_args=['-L../lib', '-li2c']
)]
)
ext_modules=[
Extension(
name="smbus",
sources=["smbusmodule.c"],
library_dirs=["../lib"],
libraries=["i2c"],
extra_compile_args=['-I../include'],
extra_link_args=['-L../lib', '-li2c']
)
]
)
Loading