18 static bool run =
false;
47 if(pthread_create(&child,
NULL, *Worker, (
void *)
this) < 0)
101 AJAPnpImpl::Worker(
void* refCon)
105 struct udev_device *dev;
106 struct udev_monitor *mon;
115 mon = udev_monitor_new_from_netlink(udev,
"udev");
116 udev_monitor_filter_add_match_subsystem_devtype(mon,
"ajantv2",
NULL);
117 udev_monitor_enable_receiving(mon);
118 fd = udev_monitor_get_fd(mon);
129 tv.tv_usec = 1000000;
131 ret = select(fd+1, &fds,
NULL,
NULL, &tv);
132 if (ret > 0 && FD_ISSET(fd, &fds)) {
133 dev = udev_monitor_receive_device(mon);
139 if (strstr(udev_device_get_action(dev),
"add") !=
NULL)
144 if (strstr(udev_device_get_action(dev),
"remove") !=
NULL)
150 (*(pPnP->mCallback))(action, pPnP->mRefCon);
152 udev_device_unref(dev);