I2C Read/Write problem

Hi,

I'm working with the i2c2 from the beagle board, and I wrote a program
for user-space, the header used is "i2c-dev.h" from lm sensors.

The hardware I use requires the following:

Write:
Start->Chip address+write->Register address(msb)->Register address
(lsb)->Data to write->Stop

Read:
Start->Chip address+write->Register address(msb)->Register address
(lsb)->Chip address+read->Data to read->Stop

I'm using ioctl with I2C_RDWR, no error is shown, but the values read
doesn't match with the ones written(0x00 is alway read). Maybe I'm
missing something that is not allowing the correct i2c bus
communication.

The i2c2 bus was previously enabled.

The program acts this way:
1. Open file descriptor for i2c2
2. Bind I2C slave address(ioctl with I2C_SLAVE)
3. Write
4. Read
5. Close

Thanks for your help,
Ernesto

This is the code i'm using:

sry, one modification was made, to the code

      m[0].buf = rbuf;//read buffer is actually
      m[1].buf = rbuf;//read buffer

Any suggestion anyone on why no errors are displayed but read/write
isn't working?

The code is fully functional, the only problem was the address from
the register