Let's say I have a module which has this function my_open:
int my_open( struct inode *inode, struct file *filp ) {
filp->private_data = //allocate private data
if( filp->f_mode & FMODE_READ )
//handle read opening
if( filp->f_mode & FMODE_WRITE )
//handle write opening
if (MINOR( inode->i_rdev )==2){
filp->f_op = &my_fops2;
}
return 0;
}
how do I use this function from the shell/terminal?
echo "blahblah" > /dev/your_device_nodeorcat /dev/your_device_node.