Kernel module "read()" return value
Hi,
I wrote a character device driver for an Embedded Linux build (Kernel Revision 2.6.17.1) running on ARM9. In the module's "read()" function, I'm returning the number of bytes that were copied into the user buffer. I saw some module code samples online and in most cases the "read()" function is returning the number of bytes read. The very strange behavior I saw in my case was, if I use a variable to return the value from the module's "read()" function, the user application reading from the module always saw "0". For instance: Code:
static int zlg7289_read(struct file *file, char *buf, size_t count, loff_t *ppos) Code:
. Thanks! - Shahzeb |
Does your following code print the correct value ?
Code:
// Added this for debugging |
All times are GMT -5. The time now is 01:31 PM. |