I use an Edimax EW-7811UTC Wi-Fi USB Adapter. I have installed in my Linux distribution the necessary rtl8812au driver.
At boot, if the Wifi-USB adapter is not plugged in, the module 88XXau.ko in not loaded. When I plug in the Wifi-USB adapter the kernel and udev automatically load the module, but I don't find the specific udev rule which executes this loading.
Someone can help me to better know this automatism?
Thanks
CodePudding user response:
https://www.linuxfromscratch.org/lfs/view/development/chapter09/udev.html
Device drivers compiled as modules may have aliases built into them. Aliases are visible in the output of the modinfo program and are usually related to the bus-specific identifiers of devices supported by a module. For example, the snd-fm801 driver supports PCI devices with vendor ID 0x1319 and device ID 0x0801, and has an alias of “pci:v00001319d00000801svsdbc04sc01i*”. For most devices, the bus driver exports the alias of the driver that would handle the device via sysfs. E.g., the /sys/bus/pci/devices/0000:00:0d.0/modalias file might contain the string “pci:v00001319d00000801sv00001319sd00001319bc04sc01i00”. The default rules provided with udev will cause udevd to call out to /sbin/modprobe with the contents of the MODALIAS uevent environment variable (which should be the same as the contents of the modalias file in sysfs), thus loading all modules whose aliases match this string after wildcard expansion.
https://wiki.archlinux.org/title/Modalias
$ cd /usr/lib/udev/rules.d
$ grep -r MODALIAS .
80-drivers.rules
5:ENV{MODALIAS}=="?*", RUN{builtin} ="kmod load '$env{MODALIAS}'"