I'm writing a kernel module. I can easily create a character device in /dev/ but I want to have 3 devices available to my user and it would be nice to put them all under a /dev/ subdirectory.
Possible example (exists on my openSUSE box):
# ls -l /dev/bsg
total 0
crw-rw---- 1 root root 252, 0 Jul 17 14:28 0:0:0:0
crw-rw---- 1 root root 252, 1 Jul 17 14:28 0:0:1:0
crw-rw---- 1 root root 252, 2 Jul 17 14:28 0:0:2:0
crw-rw---- 1 root root 252, 3 Jul 17 14:28 0:0:3:0
crw-rw---- 1 root root 252, 4 Jul 17 14:28 0:0:4:0
crw-rw---- 1 root root 252, 5 Jul 17 14:28 1:0:0:0
(I have looked at the bsg.c code but am at a loss to what "parent" the character devices are added to).
How can I do something similar?
udev
. Write custom rules to create device nodes as necessary. – dirkt Jul 18 '18 at 06:16