There was a time when Linux was much simpler. You’d load a driver, it would find your device at boot up, or it wouldn’t. That was it. Now, though, people plug and unplug USB devices all the time and expect the system to react appropriately. [Arcanenibble] explains all “the gory details” about what really happens when you plug or unplug a device.
You might think, “Oh, libusb handles that.” But, of course, it doesn’t do the actual work. In fact, there are two possible backends: netlink or udev. However, the libusb developers strongly recommend udev. Turns out, udev also depends on netlink underneath, so if you use udev, you are sort of using netlink anyway.
If netlink sounds familiar, it is a generic BSD-socket-like API the kernel can use to send notifications to userspace. The post shows example code for listening to kernel event messages via netlink, just like udev does.
When udev sees a device add message from netlink, it resends a related udev message using… netlink! Turns out, netlink can send messages between two userspace programs, not just between the kernel and userspace. That means that the code to read udev events isn’t much different from the netlink example.
The next hoop is the udev event format. It uses a version number, but it seems stable at version 0xfeedcafe. Part of the structure contains a hash code that allows a bloom filter to quickly weed out uninteresting events, at least most of the time.
The post documents much of the obscure inner workings of USB hotplug events. However, there are some security nuances that aren’t clear. If you can explain them, we bet [Arcanenibble] would like to hear from you.
If you like digging into the Linux kernel and its friends, you might want to try creating kernel modules. If you get overwhelmed trying to read the kernel source, maybe go back a few versions.

A shitty RTL8832U based wifi dongle somehow doesn’t let my linux mint machine boot properly. It gets stuck at the linux mint logo splash screen for like 10+ minutes. Or until i disconnect the dongle
Year of Linux 2026.
Surely this time it will work, just like with communism.
Right… because Windows has never had hardware specific bugs. /s
Sure it has, but linuxians always made fun of it. It’s your turn. It turns out supporting every hardware and software under the sun comes with a few corner cases…. Who could have guessed!
yeah, year of linux is a dumb slogan. it’s already used in mass-produced ‘just works’ operating systems, and in that role it’s far more reliable than windows. linux is a big part of why microsoft failed to deliver a phone OS despite nailing down the major design parameters 7 years before anyone else.
but what i like about it — which is barely related to mass uptake — is that i can get to the bottom of every problem. which doesn’t seem to be much comfort to shinsukke but is everything to me
But I don’t want to go to the bottom of every problem. I just want things to work. That’s it.
I’ve been using windows since 3.1
Most things have never “just worked”.
I just had to buy a 3rd party driver to get my sony headphones to work properly on windows 11 professional. Not because of a butchered driver from sony, not because I was using cheap headphones {wh-1000xm6) but because windows just really, really sucks at optimizing bluetooth signals for specific devices and doesn’t give the user the option to adjust them beyond what it thinks is appropriate.
Remember we used to shake the mouse to see if the computer was still working in ’95.
We’re still shaking the mouse over 30 years later.
The driver is loading too early. You should try reduce its priority maybe with a higher number in init.d scripts
I run VMs on Manjaro and its good to understand this stuff. I also use VR and have a cheap logitech wheel for gaming and you run in to udev stuff all the time with those to devices. some VR sets are easy to pass through, but older rifts for example need to have there own dedicated rules. The VR head set I use a whole USB card passthrough to get it to work right in a windows VM, but the wheel is more fun in the linux VM just for the games I like and that I have to give it a normal USB conection and play with the udev stuff, luckly there is suport if you search for it for allot of common devices.