lkml.org 
[lkml]   [2007]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectHow to get /dev entry created automaticly for dynamic major number?

If want to write a loadable module which "implements" a char device
("virtual", no real device present). How do I get the correct
"/dev/foo" to appear automaticly? What is the current recommended
solution (kernel 2.6.17 in Ubuntu and later).

static int major;

static int __init foo_init(void)
{
...
major = register_chrdev(0, "foo", &fops);
....
}

static void __exit foo_exit(void)
{
...
if (major > 0)
unregister_chrdev(major, "foo");
...
}

I thought that the above code would be enough to trigger the "udevd",
but apparently not (if it should, what is the match rule I have to
use? DRIVER=="foo" or KERNEL="foo[0-9]*"? None of these seem to
work). Do I have to do some additional poking with sysfs? I can see
my module there, but nothing else.

The problem seems to be that most information I find from books or net
is out of date for 2.6, or carries note "these things are currently
been changed". A pointer to a definitive documentation would also do!

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-01-25 09:29    [W:0.126 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site