Example #1
0
char *pusb_volume_get(t_pusb_options *opts, DBusConnection *dbus)
{
	char	*volume_udi;
	char	*mount_point;

	if (!(volume_udi = pusb_volume_probe(opts, dbus)))
		return (NULL);
	log_debug("Found volume %s\n", opts->device.volume_uuid);
	mount_point = pusb_volume_mount_path(opts, volume_udi, dbus);
	if (mount_point)
	{
		log_debug("Volume is already mounted.\n");
		return (mount_point);
	}
	if (!pusb_volume_mount(opts, volume_udi, dbus))
	{
		xfree(volume_udi);
		return (NULL);
	}
	mount_point = pusb_volume_mount_path(opts, volume_udi, dbus);
	if (!mount_point)
	{
		log_error("Unable to retrieve %s mount point\n", volume_udi);
		pusb_volume_destroy(mount_point);
		return (NULL);
	}
	return (mount_point);
}
Example #2
0
int pusb_pad_check(t_pusb_options *opts, DBusConnection *dbus,
		const char *user)
{
	char			*volume = NULL;
	int				retval = 0;

	volume = pusb_volume_get(opts, dbus);
	if (!volume)
		return (0);
	retval = pusb_pad_compare(opts, volume, user);
	if (retval)
		pusb_pad_update(opts, volume, user);
	else
		log_error("Pad checking failed !\n");
	pusb_volume_destroy(volume);
	return (retval);
}