]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Report proper media-source-supported IPP field on numeric InputSlots. #859 860/head
authorValdikSS <iam@valdikss.org.ru>
Tue, 9 Jan 2024 01:21:52 +0000 (04:21 +0300)
committerValdikSS <iam@valdikss.org.ru>
Tue, 9 Jan 2024 01:33:34 +0000 (04:33 +0300)
Windows 11 version 22H2 build 22621.2861 silently fails to add Mopria
auto-discovered printer if it reports a number (a digit as a string)
in media-source-supported field.
If you try to add such a printer using modern control panel, it will
show endless "connecting…" message, and if you add it using old
control panel, it would be added "successfully", but under
"unrecognized" device type, and you won't be able to print on it.

Fix the issue by
    * By comparing also by human-readable InputSlot name
    * By mapping number to "tray-N" string

cups/ppd-cache.c

index d148e907667c69b50f88effccd160f42a5d43101..18ff6dd1baaee42dedd723fb5806092df5747dbc 100644 (file)
@@ -1284,7 +1284,9 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)   /* I - PPD file */
         i --, choice ++, map ++)
     {
       if (!_cups_strncasecmp(choice->choice, "Auto", 4) ||
-          !_cups_strcasecmp(choice->choice, "Default"))
+          !_cups_strncasecmp(choice->text, "Auto", 4) ||
+          !_cups_strcasecmp(choice->choice, "Default") ||
+          !_cups_strcasecmp(choice->text, "Default"))
         pwg_name = "auto";
       else if (!_cups_strcasecmp(choice->choice, "Cassette"))
         pwg_name = "main";
@@ -1308,6 +1310,26 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)  /* I - PPD file */
         pwg_name = "side";
       else if (!_cups_strcasecmp(choice->choice, "Roll"))
         pwg_name = "main-roll";
+      else if (!_cups_strcasecmp(choice->choice, "0"))
+        pwg_name = "tray-1";
+      else if (!_cups_strcasecmp(choice->choice, "1"))
+        pwg_name = "tray-2";
+      else if (!_cups_strcasecmp(choice->choice, "2"))
+        pwg_name = "tray-3";
+      else if (!_cups_strcasecmp(choice->choice, "3"))
+        pwg_name = "tray-4";
+      else if (!_cups_strcasecmp(choice->choice, "4"))
+        pwg_name = "tray-5";
+      else if (!_cups_strcasecmp(choice->choice, "5"))
+        pwg_name = "tray-6";
+      else if (!_cups_strcasecmp(choice->choice, "6"))
+        pwg_name = "tray-7";
+      else if (!_cups_strcasecmp(choice->choice, "7"))
+        pwg_name = "tray-8";
+      else if (!_cups_strcasecmp(choice->choice, "8"))
+        pwg_name = "tray-9";
+      else if (!_cups_strcasecmp(choice->choice, "9"))
+        pwg_name = "tray-10";
       else
       {
        /*