18 static bool run =
false;
49 if (pthread_create(&child,
NULL, *Worker, (
void *)
this) < 0)
85 AJAPnpImpl::Worker(
void* refCon)
89 struct udev_device *dev;
90 struct udev_monitor *mon;
99 mon = udev_monitor_new_from_netlink(udev,
"udev");
100 udev_monitor_filter_add_match_subsystem_devtype(mon,
"ajantv2",
NULL);
101 udev_monitor_enable_receiving(mon);
102 fd = udev_monitor_get_fd(mon);
113 tv.tv_usec = 1000000;
115 ret = select(fd+1, &fds,
NULL,
NULL, &tv);
116 if (ret > 0 && FD_ISSET(fd, &fds)) {
117 dev = udev_monitor_receive_device(mon);
123 if (strstr(udev_device_get_action(dev),
"add") !=
NULL)
128 if (strstr(udev_device_get_action(dev),
"remove") !=
NULL)
134 (*(pPnP->mCallback))(action, pPnP->mRefCon);
136 udev_device_unref(dev);