On Tue, Jul 5, 2011 at 9:15 AM, Bond <jamesbond.2k.g@gmail.com> wrote:
This is an interview question.
I had written device driver for a char device so I know that code structure looks like this
struct file_operations something { .owner=my_device_open; .read=my_device_read; .close=my_device_close; .write=my_device_write;
} When the device driver is active then in
/dev/mydevice you can actually read and write into it. But what I was not clear is how an application will read or write to this device. I know insmod will insert the module to kernel,and register_chrdev(); will register the driver in kernel but how will application program communicate with this driver.
My answer was In unix it simply opens the device node as a file and sends/receives data and commands from it.
But he was expecting some thing more complex.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Hi, Not in touch with low level stuff for some time but do check ioctl() and sysfs on wikipedia or man pages. Take care. -- Shahbaz Khan R&D Engineer, Tactical Engineering and Consultancy. http://shazkhan.wordpress.com/ http://pk.linkedin.com/pub/shahbaz-khan/20/116/b49 http://imsciences.edu.pk/serg/ http://csrdu.org/ +92-91-332-9915828