示例#1
0
/**
 * fu_provider_udev_client_remove:
 **/
static void
fu_provider_udev_client_remove (FuProviderUdev *provider_udev, GUdevDevice *device)
{
	FuProviderUdevPrivate *priv = GET_PRIVATE (provider_udev);
	FuDevice *dev;
	g_autofree gchar *id = NULL;

	/* interesting device? */
	if (g_udev_device_get_property (device, "FWUPD_GUID") == NULL)
		return;

	/* already in database */
	id = fu_provider_udev_get_id (device);
	dev = g_hash_table_lookup (priv->devices, id);
	if (dev == NULL)
		return;
	fu_provider_device_remove (FU_PROVIDER (provider_udev), dev);
}
示例#2
0
static void
fu_provider_chug_device_removed_cb (GUsbContext *ctx,
				    GUsbDevice *device,
				    FuProviderChug *provider_chug)
{
	FuProviderChugPrivate *priv = GET_PRIVATE (provider_chug);
	FuProviderChugItem *item;
	g_autofree gchar *device_key = NULL;

	/* already in database */
	device_key = fu_provider_chug_get_device_key (device);
	item = g_hash_table_lookup (priv->devices, device_key);
	if (item == NULL)
		return;

	/* no more polling for open */
	if (item->timeout_open_id != 0) {
		g_source_remove (item->timeout_open_id);
		item->timeout_open_id = 0;
	}
	fu_provider_device_remove (FU_PROVIDER (provider_chug), item->device);
}