Miscellaneous Device drivers in Linux

In Linux, each device is referenced by a major number and a minor number. The list of these numbers can be found by executing the command “ls -l /dev“. A small snippet is shown below

Snippet of device drivers with major number and minor numbers

Each driver that loads itself to the linux kernel must register its major number with the linux kernel. The specific driver for a specific major number is responsible for handling all the devices under that major number and minor number combination.

Since, each device driver needs to register a major number with the kernel, and the kernel needs to maintain that major number mapping between device and device driver. It would be a wastage of resources to allocate a different major number to all device drivers.

Many developers intended to write small device drivers to control small utilities such as mouse etc and also support small custom hacks for certain devices. To support these multitude of miscellaneous device drivers, the kernel development community decided to assign a single major number – 10 to all such small miscellaneous device drivers. The minor number would refer the different device drivers for different devices.

In the next article, we will look at a a miscellaneous device driver example.

Miscellaneous device driver example

Comments

  1. Pingback: Character Device driver – creating device file instance in code | Hitch Hiker's Guide to Learning

  2. Pingback: Miscellaneous device driver example | Hitch Hiker's Guide to Learning

Leave a Reply

Your email address will not be published. Required fields are marked *