|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| backend/ | | 22-Oct-2025 | - | 18,072 | 11,556 |
| berkeley/ | | 22-Oct-2025 | - | 2,006 | 1,312 |
| cgi-bin/ | | 22-Oct-2025 | - | 12,270 | 7,508 |
| conf/ | | 22-Oct-2025 | - | 695 | 519 |
| config-scripts/ | | 22-Oct-2025 | - | 2,749 | 2,417 |
| cups/ | | 22-Oct-2025 | - | 105,487 | 67,674 |
| data/ | | 22-Oct-2025 | - | 514 | 375 |
| desktop/ | | 22-Oct-2025 | - | 252 | 167 |
| doc/ | | 22-Oct-2025 | - | 37,317 | 30,983 |
| examples/ | | 22-Oct-2025 | - | 16,992 | 14,468 |
| filter/ | | 22-Oct-2025 | - | 12,286 | 7,780 |
| locale/ | | 22-Oct-2025 | - | 218,584 | 163,706 |
| man/ | | 22-Oct-2025 | - | 8,630 | 7,385 |
| monitor/ | | 22-Oct-2025 | - | 690 | 363 |
| move_files/ | | 22-Oct-2025 | - | 888 | 776 |
| notifier/ | | 22-Oct-2025 | - | 2,318 | 1,361 |
| packaging/ | | 22-Oct-2025 | - | 1,576 | 1,329 |
| ppdc/ | | 22-Oct-2025 | - | 11,863 | 8,579 |
| scheduler/ | | 22-Oct-2025 | - | 63,978 | 40,612 |
| systemv/ | | 22-Oct-2025 | - | 11,045 | 7,931 |
| templates/ | | 22-Oct-2025 | - | 8,929 | 7,287 |
| test/ | | 22-Oct-2025 | - | 3,278 | 2,544 |
| tools/ | | 22-Oct-2025 | - | 23,000 | 17,144 |
| vcnet/ | | 22-Oct-2025 | - | 11,661 | 8,029 |
| xcode/ | | 22-Oct-2025 | - | 13,597 | 13,027 |
| BUILD.gn | D | 22-Oct-2025 | 14 KiB | 566 | 514 |
| CHANGES.md | D | 22-Oct-2025 | 17.1 KiB | 358 | 312 |
| CONTRIBUTING.md | D | 22-Oct-2025 | 399 | 11 | 8 |
| CREDITS.md | D | 22-Oct-2025 | 3 KiB | 55 | 51 |
| DEVELOPING.md | D | 22-Oct-2025 | 22.5 KiB | 637 | 472 |
| INSTALL.md | D | 22-Oct-2025 | 6.3 KiB | 188 | 126 |
| LICENSE | D | 22-Oct-2025 | 11.1 KiB | 203 | 169 |
| Makedefs.in | D | 22-Oct-2025 | 6.1 KiB | 276 | 230 |
| Makefile | D | 22-Oct-2025 | 5.9 KiB | 301 | 152 |
| NOTICE | D | 22-Oct-2025 | 2.3 KiB | 53 | 39 |
| OAT.xml | D | 22-Oct-2025 | 7.4 KiB | 111 | 56 |
| README.OpenSource | D | 22-Oct-2025 | 588 | 12 | 11 |
| README.md | D | 22-Oct-2025 | 6.9 KiB | 170 | 121 |
| README_zh.md | D | 22-Oct-2025 | 3.9 KiB | 103 | 91 |
| REPORTING_ISSUES.md | D | 22-Oct-2025 | 8.1 KiB | 177 | 119 |
| SECURITY.md | D | 22-Oct-2025 | 2.2 KiB | 63 | 44 |
| backport-Also-fix-cupsfilter.patch | D | 22-Oct-2025 | 1.2 KiB | 32 | 28 |
| backport-CVE-2022-26691.patch | D | 22-Oct-2025 | 1.1 KiB | 35 | 29 |
| backport-CVE-2023-32324.patch | D | 22-Oct-2025 | 944 | 38 | 31 |
| backport-CVE-2023-34241.patch | D | 22-Oct-2025 | 2.1 KiB | 66 | 57 |
| backport-CVE-2023-4504.patch | D | 22-Oct-2025 | 1.2 KiB | 45 | 36 |
| backport-CVE-2024-35235.patch | D | 22-Oct-2025 | 2.9 KiB | 97 | 87 |
| backport-Remove-legacy-code-for-RIP_MAX_CACHE-environment-variable.patch | D | 22-Oct-2025 | 1.6 KiB | 47 | 40 |
| bundle.json | D | 22-Oct-2025 | 1.5 KiB | 53 | 53 |
| config.guess | D | 22-Oct-2025 | 48.8 KiB | 1,775 | 1,548 |
| config.h | D | 22-Oct-2025 | 3.1 KiB | 106 | 82 |
| config.h.in | D | 22-Oct-2025 | 9.4 KiB | 723 | 456 |
| config.sub | D | 22-Oct-2025 | 35 KiB | 1,908 | 1,720 |
| configure | D | 22-Oct-2025 | 319.4 KiB | 13,701 | 10,369 |
| configure.ac | D | 22-Oct-2025 | 2.9 KiB | 96 | 86 |
| cups-banners.patch | D | 22-Oct-2025 | 532 | 13 | 11 |
| cups-config.in | D | 22-Oct-2025 | 2.6 KiB | 133 | 104 |
| cups-direct-usb.patch | D | 22-Oct-2025 | 912 | 28 | 26 |
| cups-driverd-timeout.patch | D | 22-Oct-2025 | 741 | 22 | 17 |
| cups-freebind.patch | D | 22-Oct-2025 | 704 | 16 | 14 |
| cups-ipp-multifile.patch | D | 22-Oct-2025 | 700 | 16 | 13 |
| cups-multilib.patch | D | 22-Oct-2025 | 580 | 15 | 14 |
| cups-system-auth.patch | D | 22-Oct-2025 | 1.7 KiB | 39 | 37 |
| cups-uri-compat.patch | D | 22-Oct-2025 | 1.5 KiB | 52 | 46 |
| cups-usb-job-state-monitor.patch | D | 22-Oct-2025 | 3 KiB | 99 | 94 |
| cups-usb-paperout.patch | D | 22-Oct-2025 | 1.3 KiB | 53 | 48 |
| cups-web-devices-timeout.patch | D | 22-Oct-2025 | 758 | 20 | 16 |
| cups.gni | D | 22-Oct-2025 | 1.5 KiB | 41 | 34 |
| cups.pc.in | D | 22-Oct-2025 | 637 | 30 | 25 |
| cups.spec | D | 22-Oct-2025 | 18.3 KiB | 563 | 461 |
| cups.yaml | D | 22-Oct-2025 | 670 | 18 | 4 |
| cupsprinter.png | D | 22-Oct-2025 | 2.1 KiB | | |
| fix-httpAddrGetList-test-case-fail.patch | D | 22-Oct-2025 | 1.4 KiB | 45 | 37 |
| generate_mime_convs.py | D | 22-Oct-2025 | 1 KiB | 35 | 17 |
| install-sh | D | 22-Oct-2025 | 5.5 KiB | 234 | 145 |
| install.py | D | 22-Oct-2025 | 3.2 KiB | 102 | 74 |
| ohos-add-openssl.patch | D | 22-Oct-2025 | 44.7 KiB | 1,683 | 1,682 |
| ohos-cups-badfd.patch | D | 22-Oct-2025 | 3.1 KiB | 113 | 99 |
| ohos-filetypes-crash.patch | D | 22-Oct-2025 | 2.6 KiB | 63 | 59 |
| ohos-hilog-print.patch | D | 22-Oct-2025 | 2.7 KiB | 81 | 78 |
| ohos-modify-pthread.patch | D | 22-Oct-2025 | 332 | 13 | 11 |
| ohos-multi-file-print.patch | D | 22-Oct-2025 | 432 | 15 | 13 |
| ohos-ppdfile-not-generated.patch | D | 22-Oct-2025 | 717 | 15 | 12 |
| ohos-uni-print-driver-path.patch | D | 22-Oct-2025 | 967 | 25 | 24 |
| ohos-usb-manager.patch | D | 22-Oct-2025 | 42.9 KiB | 1,186 | 1,185 |
| ohos-usb-print.patch | D | 22-Oct-2025 | 54.1 KiB | 1,858 | 1,856 |
| ohos-verify-backend.patch | D | 22-Oct-2025 | 442 | 14 | 13 |
| ohos_ip_conflict.patch | D | 22-Oct-2025 | 13.5 KiB | 390 | 356 |
README.OpenSource
README.md
1OpenPrinting CUPS v2.4.12
2=========================
3
4
5
6[](https://github.com/OpenPrinting/cups/actions/workflows/build.yml)
7[](https://scan.coverity.com/projects/openprinting-cups)
8
9
10Introduction
11------------
12
13OpenPrinting CUPS is the most current version of CUPS, a standards-based, open
14source printing system for Linux® and other Unix®-like operating systems. CUPS
15supports printing to:
16
17- [AirPrint™][1] and [IPP Everywhere™][2] printers,
18- Network and local (USB) printers with Printer Applications, and
19- Network and local (USB) printers with (legacy) PPD-based printer drivers.
20
21CUPS provides the System V ("lp") and Berkeley ("lpr") command-line interfaces,
22a configurable web interface, a C API, and common print filters, drivers, and
23backends for printing. The [cups-filters][3] project provides additional
24filters and drivers.
25
26CUPS is licensed under the Apache License Version 2.0 with an exception to allow
27linking against GNU GPL2-only software. See the files `LICENSE` and `NOTICE`
28for more information.
29
30> Note: Apple maintains a separate repository for the CUPS that ships with macOS
31> and iOS at <https://github.com/apple/cups>.
32
33[1]: https://support.apple.com/en-us/HT201311
34[2]: https://www.pwg.org/ipp/everywhere.html
35[3]: https://github.com/openprinting/cups-filters
36
37
38Reading the Documentation
39-------------------------
40
41Initial documentation to get you started is provided in the root directory of
42the CUPS sources:
43
44- `CHANGES.md`: A list of changes in the current major release of CUPS.
45- `CONTRIBUTING.md`: Guidelines for contributing to the CUPS project.
46- `CREDITS.md`: A list of past contributors to the CUPS project.
47- `DEVELOPING.md`: Guidelines for developing code for the CUPS project.
48- `INSTALL.md`: Instructions for building and installing CUPS.
49- `LICENSE`: The CUPS license agreement (Apache 2.0).
50- `NOTICE`: Copyright notices and exceptions to the CUPS license agreement.
51- `README.md`: This file.
52- `REPORTING_ISSUES.md`: Instructions what information to provide when reporting an issue.
53
54Once you have installed the software you can access the documentation (and a
55bunch of other stuff) online at <http://localhost:631/> and using the `man`
56command, for example `man cups`.
57
58If you're having trouble getting that far, the documentation is located under
59the `doc/help` and `man` directories.
60
61*Please read the documentation before asking questions.*
62
63
64Setting Up Printers
65-------------------
66
67CUPS includes a web-based administration tool that allows you to manage
68printers, classes, and jobs on your server. Open <http://localhost:631/admin/>
69in your browser to access the printer administration tools. You will be asked
70for the administration password (root or any other user in the "sys", "system",
71"root", "admin", or "lpadmin" group on your system) when performing any
72administrative function.
73
74The `lpadmin` command is used to manage printers from the command-line. For
75example, the following command creates a print queue called "myprinter" for an
76IPP Everywhere printer at address "11.22.33.44":
77
78 lpadmin -p myprinter -E -v "ipp://11.22.33.44/ipp/print" -m everywhere
79
80The `-p` option specifies the printer name. The `-E` option enables the printer
81and accepts new print jobs immediately. The `-v` option specifies the *device
82URI* for the printer, which tells CUPS how to communicate with the printer. And
83the `-m` option specifies the model (driver) to use, in this case the IPP
84Everywhere ("everywhere") driver that is used for AirPrint and IPP Everywhere
85printers as well as shared printers and printers supported through Printer
86Applications.
87
88Legacy printers are supported using PPD (PostScript Printer Description) files
89that describe printer capabilities and driver programs needed for each printer.
90CUPS includes several sample PPD files for common legacy printers:
91
92 Driver | PPD Name
93 -----------------------------|------------------------------
94 Dymo Label Printers | drv:///sample.drv/dymo.ppd
95 Intellitech Intellibar | drv:///sample.drv/intelbar.ppd
96 EPSON 9-pin Series | drv:///sample.drv/epson9.ppd
97 EPSON 24-pin Series | drv:///sample.drv/epson24.ppd
98 Generic PCL Laser Printer | drv:///sample.drv/generpcl.ppd
99 Generic PostScript Printer | drv:///sample.drv/generic.ppd
100 HP DeskJet Series | drv:///sample.drv/deskjet.ppd
101 HP LaserJet Series | drv:///sample.drv/laserjet.ppd
102 OKIDATA 9-Pin Series | drv:///sample.drv/okidata9.ppd
103 OKIDATA 24-Pin Series | drv:///sample.drv/okidat24.ppd
104 Zebra CPCL Label Printer | drv:///sample.drv/zebracpl.ppd
105 Zebra EPL1 Label Printer | drv:///sample.drv/zebraep1.ppd
106 Zebra EPL2 Label Printer | drv:///sample.drv/zebraep2.ppd
107 Zebra ZPL Label Printer | drv:///sample.drv/zebra.ppd
108
109The sample drivers provide basic printing capabilities, but generally do not
110exercise the full potential of the printers or CUPS. Other drivers provide
111greater printing capabilities.
112
113You can run the `lpinfo -m` command to list all of the available drivers:
114
115 lpinfo -m
116
117Similarly, the `lpinfo -v` command lists the available printers and their device
118URIs:
119
120 lpinfo -v
121
122Once you know the device URI and driver name, add the printer using the
123`lpadmin` command:
124
125 lpadmin -p PRINTER-NAME -E -v "DEVICE-URI" -m DRIVER-NAME
126
127
128Printing Files
129--------------
130
131CUPS provides both the System V `lp` and Berkeley `lpr` commands for printing:
132
133 lp FILENAME
134 lpr FILENAME
135
136Both the `lp` and `lpr` commands support printing options:
137
138 lp -o media=A4 -o resolution=600dpi FILENAME
139 lpr -o media=A4 -o resolution=600dpi FILENAME
140
141CUPS recognizes many types of images files as well as PDF, PostScript, and text
142files, so you can print those files directly rather than through an application.
143
144If you have an application that generates output specifically for your printer
145then you need to use the `-oraw` or `-l` options:
146
147 lp -o raw FILENAME
148 lpr -l FILENAME
149
150This will prevent the filters from misinterpreting your print file.
151
152
153Legal Stuff
154-----------
155
156Copyright © 2020-2025 by OpenPrinting
157
158Copyright © 2007-2020 by Apple Inc.
159
160Copyright © 1997-2007 by Easy Software Products.
161
162CUPS is provided under the terms of the Apache License, Version 2.0 with
163exceptions for GPL2/LGPL2 software. A copy of this license can be found in the
164file `LICENSE`. Additional legal information is provided in the file `NOTICE`.
165
166Unless required by applicable law or agreed to in writing, software distributed
167under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
168CONDITIONS OF ANY KIND, either express or implied. See the License for the
169specific language governing permissions and limitations under the License.
170
README_zh.md
1# 三方开源软件CUPS
2## CUPS简介
3CUPS(Common Unix Printing System)是一种开源打印系统,现在由OpenPrinting组织维护。CUPS主要功能包括打印队列管理、打印驱动程序管理、网络打印支持等。CUPS支持多种打印协议,包括IPP(Internet Printing Protocol)、LPD(Line Printer Daemon Protocol)、AppSocket等。
4
5CUPS支持以下类型的打印机:
6- AirPrint和IPP Everywhere认证的打印机;
7- 带打印机应用程序的网络和USB打印机;
8- 基于PPD(PostScript Printer Definition)打印驱动程序的网络和本地(USB)打印机。
9
10您也可以通过[CUPS官网主页](https://github.com/OpenPrinting/cups)了解更多关于CUPS项目的信息。
11
12## 引入背景简述
13OpenHarmony南向生态发展过程中,需要对存量市场的打印机进行兼容。使用CUPS打印系统能直接对接市场上大部分的打印机,也减少了打印机驱动适配OpenHarmony系统的难度。
14
15## 目录结构
16```
17- LICENSE 版权文件
18- OAT.xml OAT.xml过滤配置文件
19- README.OpenSource 项目README.OpenSource文件
20- README.md 英文说明
21- README_zh.md 中文说明
22- backport-CVE-xxx.patch CVE修复补丁
23- cups-x.x.x-source.tar.gz cups源码压缩tar包
24- backport-xxx.patch 上游更新补丁列表
25- cups-xxx.patch 上游更新补丁列表
26- cups.spec 上游更新记录说明
27- cups.yaml 上游yaml文件
28- ohos-xxx.patch 适配OpenHarmony编译补丁文件
29- cups_single_file.patch 适配OpenHarmony编译补丁文件
30- pthread_cancel.patch 适配OpenHarmony编译补丁文件
31- install.sh 适配OpenHarmony编译sh脚本文件
32- generate_mime_convs.py 适配OpenHarmony编译python脚本文件
33```
34
35## 如何使用
36### 1、头文件引入
37```c
38#include <cups/cups-private.h>
39```
40### 2、添加编译依赖
41在您的 bundle.json 文件 添加
42```json
43"deps": {
44 "third_party": [
45 "cups"
46 ]
47}
48```
49在您的BUILD.gn需要的地方添加依赖
50```json
51deps += [ "//third_party/cups:cups" ]
52```
53### 3、接口使用示例
54```c
55// 使用CUPS接口查询打印机能力示例
56ipp_t *request; /* IPP Request */
57ipp_t *response; /* IPP response */
58http_t *http = NULL;
59char scheme[HTTP_MAX_URI]; // 协议类型
60char username[HTTP_MAX_URI]; // 请求用户名
61char host[HTTP_MAX_URI]; // 打印机ip
62int port; // 打印机端口
63// 声明需要查询哪些打印机能力,此处为所有
64static const char * const pattrs[] = {
65 "all"
66};
67
68// 使用打印机ip和端口连接打印机
69http = httpConnect2(host, port, NULL, AF_UNSPEC, HTTP_ENCRYPTION_IF_REQUESTED, 1, TIME_OUT, NULL);
70if (http == nullptr) {
71 return;
72}
73// 构造获取打印机能力的request
74request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
75// 指定请求uri
76ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printerUri.c_str());
77// 指定请求的用户
78ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
79// 指定请求哪些打印机属性
80ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes",
81(int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
82// 调用CUPS接口发送ipp请求
83response = cupsDoRequest(http, request, "/");
84// 处理请求结果
85if (cupsLastError() > IPP_STATUS_OK_CONFLICTING) {
86 ippDelete(response);
87 return;
88}
89// 关闭http
90httpClose(http);
91```
92
93### 相关仓
94[third_party_cups-filters](https://gitee.com/openharmony/third_party_cups-filters)
95
96[print_print_fwk](https://gitee.com/openharmony/print_print_fwk)
97
98### 参与贡献
99[如何贡献](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/参与贡献.md)
100
101[Commit message规范](https://gitee.com/openharmony/device_qemu/wikis/Commit%20message%E8%A7%84%E8%8C%83)
102
103