eSCL: support both forms, scan:SupportedIntent and scan:Intent in capabilities

Some printers use the "scan:SupportedIntent" name for intents in the
ScannerCapabilities, while other use the "scan:Intent" name:

  <scan:SupportedIntents>
    <scan:Intent>Document</scan:Intent>
    <scan:Intent>Photo</scan:Intent>
    <scan:Intent>Preview</scan:Intent>
    <scan:Intent>TextAndGraphic</scan:Intent>
  </scan:SupportedIntents>

For example, Kyocera ECOSYS, use the first form, while some others,
like HP LaserJet M426fdn or Pantum BM5100ADW, use the second form.

The Mopria eSCL specification doesn't cleanly state which form is
correct.

So for compatibility with both variants used by firmwares, now
both forms are accepted.
This commit is contained in:
Alexander Pevzner
2025-03-02 20:16:56 +03:00
parent c579b53e9f
commit ebd63ecdda
+2 -1
View File
@@ -351,7 +351,8 @@ escl_devcaps_source_parse_supported_intents (xml_rd *xml, devcaps_source *src)
xml_rd_enter(xml);
for (; !xml_rd_end(xml); xml_rd_next(xml)) {
if(xml_rd_node_name_match(xml, "scan:SupportedIntent")) {
if(xml_rd_node_name_match(xml, "scan:SupportedIntent") ||
xml_rd_node_name_match(xml, "scan:Intent")) {
const char *v = xml_rd_node_value(xml);
if (!strcmp(v, "Document")) {
src->scanintents |= 1 << ID_SCANINTENT_DOCUMENT;