主题 : 为什么打不开设备文件? 复制链接 | 浏览器收藏 | 打印
级别: 侠客
UID: 25552
精华: 0
发帖: 64
金钱: 320 两
威望: 64 点
综合积分: 128 分
注册时间: 2010-07-26
最后登录: 2011-01-04
楼主  发表于: 2010-08-12 18:23

 为什么打不开设备文件?

用混杂设备变的驱动,设备结构体的赋值为:
#define LED_MINOR 256
#define DeviceName "myleds"
static struct miscdevice misc={
    .minor = LED_MINOR,
    .name = DeviceName,
    .fops = dev_fops
};
把驱动程序编译成内核模块,加载到开发板上,便手动的创建了设备文件
crw-rw----    1 root     root      10, 256 Jul  7 16:36 /dev/myleds
为什么应用程序打开该设备文件的时候,打不开啊。用cat指令也打不开
cat: can't open '/dev/myleds': No such device or address
新手,遇到这些问题一点办法都没,希望各位高手解答!!!
[ 此帖被0o龙i魂o0在2010-08-12 19:46重新编辑 ]
级别: 侠客
UID: 25552
精华: 0
发帖: 64
金钱: 320 两
威望: 64 点
综合积分: 128 分
注册时间: 2010-07-26
最后登录: 2011-01-04
1楼  发表于: 2010-08-12 21:57
麻烦各位了!!
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
2楼  发表于: 2010-08-12 22:32
如果你想别人帮你试,起码把源代码贴出来
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."