Hello there,
I have been trying to list my device under /dev for but did not find any luck. I have written a small kernel loadable module ( LED_driver.ko)
After doing insmod i am able to find the module entry in sysfs.
root:/> version
kernel: Linux release 3.1.0-ADI-2012R1-pre, build #28 Wed Nov 30 18:44:08 IST 2011
toolchain: bfin-uclinux-gcc release gcc version 4.3.5 (ADI-2010R1-RC4) user-dist:
release 2010R1, build #1 Fri Nov 25 15:30:22 IST 2011
Loading the module
------------------
root:/> insmod /home/LED_driver.ko
LED driver is added with major number = 254
sysfs
------
root:/> ls /sys/module/LED_driver/
holders initstate refcnt sections uevent
procfs
root:/> cat /proc/devices
Character devices:
1 mem
4 /dev/vc/0
4 tty
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
13 input
89 i2c
90 mtd
128 ptm
136 pts
204 ttyBF
254 LED_driver
Block devices: 1 ramdisk 259 blkext 31 mtdblock 43 nbd
root:/> ls /dev/ bfin-dma nbd8 tty21 tty5 bfin-otp nbd9 tty22 tty50 console network_latency tty23 tty51 cpu_dma_latency network_throughput tty24 tty52 full null tty25 tty53 i2c-0 ptmx tty26 tty54 kmsg pts tty27 tty55 mem ram0 tty28 tty56 mtd0 ram1 tty29 tty57 mtd0ro ram2 tty3 tty58 mtd1 ram3 tty30 tty59 mtd1ro ram4 tty31 tty6 mtd2 ram5 tty32 tty60 mtd2ro ram6 tty33 tty61 mtdblock0 ram7 tty34 tty62 mtdblock1 random tty35 tty63 mtdblock2 tty tty36 tty7
I have followed the below links
http://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:dev-management
http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:hotplug
http://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:mdev
root:/> echo /sbin/mdev > /proc/sys/kernel/hotplug root:/> mdev -s
Still not able see the device node under /dev
Any pointers?
Thanks in advance
Krish
Please post your source code to register the driver and probe the device.
You forgot to create proper class and attribute entry in sysfs. mdev depends on sysfs entries to create device nodes at runtime.
Hi Sonic,
Thanks for the heads up. See the source code attached.
+ Krish
I am a bit confused in adding class entry in a character driver. I have referred the below uart driver but did not find any help.
drivers/tty/serial/bfin_uart.c
Can you provide some example or links to this matter.
thanks
refer to the class_create in tty_io.c or bfin_sport.c