static char *pusb_volume_probe(t_pusb_options *opts, DBusConnection *dbus) { int maxtries = 0; int i; if (!*(opts->device.volume_uuid)) { log_debug("No UUID configured for device\n"); return (NULL); } log_debug("Searching for volume with uuid %s\n", opts->device.volume_uuid); maxtries = ((opts->probe_timeout * 1000000) / 250000); for (i = 0; i < maxtries; ++i) { char *udi = NULL; if (i == 1) log_info("Probing volume (this could take a while)...\n"); udi = pusb_hal_find_item(dbus, "IdUuid", opts->device.volume_uuid, NULL); if (!udi) { usleep(250000); continue; } return (udi); } return (NULL); }
static LibHalVolume *pusb_volume_probe(t_pusb_options *opts, LibHalContext *ctx) { LibHalVolume *volume = NULL; int maxtries = 0; int i; if (!*(opts->device.volume_uuid)) { log_debug("No UUID configured for device\n"); return (NULL); } log_debug("Searching for volume with uuid %s\n", opts->device.volume_uuid); maxtries = ((opts->probe_timeout * 1000000) / 250000); for (i = 0; i < maxtries; ++i) { char *udi = NULL; if (i == 1) log_info("Probing volume (this could take a while)...\n"); udi = pusb_hal_find_item(ctx, "volume.uuid", opts->device.volume_uuid, NULL); if (!udi) { usleep(250000); continue; } volume = libhal_volume_from_udi(ctx, udi); libhal_free_string(udi); if (!libhal_volume_should_ignore(volume)) return (volume); libhal_volume_free(volume); usleep(250000); } return (NULL); }