Go to file
dongzhengkuan bc29cf26a8 修改readme Signed-off-by:dongzhengkuan@huawei.com
Signed-off-by: dongzhengkuan <dongzhengkuan@huawei.com>
2023-07-20 09:55:22 +08:00
patches update readme Signed-off-by:dongzhengkuan@huawei.com 2023-07-18 15:06:56 +08:00
backport-Also-fix-cupsfilter.patch fix master failed 2022-06-15 17:23:07 +08:00
backport-CVE-2022-26691.patch fix CVE-2022-26691 2022-06-10 16:56:36 +08:00
backport-CVE-2023-32324.patch fix CVE-2023-32324 2023-06-05 16:22:29 +08:00
backport-CVE-2023-34241.patch fix CVE-2023-34241 2023-06-28 14:32:26 +08:00
backport-Remove-legacy-code-for-RIP_MAX_CACHE-environment-variable.patch fix master failed 2022-06-15 17:23:07 +08:00
BUILD.gn update readme Signed-off-by:dongzhengkuan@huawei.com 2023-07-18 15:54:54 +08:00
bundle.json add BUILD.gn config file Signed-off-by:dongzhengkuan@huawei.com 2023-07-05 18:56:53 +08:00
config.h update config.h. 2023-07-13 08:33:36 +00:00
cups_single_file.patch rename cups_simgle_file.patch to cups_single_file.patch. 2023-07-06 02:51:49 +00:00
cups-2.4.0-source.tar.gz upgrade to cups-2.4.0 2021-12-09 20:24:57 +08:00
cups-banners.patch Package init 2019-09-30 10:36:23 -04:00
cups-direct-usb.patch Package init 2019-09-30 10:36:23 -04:00
cups-driverd-timeout.patch version update 2020-07-27 18:06:26 +08:00
cups-freebind.patch Package init 2019-09-30 10:36:23 -04:00
cups-ipp-multifile.patch Package init 2019-09-30 10:36:23 -04:00
cups-multilib.patch version update 2020-07-27 18:06:26 +08:00
cups-system-auth.patch Package init 2019-09-30 10:36:23 -04:00
cups-uri-compat.patch version update 2020-07-27 18:06:26 +08:00
cups-usb-paperout.patch Package init 2019-09-30 10:36:23 -04:00
cups-web-devices-timeout.patch version update 2020-07-27 18:06:26 +08:00
cups.gni update cups.gni. 2023-07-06 02:50:18 +00:00
cups.spec fix CVE-2023-34241 2023-06-28 14:32:26 +08:00
cups.yaml add yaml file in package 2020-06-16 18:05:45 +08:00
cupsprinter.png Package init 2019-09-30 10:36:23 -04:00
fix-httpAddrGetList-test-case-fail.patch fix build error 2023-06-09 06:55:30 +00:00
generate_mime_convs.py update readme Signed-off-by:dongzhengkuan@huawei.com 2023-07-19 09:32:44 +08:00
install.sh update readme Signed-off-by:dongzhengkuan@huawei.com 2023-07-18 15:49:20 +08:00
LICENSE 增加readme和license文件 Signed-off-by:dongzhengkuan@huawei.com 2023-07-06 11:45:25 +08:00
macros.cups Package init 2019-09-30 10:36:23 -04:00
OAT.xml add OAT.xml and README.Opensource Signed-off-by:lizhixiong12@huawei.com 2023-07-10 11:33:23 +08:00
pthread_cancel.patch update pthread_cancel.patch. 2023-07-06 02:52:43 +00:00
README_zh.md 修改readme Signed-off-by:dongzhengkuan@huawei.com 2023-07-20 09:55:22 +08:00
README.md 修改readme Signed-off-by:dongzhengkuan@huawei.com 2023-07-20 09:55:22 +08:00
README.OpenSource add OAT.xml and README.Opensource Signed-off-by:lizhixiong12@huawei.com 2023-07-10 11:33:23 +08:00

CUPS

Introduction

OpenPrinting CUPS is the most current version of CUPS, a standards-based, open source printing system for Linux® and other Unix®-like operating systems. CUPS supports printing to:

  • AirPrint™ and IPP Everywhere™ printers,
  • Network and local (USB) printers with Printer Applications, and
  • Network and local (USB) printers with (legacy) PPD-based printer drivers.

You can also learn more about the CUPS project through the official website

Background Brief

In the process of OpenHarmony's southward ecological development, it is necessary to be compatible with printers in the stock market. The use of CUPS printing system can directly connect with most printers in the market, which also reduces the difficulty for printer manufacturers to adapt to OpenHarmony.

How to use

1、Header file import

#include <cups/cups-private.h>

2、Add Compilation Dependency

Add in the bundle. json file

"deps": {
  "third_part": [
    "cups"
  ]
}

Add dependencies where needed in BUILD.gn

deps += [ "//third_party/cups:cups" ]

3、Example of interface usage

// Example of using CUPS interface to query printer capabilities
ipp_t *request; /* IPP Request */
ipp_t *response; /* IPP response */
http_t *http = NULL;
char scheme[HTTP_MAX_URI]; // Protocol 
char username[HTTP_MAX_URI];
char host[HTTP_MAX_URI];
int port;
// Declare which printer capabilities need to be queried, here are all
static const char * const pattrs[] = {
    "all"
};

// Connect to printer
http = httpConnect2(host, port, NULL, AF_UNSPEC, HTTP_ENCRYPTION_IF_REQUESTED, 1, TIME_OUT, NULL);
if (http == nullptr) {
    return;
}
request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printerUri.c_str());
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes",
(int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
response = cupsDoRequest(http, request, "/");
// parse response
if (cupsLastError() > IPP_STATUS_OK_CONFLICTING) {
    ippDelete(response);
    return;
}
// close http
httpClose(http);

Repositories Involved

third_party_cups-filters

print_print_fwk

Contribution

How to involve

Commit message spec