LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* How to get /dev entry created automaticly for dynamic major number?
@ 2007-01-25  7:35 Markku Savela
  2007-01-25  8:25 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Markku Savela @ 2007-01-25  7:35 UTC (permalink / raw)
  To: linux-kernel


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!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-01-25 15:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-25  7:35 How to get /dev entry created automaticly for dynamic major number? Markku Savela
2007-01-25  8:25 ` Greg KH
2007-01-25 13:11   ` Markku Savela
2007-01-25 13:17     ` Markku Savela
2007-01-25 13:37     ` Jiri Kosina
2007-01-25 15:51     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).