i2c write bot working with /dev/i2c-1 in beaglebone black

I am using beaglebone black i2c2 pin 19 and 20 of p9. Somewhere in the bet it was told i2c2 has told accessed with i2c-1 in /dev folder. I am booting default amstrom linux from emmc. Hardware is completely checked and verified. I have connected 3 io expansion modules to i2c bus. I can communicate to them by i2ctest commands from command line. But the problem is with the file writes. I cant write to /dev/i2c-1 file with "write" function. The file descriptor doeant have an error. Also the ioctl calls doest make any errors. But the write function is having problem. And thus I cant access i2c bus in application layer.

The /dev/i2c-* may not correspond to the processor's definition e.g. the
BBB's i2c2 may be mapped to /dev/i2c-1.

I wrote a blog post about this which goes into the details and shows
example C code. This may help: http://datko.net/2013/11/03/bbb_i2c/

The example there is a read, but I've used a similar setup for writes
without issue.

Josh