* How to create the nodes dynamically - simple char driver
@ 2006-02-02 10:25 Srinivas G.
2006-02-02 15:59 ` Linas Vepstas
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Srinivas G. @ 2006-02-02 10:25 UTC (permalink / raw)
To: linux-hotplug
Dear All,
I have developed a simple character driver for accessing the custom PCI
board in Fedora Core 3. It is working fine. I am creating the device
nodes manually using the mknod command after inserting my module into
the kernel space. But when I restart the system the nodes are not there.
But the module is present. I have added the MODULE_DEVICE_TABLE in my
module for loading it at boot time. I have read about the
MODULE_DEVICE_TABLE in LDD3. It will add the module name to the
modules.pcimap and modules.dep file.
My question is:
Is there any way to create the nodes automatically after restarting the
system if the module exists?
I have heard about udev. I am going through the following links.
http://fedora.redhat.com/docs/udev/
http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
What can I do in my kernel driver code to create a sysfs entry?
Could you please send me any sample code OR links that explore about
creating the node s dynamically?
Thanks in advance.
Regards,
Srinivas G
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: How to create the nodes dynamically - simple char driver
2006-02-02 10:25 How to create the nodes dynamically - simple char driver Srinivas G.
@ 2006-02-02 15:59 ` Linas Vepstas
2006-02-02 16:17 ` Kay Sievers
2006-02-02 16:50 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Linas Vepstas @ 2006-02-02 15:59 UTC (permalink / raw)
To: linux-hotplug
On Thu, Feb 02, 2006 at 03:43:25PM +0530, Srinivas G. was heard to remark:
> My question is:
> Is there any way to create the nodes automatically after restarting the
> system if the module exists?
udev is erasing the files. On boot, it will copy any static device
nodes from /etc/udev (or somewhere like that) to /dev.
The "correct" thing to do would have been to write the appropriate udev
rule, but since this sounds like a prototype board, a hack like
/etc/udev might be approrate.
--linas
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x103432&bid#0486&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to create the nodes dynamically - simple char driver
2006-02-02 10:25 How to create the nodes dynamically - simple char driver Srinivas G.
2006-02-02 15:59 ` Linas Vepstas
@ 2006-02-02 16:17 ` Kay Sievers
2006-02-02 16:50 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2006-02-02 16:17 UTC (permalink / raw)
To: linux-hotplug
On Thu, Feb 02, 2006 at 09:59:35AM -0600, Linas Vepstas wrote:
> On Thu, Feb 02, 2006 at 03:43:25PM +0530, Srinivas G. was heard to remark:
> > My question is:
> > Is there any way to create the nodes automatically after restarting the
> > system if the module exists?
>
> udev is erasing the files.
/dev is on tmpfs, that does not survice a reboot.
> On boot, it will copy any static device
> nodes from /etc/udev (or somewhere like that) to /dev.
It is /lib/udev/devices/.
> The "correct" thing to do would have been to write the appropriate udev
> rule, but since this sounds like a prototype board, a hack like
> /etc/udev might be approrate.
Huh no, both is definitely not "correct". Just use the kernel driver core
functions and register your class device with the right name and udev will
create the node automatically when the device shows up.
Kay
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x103432&bid#0486&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to create the nodes dynamically - simple char driver
2006-02-02 10:25 How to create the nodes dynamically - simple char driver Srinivas G.
2006-02-02 15:59 ` Linas Vepstas
2006-02-02 16:17 ` Kay Sievers
@ 2006-02-02 16:50 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2006-02-02 16:50 UTC (permalink / raw)
To: linux-hotplug
On Thu, Feb 02, 2006 at 03:43:25PM +0530, Srinivas G. wrote:
> Dear All,
>
> I have developed a simple character driver for accessing the custom PCI
> board in Fedora Core 3. It is working fine. I am creating the device
> nodes manually using the mknod command after inserting my module into
> the kernel space. But when I restart the system the nodes are not there.
> But the module is present. I have added the MODULE_DEVICE_TABLE in my
> module for loading it at boot time. I have read about the
> MODULE_DEVICE_TABLE in LDD3. It will add the module name to the
> modules.pcimap and modules.dep file.
>
> My question is:
> Is there any way to create the nodes automatically after restarting the
> system if the module exists?
Yes, see the section in LDD3 about how udev works and what you need to
do to get your driver to work properly with it.
Hope this helps,
greg k-h
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x103432&bid#0486&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-02-02 16:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-02 10:25 How to create the nodes dynamically - simple char driver Srinivas G.
2006-02-02 15:59 ` Linas Vepstas
2006-02-02 16:17 ` Kay Sievers
2006-02-02 16:50 ` 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).