Got i2c working ? Can you answer this ?

From: Mike (no_spam_at_nospam.org)
Date: 06/29/04

  • Next message: cc0297084: "Job - Embedded Linux Developer - San Francisco Area"
    Date: Tue, 29 Jun 2004 18:33:44 +0000
    
    

        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
    http://codesink.org/eeprog.html 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


  • Next message: cc0297084: "Job - Embedded Linux Developer - San Francisco Area"

    Relevant Pages