linux-kernellinux-device-driverhotplugging

How is a device node created when a piece of hardware is attached to the Computer?


I want to know how a device node is created when a hardware is connected to the system.

Information that I know:

When a piece of hardware is connected to the system, the device name is compared with the driver name, if it matches, then probe is called.

Info I wish to know:

At which point is the device node created and who is creating it? (In other words, I want to know where mknod is happening?)

This one thing is bugging my mind from so many months. Please tell me programatically where is this happening.


Solution

  • On most (but not all!) Linux systems this is handled by Udev.

    It is notified of the new hardware through a netlink socket. It then creates the device node, based on its configuration.