http://kerneltrap.org/mailarchive/linux-kernel-newbies/2010/9/25/6838336 on the above link there was some fight but that link is an excellent resource for you. Venkataram Tummula has debugged that driver and it will help you a lot. Read the technical thing and check this page also http://www.freesoftwaremagazine.com/articles/drivers_linux On Tue, Nov 2, 2010 at 6:40 AM, Victor Rodriguez <vm.rod25@xxxxxxxxx> wrote: > Hi all > > I have a doubt I have checked the Char Driver from Linux Device > Drivers 3rd edition and I can not understand how does the char driver > is register in the newst way, I just have done by the Linux Kernel > Module programing guide example > > http://tldp.org/LDP/lkmpg/2.6/html/x569.html > > with the function > > > int init_module(void) > { > Major = register_chrdev(0, DEVICE_NAME, &fops); > > if (Major < 0) { > printk(KERN_ALERT "Registering char device failed with %d\n", Major); > return Major; > } > > printk(KERN_INFO "I was assigned major number %d. To talk to\n", Major); > printk(KERN_INFO "the driver, create a dev file with\n"); > printk(KERN_INFO "'mknod /dev/%s c %d 0'.\n", DEVICE_NAME, Major); > printk(KERN_INFO "Try various minor numbers. Try to cat and echo to\n"); > printk(KERN_INFO "the device file.\n"); > printk(KERN_INFO "Remove the device file and module when done.\n"); > > return SUCCESS; > } > > but the new way is with alloc_chrdev_region and > > struct cdev *my_cdev = cdev_alloc( ); > my_cdev->ops = &my_fops; > > but i can not see any good and easy example on the internet > > Does anybody has seen any one ? > > One more thing > > After insert the module on the kernel I need to run > > mknod > > in order to make the node to interact with cat and echo instructions > > Is there another automatic way to do that ? I have read a litle bit > from udev, but I wonder how does the /dev char drivers are created > when linux start ? > > Thanks for all the help > > Sincerely yours > > Victor Rodriguez > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx > Please read the FAQ at http://kernelnewbies.org/FAQ > > -- http://vger.kernel.org/vger-lists.html -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ