-2

Why does a device node need to be made in udev when you plug in a device into your computer?

Why does a device node need to exist?

2
  • Well… the question is pertinent. Yes indeed… you could easily achieve the same result… manually… right from the command line. Of course, that'd need some knowledge and there would certainly be a vast amount of so-called quiche-eaters wanting this task to be… automated… ;-) Commented Feb 27, 2024 at 20:16
  • To a first approximation, everything in Linux is a file. (a) We have this fine tree structure which gives us a hierarchic map of all the file resources on the system. (b) Let's overload it with fake entries like /proc, /run, /sys which allow us to interact with the Kernel. (c) If we can plug and unplug devices, let's dynamically create and destroy appropriate entries for them in /dev. As it happens, the boot process includes exploring all the hardware and building /dev from scratch anyway. Commented Feb 28, 2024 at 14:12

1 Answer 1

2

Why does a device node need to be made in udev

You got that backwards: it's udev that creates that device node.

And whether and which kind of device nodes are created depends on the kind of hardware you plug in: It makes a difference whether you plug in a storage block device, a GPU or a network card.

Why does a device node need to exist?

Because operations on device nodes are the way that software interacts with hardware. Your question is identical to the question of

how does a program on Linux interact with hardware?

and the answer is:

It depends, but it usually opens the device node and performs read, write or ioctl on it, or it uses the node's properties to initiate other kernel operations (like mount does with fsopen).

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.