Skip to contentSkip to conversation

i2c bindings in python?

lm-sensors Alexander Krause 2 participants 5 messages May 2, 2006 – May 4, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

just wanna ask if there is some kind of library for python to handle i2c-transfers (via usermode like i2cset and i2cget does).

I couldn't find any using google.

cheers Alex

Signature · 6 lines
Alexander Krause
Amtmann-K?stner-Platz 11
99091 Erfurt

Mail alexander.krause at erazor-zone.de
Tel. +49 (179) 4725826
#1 lore raw

Hi Alexander:

Quoted 2 lines · Alexander Krause

just wanna ask if there is some kind of library for python to handle i2c-transfers (via usermode like i2cset and i2cget does).

Yes, almost. This one doesn't do arbitrary I2C transfers, just the SMBus subset. However, that would be enough to implement i2cset and i2cget in python. Here is the latest revision; sorry for the lack of documentation.

http://members.dca.net/mhoffman/sensors/python/20050122/

Quoted 1 line

I couldn't find any using google.

?!?!

Search "i2c python bindings" and the first two links will lead you to it.

Regards,

Signature · 2 lines
Mark M. Hoffman
mhoffman at lightlink.com
#2 lore raw
In reply to Alexander Krause
Quoted 5 lines

Yes, almost. This one doesn't do arbitrary I2C transfers, just the SMBus subset. However, that would be enough to implement i2cset and i2cget in python. Here is the latest revision; sorry for the lack of documentation.

http://members.dca.net/mhoffman/sensors/python/20050122/

Great! Thanks a lot.

cheers Alex

Signature · 6 lines
Alexander Krause
Amtmann-K?stner-Platz 11
99091 Erfurt

Mail alexander.krause at erazor-zone.de
Tel. +49 (179) 4725826
#3 lore raw
In reply to Alexander Krause

Hi Mark,

Quoted 1 line

http://members.dca.net/mhoffman/sensors/python/20050122/

i installed it via python setup.py install (it compiled the .c with a lot of warnings) but I'm getting 'undefined symbol: i2c_smbus_access' when using the module.

I suppose its cos of the linux-2.6 headers.

Is there a easy way to get it working?

btw, i'm using python-2.4 but that shouldn't matter.

cheers Alex

Signature · 6 lines
Alexander Krause
Amtmann-K?stner-Platz 11
99091 Erfurt, Germany

Mail alexander.krause at erazor-zone.de
Tel. +49 (179) 4725826
#4 lore raw
In reply to Alexander Krause

Hi Alexander:

Quoted 10 lines · Alexander Krause
Quoted 1 line

http://members.dca.net/mhoffman/sensors/python/20050122/

i installed it via python setup.py install (it compiled the .c with a lot of warnings) but I'm getting 'undefined symbol: i2c_smbus_access' when using the module.

I suppose its cos of the linux-2.6 headers.

Is there a easy way to get it working?

btw, i'm using python-2.4 but that shouldn't matter.

Yes, yes, and yes.

Get the lm_sensors2 package and do 'make user' and (as root) 'make user_install'. That will put the proper header file (for access to i2c-dev devices) in place.

Regards,

Signature · 2 lines
Mark M. Hoffman
mhoffman at lightlink.com