const char *id_text)
{
gboolean matches;
- gboolean skip_vendor, accept_trail;
+ gboolean opt_version, skip_vendor, accept_trail;
const char *want;
if (!model)
* then expect to see this very text in literal form. This
* lets the driver map weird and untypical responses to a
* specific set of display texts for vendor and model names.
+ * Accept an optionally trailing version if models[] says so.
*/
if (model->id && model->id[0]) {
- matches = g_strcmp0(model->id, id_text) == 0;
- if (matches)
+ opt_version = model->quirks & KORAD_QUIRK_ID_OPT_VERSION;
+ if (!opt_version) {
+ matches = g_strcmp0(id_text, model->id) == 0;
+ if (!matches)
+ return FALSE;
sr_dbg("Matches expected ID text: '%s'.", model->id);
- return matches;
+ return TRUE;
+ }
+ matches = g_str_has_prefix(id_text, model->id);
+ if (!matches)
+ return FALSE;
+ id_text += strlen(model->id);
+ while (isspace((int)*id_text))
+ id_text++;
+ if (*id_text == 'V') {
+ id_text++;
+ while (*id_text == '.' || isdigit((int)*id_text))
+ id_text++;
+ while (isspace((int)*id_text))
+ id_text++;
+ }
+ if (*id_text)
+ return FALSE;
+ sr_dbg("Matches expected ID text [vers]: '%s'.", model->id);
+ return TRUE;
}
/*
KORAD_QUIRK_LABPS_OVP_EN = 1UL << 0,
KORAD_QUIRK_ID_NO_VENDOR = 1UL << 1,
KORAD_QUIRK_ID_TRAILING = 1UL << 2,
- KORAD_QUIRK_ALL = (1UL << 3) - 1,
+ KORAD_QUIRK_ID_OPT_VERSION = 1UL << 3,
+ KORAD_QUIRK_ALL = (1UL << 4) - 1,
};
/* Information on single model */