Two obvious bugs. One severe. The other should not make a difference, but might.
  1. read() and write() need the address of the buffer, not the value...
    write(fh, &data, 1);
    read(fh, &data, 1); 
  2. Using a write() followed by a read() will generate two separate bus transactions with a STOP bit in between. The preferred style is to use ioctl(file, I2C_RDWR, struct i2c_rdwr_ioctl_data *msgset)
    with the first message in the set being the write and the second the read. This will eliminate the STOP bit and perform a restart instead.
Bob F.

I am trying to read data from
ADS7830  in my overo using i2c. I used a level-translator  in between.
According to datasheet, address byte is 1 0 0 1 0 a1 a2 r/w  should be
followed by command byte (channel and mode selection).
I have a problem that there is no communication between gumstix and the
device. I dont know where is the mistake is.

My code is

#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/i2c-dev.h> /* for I2C_SLAVE */ 
#include <errno.h>

int main(void) { 

int fh; 
uint8_t data = 0x84; 

fh = open("/dev/i2c-3", O_RDWR); 
if (fh < 0) { 
              return 1; 

// tell the driver we want the device at address 0b1001000 
ioctl(fh, I2C_SLAVE, 0x48); 

// write 0x84 ( 1000 0100 - command byte to read from channel one) 
write(fh, data, 1); 

// read output from device
read(fh, data, 1); 
printf("%x", data); 

return 0; 

output is always 84, even if I don't connect my device to gumstix. I am able
to see some fluctuation in SDA and SCL lines when I run the program.