2055504 - Set gutenprint53+usb backend to use the default USB context

This commit is contained in:
Zdenek Dohnal 2022-03-28 11:52:15 +02:00
parent 4c7ecb8883
commit 6c5abd265e
2 changed files with 82 additions and 2 deletions

View File

@ -0,0 +1,75 @@
diff --git a/src/cups/backend_common.c b/src/cups/backend_common.c
index 6333408..b19668d 100644
--- a/src/cups/backend_common.c
+++ b/src/cups/backend_common.c
@@ -753,8 +753,7 @@ static struct dyesub_backend *backends[] = {
NULL,
};
-static int find_and_enumerate(struct libusb_context *ctx,
- struct libusb_device ***list,
+static int find_and_enumerate(struct libusb_device ***list,
const struct dyesub_backend *backend,
const char *match_serno,
const char *make,
@@ -777,7 +776,7 @@ static int find_and_enumerate(struct libusb_context *ctx,
STATE("+org.gutenprint.searching-for-device\n");
/* Enumerate and find suitable device */
- num = libusb_get_device_list(ctx, list);
+ num = libusb_get_device_list(NULL, list);
/* See if we can actually match on the supplied make! */
if (backend && make) {
@@ -1010,7 +1009,6 @@ along with this program; if not, see <https://www.gnu.org/licenses/>.\n\n";
void print_help(const char *argv0, const struct dyesub_backend *backend)
{
- struct libusb_context *ctx = NULL;
struct libusb_device **list = NULL;
const char *ptr = getenv("BACKEND");
@@ -1072,7 +1070,7 @@ void print_help(const char *argv0, const struct dyesub_backend *backend)
}
/* Scan for all printers for the specified backend */
- find_and_enumerate(ctx, &list, backend, NULL, ptr, 1, 1, NULL);
+ find_and_enumerate(&list, backend, NULL, ptr, 1, 1, NULL);
libusb_free_device_list(list, 1);
}
@@ -1251,7 +1249,6 @@ done:
int main (int argc, char **argv)
{
- struct libusb_context *ctx = NULL;
struct libusb_device **list = NULL;
struct dyesub_backend *backend = NULL;
@@ -1414,7 +1411,7 @@ int main (int argc, char **argv)
#endif
/* Libusb setup */
- ret = libusb_init(&ctx);
+ ret = libusb_init(NULL);
if (ret) {
ERROR("Failed to initialize libusb (%d)\n", ret);
ret = CUPS_BACKEND_RETRY_CURRENT;
@@ -1438,7 +1435,7 @@ int main (int argc, char **argv)
}
/* Enumerate devices */
- found = find_and_enumerate(ctx, &list, backend, use_serno, backend_str, 0, NUM_CLAIM_ATTEMPTS, &conn);
+ found = find_and_enumerate(&list, backend, use_serno, backend_str, 0, NUM_CLAIM_ATTEMPTS, &conn);
if (found == -1) {
ERROR("Printer open failure (No matching printers found!)\n");
@@ -1572,7 +1569,7 @@ done:
if (list)
libusb_free_device_list(list, 1);
- libusb_exit(ctx);
+ libusb_exit(NULL);
return ret;
}

View File

@ -8,7 +8,7 @@
Name: gutenprint
Summary: Printer Drivers Package
Version: 5.3.4
Release: 7%{?dist}
Release: 8%{?dist}
URL: http://gimp-print.sourceforge.net/
Source0: http://downloads.sourceforge.net/gimp-print/%{name}-%{version}.tar.xz
# Post-install script to update CUPS native PPDs.
@ -20,6 +20,7 @@ Patch4: gutenprint-yyin.patch
Patch5: gutenprint-manpage.patch
Patch6: gutenprint-python36syntax.patch
Patch7: gutenprint-xmlfixes.patch
Patch8: gutenprint-libusb-crash.patch
License: GPLv2+
#### removed patches, because the seems useless
@ -153,7 +154,6 @@ Epson, HP and compatible printers.
%patch3 -p1 -b .postscriptdriver
# Don't export yy* symbols (bug #882194).
%patch4 -p1 -b .yyin
# Added some escputil options to the manpage (bug #979064).
%patch5 -p1 -b .manpage
@ -166,6 +166,8 @@ sed -i -e 's,^#!/usr/bin/python3,#!%{__python3},' src/cups/cups-genppdupdate.in
%patch6 -p1 -b .python36syntax
# fix xml error reported by rpminspect, sent upstream via email
%patch7 -p1 -b .xmlfixes
# 2055504 - Set gutenprint53+usb backend to use the default USB context
%patch8 -p1 -b .crash
%build
# Don't run the weave test as it takes a very long time.
@ -286,6 +288,9 @@ exit 0
%{_mandir}/man8/cups-genppd*8*.gz
%changelog
* Mon Mar 28 2022 Zdenek Dohnal <zdohnal@redhat.com> - 5.3.4-8
- 2055504 - Set gutenprint53+usb backend to use the default USB context
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild