QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2226|回复: 1

如何利用udev为自己的驱动分配/dev下面的节点?

[复制链接]
发表于 2008-6-5 16:00:11 | 显示全部楼层 |阅读模式
我使用了<<linux设备驱动>>的scull.ko, #insmod scull.ko后, 会有一个"/sys/module/scull"出现,
想利用udev的自动机制来生成/dev的节点, 编辑udev的规则,放入/etc/udev/rules.d/01-scull.rules,该文件内容为:

KERNEL=="scull",       NAME="%k0", SYMLINK+="usbhd0"

但是当我insmod scull.ko时,在/dev目录下并没有生成/dev/scull0 节点,好像该机制没用,我不知道是不是哪里没有设置好,请教大家的解答!
谢谢!

用udevinfo得到的信息:
# udevinfo -a -p /sys/module/scull/

Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/module/scull':
    KERNEL=="scull"
    SUBSYSTEM=="module"
    DRIVER==""
    ATTR{initstate}=="live"
    ATTR{refcnt}=="0"
发表于 2008-6-6 18:47:47 | 显示全部楼层
udev就是烦
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-19 09:14 , Processed in 0.117881 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表