Modern Character Devices (Slideshow)¶
Character Devices: Problems¶
Manually creating device nodes is cumbersome
Number conflicts are much more likely than name conflicts
Want names, not numbers
Linux way: devtmpfs
File system that contains device nodes
Automatically populated by the kernel
… with a little driver support
$ mount
...
devtmpfs on /dev type devtmpfs (rw,relatime,...)
...
Dynamic Device Numbers¶
jjj
From
register_chrdev_region()
toalloc_chrdev_region()
blah
https://www.kernel.org/doc/htmldocs/kernel-api/API-alloc-chrdev-region.html
int alloc_chrdev_region(
dev_t * dev,
unsigned baseminor,
unsigned count,
const char * name);
Device Classes¶
Devices¶
device_create()
: register character devices with sysfsreturn value? ⟶
BUG_ON()
Module loading:
ERROR: Unknown symbol in module
Only exported to modules with GPL compatible license ⟶
MODULE_LICENSE("GPL");