Hi,
First things first, my quick test last friday didn't work! Besides it
would have been to easy if it worked just like this.
To investigate it a little further, I also did a test with a pcf8574
driving some led's. (Sometimes you are just lucky to have something like
that available). I used the following piece of C code to test it.
char buf[1];
buf[0] = 4;
file = open("\sys\bus\i2c\devices\0-0020\write",O_WRONLY);
write(file,buf,1)
At power up the leds outputs are clearly in an undefined state (some on,
some off) After running the above code all led's go off. So there is
activity, but not the desired. (note the strange code of 4 to turn on a
led. There are 19 led's connected so it is encoded.)
There is a different way to access a device, and it goes like this
through the command line:
$ echo 4 > \sys\bus\i2c\devices\0-0020\write
This correctly turns on the desired led.
Is there anyone who has an idea of the difference between the C code and
the command line?
Paul
|