HI
1.How do i allocate major mumber and minor numbers in linux 2.6.8 version.
Any idea.
2. Can we allocate Major numbers and minor numbers Dynamically?
Printable View
HI
1.How do i allocate major mumber and minor numbers in linux 2.6.8 version.
Any idea.
2. Can we allocate Major numbers and minor numbers Dynamically?
If you're up to the stage of being able to write Linux device drivers, would you be
a) asking such questions.
b) be incapable of reading the relevant HOWTO to find out.
HI
Quote: Salem
Its a problem i a facing. I am facing this problem from a hour .if u can solve my problem then fine otherwise pls do not pass comments. This is a request.
Thanks,
Will this code work for alocating minor and major numbers
insertCode:
if(skull_major)
{
/* Legacy support for direct assignment */
dev = MKDEV(skull_major, skull_minor);
result = register_chrdev_region(dev, scull_nr_devs, "skull");
}
else
{
/* Dynamic allocation support */
result = alloc_chrdev_region(&dev, skull_minor, skull_nr_devs, "skull");
skull_major = MAJOR(dev));
}
/* Allocation/assignment failure notice */
(result < 0)?(printk(KERN_WARNING "skull: can't get major %d\n",
skull_major);
Here's something from an older book on the subject:
http://www.xml.com/ldd/chapter/book/ch03.html#t2
gg