As far as I know, the kernel detects hardware, adds information to sysfs creates a device in /dev and then generates a udev event. My question is, do device drivers do all of this or it is the kernel itself? If drivers do it, then they would know the device major and minor number to create the file in devtmps.
I also understand (maybe wrongly) that it is udev who calls modprobe to load the drivers that handle a device.
I was told that they do so with the contents of the MODALIAS uevent environment variable, thus loading all modules whose aliases match this string (the correct driver). In short: what are the steps of hardware detection in linux and WHO performs each step: the kernel itself, the driver inside the kernel or udev in userspace. Thanks.