X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Finput%2Fchronovu_la8.c;h=6607f3a7e11fba56452223edfebf565bfc7bbce0;hb=54ee427df0d923c8e17f3dc8ee57552b6c5fd57b;hp=07d94a719de1aec68add953c832801c110b9f305;hpb=7102443a4adb1743c5a053deee8fd2a93670fc19;p=libsigrok.git diff --git a/src/input/chronovu_la8.c b/src/input/chronovu_la8.c index 07d94a71..6607f3a7 100644 --- a/src/input/chronovu_la8.c +++ b/src/input/chronovu_la8.c @@ -37,16 +37,23 @@ struct context { uint64_t samplerate; }; -static int format_match(GHashTable *metadata) +static int format_match(GHashTable *metadata, unsigned int *confidence) { int size; + /* + * In the absence of a reliable condition like magic strings, + * we can only guess based on the file size. Since this is + * rather weak a condition, signal "little confidence" and + * optionally give precedence to better matches. + */ size = GPOINTER_TO_INT(g_hash_table_lookup(metadata, GINT_TO_POINTER(SR_INPUT_META_FILESIZE))); - if (size == CHRONOVU_LA8_FILESIZE) - return SR_OK; + if (size != CHRONOVU_LA8_FILESIZE) + return SR_ERR; + *confidence = 100; - return SR_ERR; + return SR_OK; } static int init(struct sr_input *in, GHashTable *options)