Using libudev in Linux I am able to add a handle to an event manger to detect on boot and upon plugging in a USB serial device by monitoring tty events.
self->udev_monitor = udev_monitor_new_from_netlink(self->udev, "udev");
udev_monitor_filter_add_match_subsystem_devtype(self->udev_monitor, "tty", NULL);
udev_monitor_enable_receiving(self->udev_monitor);
self->event_manager->addFD(
self->event_manager
,_udevDeviceAnnounce
,udev_monitor_get_fd(self->udev_monitor)
,self
);
_findUdevDevices(self);
How can I achieve the same thing on Windows and macOS? I am trying to make a single service written in C compiled for each Windows, Mac and Linux.