dc-download: fingerprint details are debug info

In the normal use of the app this information is simply too verbose.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2021-10-27 17:31:48 -07:00
parent 10e6519ad5
commit 44691dae10

View file

@ -840,6 +840,7 @@ static void do_save_fingerprint(device_data_t *devdata, const char *tmp, const c
if (fd < 0)
return;
if (verbose)
dev_info(devdata, "Saving fingerprint for %08x:%08x to '%s'",
devdata->fdeviceid, devdata->fdiveid, final);
@ -855,11 +856,9 @@ static void do_save_fingerprint(device_data_t *devdata, const char *tmp, const c
written = -1;
if (written == devdata->fsize) {
if (!subsurface_rename(tmp, final)) {
dev_info(devdata, " ... %d bytes and dive ID", written);
if (!subsurface_rename(tmp, final))
return;
}
}
unlink(tmp);
}
@ -965,13 +964,16 @@ static void verify_fingerprint(dc_device_t *device, device_data_t *devdata, cons
memcpy(&deviceid, buffer + size, 4);
memcpy(&diveid, buffer + size + 4, 4);
if (verbose)
dev_info(devdata, " ... fingerprinted dive %08x:%08x", deviceid, diveid);
/* Only use it if we *have* that dive! */
if (!has_dive(deviceid, diveid)) {
if (verbose)
dev_info(devdata, " ... dive not found");
return;
}
dc_device_set_fingerprint(device, buffer, size);
if (verbose)
dev_info(devdata, " ... fingerprint of size %zu", size);
}
@ -989,8 +991,10 @@ static void lookup_fingerprint(dc_device_t *device, device_data_t *devdata)
return;
cachename = fingerprint_file(devdata);
if (verbose)
dev_info(devdata, "Looking for fingerprint in '%s'", cachename);
if (readfile(cachename, &mem) > 0) {
if (verbose)
dev_info(devdata, " ... got %zu bytes", mem.size);
verify_fingerprint(device, devdata, mem.buffer, mem.size);
free(mem.buffer);