Got i2c working ? Can you answer this ?

I'm trying to get an i2c interface going, and I'm not quite sure where my problems lie. Suffice to say, it doesn't work.

I have built an Philips style adaptor. The software modules appear to load OK, and I have this in /proc

# ls -l /proc/bus

-r--r--r-- 1 root root 0 Jun 29 18:18 i2c

-r--r--r-- 1 root root 0 Jun 29 18:18 i2c-0 dr-xr-xr-x 3 root root 0 Jun 29 18:18 isapnp # cat /proc/bus/i2c i2c-0 i2c Philips Parallel port adapter Bit-shift algorithm # cat /proc/bus/i2c-0 cat: read: Invalid argument #

What I don't understand is this problem with /proc/bus/i2c-0.

Am I right in thinking that this file should contain the addresses of all the devices on the i2c-0 bus ? and I should be able to read the file shouldn't I ?

Ignoring that problem for a moment - if I try to set the slave address with something like

if( ( r = ioctl(fd, I2C_SLAVE, addr)) < 0) { fprintf(stderr, "Error eeprom_open: %s\n", strerror(errno)); return -1; }

then it errors out. This code snippet is from 'eeprog' which is a simple program to access 24Cxx EEPROM devices available at

formatting link
so I guess should work OK. I assume it fails because it can't read the file /proc/bus/i2c-0

So the problem is either with the adaptor I have built or the way the modules have loaded.

If I disconnect my adaptor, then I still get problems typing the contents of /proc/bus/i2c-0 as above.

Can someone with i2c working please confirm that I should be able to type out the contents of /proc/bus/i2c-0 and that it contains addresses of devices on the i2c bus

Reply to
Mike
Loading thread data ...

I'll answer my own question here in case someone else comes across the problem.

Basically, it's a bug in the 2.4 kernel.

The bug is in module i2c-core.c and a patch is available. I found it by using Google and searching for "cat: read: Invalid argument"

I hope this helps someone in the future.

Mike

Mike wrote:

Reply to
Mike

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.