Reputation: 1
I have an embedded device with a linux distribution on it (created using buildroot). I need to monitor (in my program) hotplug events of some devices. I've been using eudev for some time, which provides a nice monitoring interface (libudev.h). I had to switch to mdev and I'm stuck on changing the way I monitored these events, because - based on my research - mdev is really lightweight and doesn't provide any interface for other programs.
My current monitoring function is something like this (using udev/eudev interface).
g_me.dev = udev_monitor_receive_device(g_me.mon);
if (g_me.dev != NULL)
{
// ...
const char * status = udev_device_get_action(g_me.dev);
// ...
udev_device_unref(g_me.dev);
}
It's a thread responsible only for monitoring. It's not polling, because udev_monitor_receive_device() is a blocking function - something what I want to achieve using mdev. But is it even possibe? Do you have any ideas how to avoid polling (the status of an interface) with mdev?
Upvotes: 0
Views: 71