Listen for harware change events from linux or udev kernel

I need to run some code to install and unmount a storage device.
How can I listen to these events on Linux?

  • I was thinking of adding udev rules to run some script (any know-how in this matter is welcome)
  • But I would rather listen to events from the kernel in some kind of network socket with my daemon (like udev) or something like that.
+3
source share
2 answers

You can use libudev or a more convenient, smooth gudev to track udev events in C.

+4
+1

Source: https://habr.com/ru/post/1754798/


All Articles