Hi,
I am developing a driver which reads some data from the serial port in the
raw mode. For doing the same i do a call to which fails. The call to
our_ioctl for get serial data fails with return value -14 which is EBADADDR.

The same read works if we send a direct read request from an application to
our driver. However when we call the same thing from within the driver
module, it fails .
Please suggest  a way for this.


The code is something like this 

FILE * fp;
init_module()
{
fp = filp_open ("/dev/ttyS0", O_RDWR);
}


int  our_read(struct file *filp, char *buf, size_t size, loff_t *off)  
{ 
        if (fp)
        {
            if (fp->f_op && fp->f_op->read)
                retval =  fp->f_op->read(filep,buf,size,&filep->f_pos); 
        }
}


int  our_ioctl(struct inode *in, struct file *f, unsigned int cmd,
                 unsigned long arg)  
{
        switch (cmd)
        {
                case GET_SERIAL_DATA : return our_read(NULL, (char * ) arg,
MAX_READ, NULL);
                break;
        }
}


TIA
Harivansh S. Mehta
DCM Technologies Ltd.
India
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to