使用mdev在/dev/下创建子目录放置设备节点
2016-11-24 17:12
423 查看
最近在嵌入式Linux板子上调试USB声卡,使用mdev创建设备节点时默认直接在 /dev/目录下创建, 如
controlC0 pcmC0D0c seq sequencer2
mixer pcmC0D0p sequencer timer
但是用户空间的程序alsa-lib, alsa-utils都是去 /dev/snd/目录下找这些设备节点, 怎么能让mdev把设备节点创建在子目录下呢?
在busybox源代码的 doc/mdev.txt 文档里面找到以下说明:
You can rename/move device nodes by using the next optional field.
<device regex> <uid>:<gid> <permissions> [=path]
So if you want to place the device node into a subdirectory, make sure
the path
has a trailing /. If you want to rename
the device node, just place the name.
hda 0:3 660 =drives/
This will move "hda" into the drives/ subdirectory.
hdb 0:3 660 =cdrom
This will rename "hdb" to "cdrom".
Similarly, ">path" renames/moves the device but it also creates
a direct symlink /dev/DEVNAME to the renamed/moved
device.
所以, 我们只要在 /etc/mdev.conf配置文件里面加入几行就可以了:
controlC[0-9] 0:0 0660 =snd/
pcm.* 0:0 0660 =snd/
seq.* 0:0 0660 =snd/
mix.* 0:0 0660 =snd/
timer 0:0 0660 =snd/
这样再运行mdev, ALSA相关的设备节点就都创建在 /dev/snd/ 目录下了。
后记: 内核里面 struct class 里面的 devnode 项跟设备节点所在目录好像也有关系, 有空再研究一下。
转自:http://blog.chinaunix.net/uid-1827018-id-4098045.html
controlC0 pcmC0D0c seq sequencer2
mixer pcmC0D0p sequencer timer
但是用户空间的程序alsa-lib, alsa-utils都是去 /dev/snd/目录下找这些设备节点, 怎么能让mdev把设备节点创建在子目录下呢?
在busybox源代码的 doc/mdev.txt 文档里面找到以下说明:
You can rename/move device nodes by using the next optional field.
<device regex> <uid>:<gid> <permissions> [=path]
So if you want to place the device node into a subdirectory, make sure
the path
has a trailing /. If you want to rename
the device node, just place the name.
hda 0:3 660 =drives/
This will move "hda" into the drives/ subdirectory.
hdb 0:3 660 =cdrom
This will rename "hdb" to "cdrom".
Similarly, ">path" renames/moves the device but it also creates
a direct symlink /dev/DEVNAME to the renamed/moved
device.
所以, 我们只要在 /etc/mdev.conf配置文件里面加入几行就可以了:
controlC[0-9] 0:0 0660 =snd/
pcm.* 0:0 0660 =snd/
seq.* 0:0 0660 =snd/
mix.* 0:0 0660 =snd/
timer 0:0 0660 =snd/
这样再运行mdev, ALSA相关的设备节点就都创建在 /dev/snd/ 目录下了。
后记: 内核里面 struct class 里面的 devnode 项跟设备节点所在目录好像也有关系, 有空再研究一下。
转自:http://blog.chinaunix.net/uid-1827018-id-4098045.html
相关文章推荐
- 使用mdev在/dev/下创建子目录放置设备节点
- 使用mdev在/dev/下创建子目录放置设备节点
- 使用mdev在/dev/下创建子目录放置设备节点
- 使用mdev在/dev/下创建子目录放置设备节点
- 使用mdev在/dev/下创建子目录放置设备节点
- 使用mdev在/dev/下创建子目录放置设备节点
- mini2440 使用mdev创建设备节点问题
- 使用mdev自动创建多个major相同的设备节点
- linux中在/dev/下手动创建设备节点
- linux-mdev自动创建设备节点
- device_create device_destroy 使用==mknod及通过class_create自动创建设备节点
- Linux /dev 自动创建设备节点
- linux中在/dev/下手动创建设备节点
- Linux /dev 自动创建设备节点
- mdev/udev 自动创建设备节点
- 关于使用 class_create,device_create,class_device_create 创建设备节点
- 自动创建设备节点-mdev和udev
- 驱动中使用class_device_create()报错的原因,自动创建设备节点
- 嵌入式Linux系统中利用mdev自动创建设备文件节点
- busybox mdev使用 自动创建设备节点