1.

How Can We Allocate Device Number Statically ?

Answer»

register_chrdev_region() FUNCTION will statically allocate DEVICE numbers. which is declared in <linux/fs.h>

INT register_chrdev_region(dev_t first, unsigned int count, char *name);

Return values : In case of success "0" will return , In case of failure "-1 or negative value " will return 

Here

  1. first is the beginning device number of the range you would like to allocate. The minor number PORTION of first is often 0.
  2. count is the total number of contiguous device numbers you are requesting.
  3. name is the name of the device that should be associated with this number range. it will appear in /proc/devices and sysfs.

register_chrdev_region() function will statically allocate device numbers. which is declared in <linux/fs.h>

int register_chrdev_region(dev_t first, unsigned int count, char *name);

Return values : In case of success "0" will return , In case of failure "-1 or negative value " will return 

Here



Discussion

No Comment Found