Skip to content

Commit

Permalink
feat: Compatible with printer driver which runs on V20 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
reddevillg authored Dec 5, 2024
1 parent 3740b1b commit ed6e8d8
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 1 deletion.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
cups (2.4.2-5deepin2) unstable; urgency=medium

* Compatible with printer driver which runs on V20.

-- reddevillg <[email protected]> Wed, 04 Dec 2024 16:06:25 +0800

cups (2.4.2-5deepin1) unstable; urgency=medium

* Fix Refactor part of server settings code.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
From: reddevillg <[email protected]>
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

2 changes: 1 addition & 1 deletion debian/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ed6e8d8

Please sign in to comment.