On Sun, Sep 26, 2010 at 12:17 AM, Bond <jamesbond.2...@gmail.com> wrote:
> > > On Sun, Sep 26, 2010 at 12:30 PM, Venkatram Tummala < > venkatram...@gmail.com> wrote: > >> >> Do a cat /proc/devices|grep <DEVICENAME>. This will get you the number. >> > I am getting two numbers here > b...@bond:~/programming/venkatrama$ cat /proc/devices | grep bond > 60 bond > 250 bond > which one should I use. > One of them is a left over from your previous mknod. Reboot the system. Then, do a mknod. You will only see one. > > Then do "mknod /dev/bond" c <NUMBER in /proc/devices> 0 . >> > > >> >zero in register_chrdev(..) is not the device number. It indicates a >> dynamic number. >> > http://www.fsl.cs.sunysb.edu/kernel-api/re941.html > how is major number then assigned. > How is the name of device then decided > excerpts from the above link say > "The name of this device has nothing to do with the name of the device in > /dev. It only helps to keep track of the different owners of devices. If > your module name has only one type of devices it's ok to use e.g. the name > of the module here." > > how do I make sure that if I am writing to device /dev/bond then bond > module is being used > My advise is to have printk in your module and see if your code is getting called on a read or write. > > >> in your code you have done in memory_read >> >>> *f_pos = *f_pos + count; >>> >>> why have you done this? >>> What purpose it serves? >>> >> >> It updates the file pointer. >> >> Your program has worked I used 60 in mknod out of two outputs which came > in cat /proc/device | grep bond > >