From ed6e8d86d812ccc44e62401255731a2ed59cd8af Mon Sep 17 00:00:00 2001 From: reddevillg Date: Thu, 5 Dec 2024 17:37:11 +0800 Subject: [PATCH] feat: Compatible with printer driver which runs on V20 (#4) --- debian/changelog | 6 ++ ...ith-printer-driver-which-runs-on-V20.patch | 74 +++++++++++++++++++ debian/patches/series | 2 +- 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 debian/patches/0017-Compatible-with-printer-driver-which-runs-on-V20.patch diff --git a/debian/changelog b/debian/changelog index b96ca50..6fcdccb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cups (2.4.2-5deepin2) unstable; urgency=medium + + * Compatible with printer driver which runs on V20. + + -- reddevillg Wed, 04 Dec 2024 16:06:25 +0800 + cups (2.4.2-5deepin1) unstable; urgency=medium * Fix Refactor part of server settings code. diff --git a/debian/patches/0017-Compatible-with-printer-driver-which-runs-on-V20.patch b/debian/patches/0017-Compatible-with-printer-driver-which-runs-on-V20.patch new file mode 100644 index 0000000..041f1bf --- /dev/null +++ b/debian/patches/0017-Compatible-with-printer-driver-which-runs-on-V20.patch @@ -0,0 +1,74 @@ +From: reddevillg +Date: Wed, 4 Dec 2024 15:28:30 +0800 +Subject: [PATCH] Compatible with printer driver which runs on V20 + +If deepin-compatible-ctl exist, use it to run external process. +--- + scheduler/process.c | 39 +++++++++++++++++++++++++++------------ + 1 file changed, 27 insertions(+), 12 deletions(-) + +diff --git a/scheduler/process.c b/scheduler/process.c +index 1492e76..7c15db5 100644 +--- a/scheduler/process.c ++++ b/scheduler/process.c +@@ -555,30 +555,45 @@ cupsdStartProcess( + if (profile) + #endif /* !USE_POSIX_SPAWN */ + { ++ struct stat fileinfo; ++ int idx = 0; ++ + snprintf(cups_exec, sizeof(cups_exec), "%s/daemon/cups-exec", ServerBin); + snprintf(user_str, sizeof(user_str), "%d", user); + snprintf(group_str, sizeof(group_str), "%d", Group); + snprintf(nice_str, sizeof(nice_str), "%d", FilterNice); + +- real_argv[0] = cups_exec; +- real_argv[1] = (char *)"-g"; +- real_argv[2] = group_str; +- real_argv[3] = (char *)"-n"; +- real_argv[4] = nice_str; +- real_argv[5] = (char *)"-u"; +- real_argv[6] = user_str; +- real_argv[7] = profile ? profile : "none"; +- real_argv[8] = (char *)command; ++ if (!stat("/usr/bin/deepin-compatible-ctl", &fileinfo)) ++ { ++ real_argv[0] = (char *)"deepin-compatible-ctl"; ++ real_argv[1] = (char *)"app"; ++ real_argv[2] = (char *)"--ldrd"; ++ real_argv[3] = (char *)"run"; ++ real_argv[4] = (char *)"--"; ++ idx = 5; ++ exec_path = "/usr/bin/deepin-compatible-ctl"; ++ } else { ++ exec_path = cups_exec; ++ } ++ ++ real_argv[idx + 0] = cups_exec; ++ real_argv[idx + 1] = (char *)"-g"; ++ real_argv[idx + 2] = group_str; ++ real_argv[idx + 3] = (char *)"-n"; ++ real_argv[idx + 4] = nice_str; ++ real_argv[idx + 5] = (char *)"-u"; ++ real_argv[idx + 6] = user_str; ++ real_argv[idx + 7] = profile ? profile : "none"; ++ real_argv[idx + 8] = (char *)command; + + for (i = 0; + i < (int)(sizeof(real_argv) / sizeof(real_argv[0]) - 10) && argv[i]; + i ++) +- real_argv[i + 9] = argv[i]; ++ real_argv[idx + i + 9] = argv[i]; + +- real_argv[i + 9] = NULL; ++ real_argv[idx + i + 9] = NULL; + + argv = real_argv; +- exec_path = cups_exec; + } + + if (LogLevel == CUPSD_LOG_DEBUG2) +-- +2.45.2 + diff --git a/debian/patches/series b/debian/patches/series index fd56983..a519b58 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -19,4 +19,4 @@ 0005-feat-enable-lpd-to-encode-title.patch 0006-fixed-CVE-2024-47175.patch 0007-Feat-add-audit-log-to-CUPS.patch - +0017-Compatible-with-printer-driver-which-runs-on-V20.patch