Skip to content

Piero Bosio Social Web Site Personale Logo Fediverso

Social Forum federato con il resto del mondo. Non contano le istanze, contano le persone

Linux Hotplug Events Explained

Uncategorized
1 1 5
  • Linux Hotplug Events Explained

    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.


    hackaday.com/2026/03/06/linux-…


Gli ultimi otto messaggi ricevuti dalla Federazione
Post suggeriti
  • 0 Votes
    1 Posts
    0 Views
    Quindi: Prima, "possiamo distruggere il terminal petrolifero di Kharg quando vogliamo".Poi, "Lasciamo uscire le petroliere iraniane dallo Stretto di Hormuz, vogliamo che il mondo sia ben rifornito". Minus habentes ne abbiamo? U.S. is allowing Iranian oil tankers through Strait of Hormuz, says Bessent https://cnb.cx/4dn9XUn
  • 0 Votes
    1 Posts
    2 Views
    Meloni is trying to use oil price shock to dismantle EU climate policyhttps://davekeating.substack.com/p/meloni-is-trying-to-use-oil-price> EU countries with higher renewables and nuclear have been less impacted by the Iran War. So you might think Europe's right would back off its quest to dismantle EU climate policy. Think again.
  • 0 Votes
    1 Posts
    1 Views
    UE, Kubilius: “Difesa comune è un obbligo scritto nei Trattati. Se non ora, quando?”@newshttps://www.eunews.it/2026/03/16/ue-kubilius-difesa-comune-e-un-obbligo-scritto-nei-trattati-se-non-ora-quando/Il commissario europeo per la Difesa e lo Spazio, intervenuto ad un evento organizzato da Forum Europa, avverte: "Abbiamo bisogno di una produzione indipendente di missili in Europa"
  • Who used LiveJournal?

    Uncategorized writing community inkwell
    3
    0 Votes
    3 Posts
    7 Views
    @evan thanks so much! I tried to replace the generic document symbol with a better card, but it still needs some tweaks. I also got no notification about your comment. And replies are out of order, which I'm trying to figure out if that's how it needs to work or if it can be improved. There's some work to do, but I appreciate the support!