开发者

Simple Device Driver Issue : cat: /dev/chardev: No such device or address

I am trying to learn Device Drivers and tried to compile a code, but I get the below error messages. I would appreciate if you give me pointers to resolve this issue cat: /dev/chardev: No such device or address

Below are the logs: @ubuntu:~/Desktop/C_code$ lsmod

Module Size Used by chardev 12767 0

@ubuntu:~/Desktop/C_code$ ls -l /d开发者_StackOverflow中文版ev

crw-rw-rw- 1 root root 77, 0 2011-10-03 20:47 chardev

~/Desktop/C_code$ uname -r

2.6.38-8-generic

I am using the code from the following site "http://tldp.org/LDP/lkmpg/2.6/html/x569.html"


Try: cat ~/Desktop/C_code/dev/chardev. That file isn't necessarily in /dev yet, but you could copy it there.


the problem is basically that the major and minor number represented by the device node /dev/chardev don't represent a device. put in your source code a printk of the major and minor number just after the'ye assignment.

check if the numbers in the kernel log match 77 0 as the device node declare. if not, delete the device node, and write the following command

sudo mknod /dev/chardev c <MAJOR> <MINOR>

of course the major and minor are the ones you printed to the kernel log.

good luck.


http://tldp.org/LDP/lkmpg/2.6/html/x569.html, here chardev is created in current working directory.
So you should cat chardev in your current directory not in /dev/.
Or create chardev in /dev/ directory instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜