GList *tcore_udev_exec_enumerator(TcoreUdev *udev, gboolean event_emit_flag)
{
	GList *list = NULL;
	GSList *cb = NULL;
	struct udev_enumer_callback_type *node;

	if (!udev) {
		return NULL;
	}

	list = g_udev_enumerator_execute(udev->enumer);
	if (!list) {
		return NULL;
	}

	if (event_emit_flag == FALSE)
		return list;

	for (cb = udev->enumer_callbacks; cb; cb = cb->next) {
		node = cb->data;
		if (!node) {
			continue;
		}

		if (!node->func)
			continue;

		node->func(udev, list, node->user_data);
	}

	return list;
}
gboolean
ubiquity_webcam_available (void) {
	GUdevEnumerator *enumerator;
	GUdevClient *client;
	GList *devices;
	guint length;
  	const gchar *const subsystems[] = {NULL};
  	client = g_udev_client_new (subsystems);
	enumerator = g_udev_enumerator_new (client);
	g_udev_enumerator_add_match_property (enumerator, "ID_V4L_CAPABILITIES", ":capture:");
	devices = g_udev_enumerator_execute (enumerator);
	length = g_list_length (devices);
	g_list_free_full (devices, g_object_unref);
	return length > 0;
}
Example #3
0
void
nm_atm_manager_query_devices (NMAtmManager *self)
{
    NMAtmManagerPrivate *priv = NM_ATM_MANAGER_GET_PRIVATE (self);
    GUdevEnumerator *enumerator;
    GList *devices, *iter;

    g_return_if_fail (NM_IS_ATM_MANAGER (self));

    enumerator = g_udev_enumerator_new (priv->client);
    g_udev_enumerator_add_match_subsystem (enumerator, "atm");
    g_udev_enumerator_add_match_is_initialized (enumerator);
    devices = g_udev_enumerator_execute (enumerator);
    for (iter = devices; iter; iter = g_list_next (iter)) {
        adsl_add (self, G_UDEV_DEVICE (iter->data));
        g_object_unref (G_UDEV_DEVICE (iter->data));
    }
    g_list_free (devices);
    g_object_unref (enumerator);
}