0

How to create a device file when I do not know the minor and major number (i.e. by using dynamic registration) without using mknod or MAKEDEV.

2

2 Answers 2

2

Say you want to dynamically assign a major number to a char device on insertion, use:

int alloc_chrdev_region(dev_t *dev, unsigned int firstminor, unsigned int count, char *name);

From Linux Device Drivers 3rd Edition. Google it you can get the entire book for free along with tons of great source code for messing with drivers.

Sign up to request clarification or add additional context in comments.

Comments

0

Also, the codes provided in the LDD3 are obsolete now. So, use this github repo to download example codes of LDD3: https://github.com/martinezjavier/ldd3

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.