put_user doesn't pass the correct data
Writing a device driver for a ARM9 microcontroller: at last the driver can get the right data from the device. Verified with printk().
However passing the data to user-space with put_user() is giving problems. Basically the read function in the driver calls put_user() as follows:
unsigned char buf[BUF_SIZE];
for (i; i<BUF_SIZE; i++)
And in user-space just read from file:
fp = open("/dev/device", O_RDWR);
read(fp, buf, 1)
I don't get the correct data in user-space. Looks more like pointer to uninitialized memory.
Anyone can tell me what I am doing wrong?