Martin Wilck 2023-09-15 16:38:35 +00:00 committed by Git OBS Bridge
parent f8eb7ff95b
commit a7eec14dfa
3 changed files with 83 additions and 35 deletions

View File

@ -1,6 +1,20 @@
diff -urEbwB hplip-3.20.9/common/utils.c hplip-3.20.9.new/common/utils.c
--- hplip-3.20.9/common/utils.c 2020-09-23 07:24:09.000000000 +0200
+++ hplip-3.20.9.new/common/utils.c 2020-11-23 12:21:21.471541779 +0100
From d52301159a5add137b46e7183970ea1f1cbfe8ac Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 15 Sep 2023 18:27:13 +0200
Subject: [PATCH 04/19] add missing includes and define GNU_SOURCE
---
common/utils.c | 5 +++++
io/hpmud/jd.c | 1 +
protocol/hp_ipp.c | 4 ++++
scan/sane/bb_ledm.c | 1 +
scan/sane/sclpml.c | 5 +++++
5 files changed, 16 insertions(+)
diff --git a/common/utils.c b/common/utils.c
index d8ecee9..6f5cef9 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -1,9 +1,14 @@
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
@ -16,9 +30,10 @@ diff -urEbwB hplip-3.20.9/common/utils.c hplip-3.20.9.new/common/utils.c
extern int errno;
diff -urEbwBN hplip-3.20.9/io/hpmud/jd.c hplip-3.20.9.new/io/hpmud/jd.c
--- hplip-3.20.9/io/hpmud/jd.c 2020-09-23 07:24:10.000000000 +0200
+++ hplip-3.20.9.new/io/hpmud/jd.c 2020-11-23 12:12:14.920243467 +0100
diff --git a/io/hpmud/jd.c b/io/hpmud/jd.c
index be3c823..c15ed9c 100644
--- a/io/hpmud/jd.c
+++ b/io/hpmud/jd.c
@@ -31,6 +31,7 @@
#endif
@ -27,22 +42,25 @@ diff -urEbwBN hplip-3.20.9/io/hpmud/jd.c hplip-3.20.9.new/io/hpmud/jd.c
#include "hpmud.h"
#include "hpmudi.h"
diff -urEbwBN hplip-3.20.9/protocol/hp_ipp.c hplip-3.20.9.new/protocol/hp_ipp.c
--- hplip-3.20.9/protocol/hp_ipp.c 2020-09-23 07:24:16.000000000 +0200
+++ hplip-3.20.9.new/protocol/hp_ipp.c 2020-11-23 12:12:21.624283957 +0100
@@ -18,6 +18,9 @@
diff --git a/protocol/hp_ipp.c b/protocol/hp_ipp.c
index 8b72c65..9b05f5e 100644
--- a/protocol/hp_ipp.c
+++ b/protocol/hp_ipp.c
@@ -18,6 +18,10 @@ Boston, MA 02110-1301, USA.
\******************************************************************************/
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
#include <cups/cups.h>
#include <cups/language.h>
diff -urEbwBN hplip-3.20.9/scan/sane/bb_ledm.c hplip-3.20.9.new/scan/sane/bb_ledm.c
--- hplip-3.20.9/scan/sane/bb_ledm.c 2020-09-23 07:24:20.000000000 +0200
+++ hplip-3.20.9.new/scan/sane/bb_ledm.c 2020-11-23 12:12:21.628283981 +0100
#include <cups/ppd.h>
diff --git a/scan/sane/bb_ledm.c b/scan/sane/bb_ledm.c
index 4b18af8..eaf1299 100644
--- a/scan/sane/bb_ledm.c
+++ b/scan/sane/bb_ledm.c
@@ -27,6 +27,7 @@
# include "xml.h"
# include <stdlib.h>
@ -51,9 +69,10 @@ diff -urEbwBN hplip-3.20.9/scan/sane/bb_ledm.c hplip-3.20.9.new/scan/sane/bb_led
# include <stdint.h>
# define _STRINGIZE(x) #x
diff -urEbwBN hplip-3.20.9/scan/sane/sclpml.c hplip-3.20.9.new/scan/sane/sclpml.c
--- hplip-3.20.9/scan/sane/sclpml.c 2020-09-23 07:24:20.000000000 +0200
+++ hplip-3.20.9.new/scan/sane/sclpml.c 2020-11-23 12:12:21.628283981 +0100
diff --git a/scan/sane/sclpml.c b/scan/sane/sclpml.c
index 9a5975f..3250541 100644
--- a/scan/sane/sclpml.c
+++ b/scan/sane/sclpml.c
@@ -25,11 +25,16 @@
\************************************************************************************/
@ -71,3 +90,6 @@ diff -urEbwBN hplip-3.20.9/scan/sane/sclpml.c hplip-3.20.9.new/scan/sane/sclpml.
#include "sane.h"
#include "saneopts.h"
#include "common.h"
--
2.42.0

View File

@ -1,8 +1,17 @@
Index: hplip-3.22.10/protocol/hp_ipp.c
===================================================================
--- hplip-3.22.10.orig/protocol/hp_ipp.c
+++ hplip-3.22.10/protocol/hp_ipp.c
@@ -43,6 +43,12 @@ Boston, MA 02110-1301, USA.
From 0bd5dd829e6f5509fda6cb09430ff14faa432941 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 15 Sep 2023 18:32:08 +0200
Subject: [PATCH 19/19] hplip: fix printer attributes parsing
---
protocol/hp_ipp.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/protocol/hp_ipp.c b/protocol/hp_ipp.c
index 9b05f5e..3ba83fa 100644
--- a/protocol/hp_ipp.c
+++ b/protocol/hp_ipp.c
@@ -43,6 +43,13 @@ Boston, MA 02110-1301, USA.
#define _STRINGIZE(x) #x
#define STRINGIZE(x) _STRINGIZE(x)
@ -12,19 +21,20 @@ Index: hplip-3.22.10/protocol/hp_ipp.c
+ dst[size - 1] = '\0'; \
+ } while (0)
+
http_t* acquireCupsInstance()
+
http_t *acquireCupsInstance()
{
@@ -113,7 +119,7 @@ int addCupsPrinter(char *name, char *dev
}
if (http == NULL)
@@ -113,7 +120,7 @@ int addCupsPrinter(char *name, char *device_uri, char *location, char *ppd_file,
}
if ( info == NULL )
- snprintf( info,sizeof(info), name );
+ hplip_strlcpy( info, name, sizeof(info));
sprintf( printer_uri, "ipp://localhost/printers/%s", name );
sprintf(printer_uri, "ipp://localhost/printers/%s", name);
@@ -514,27 +520,27 @@ int __parsePrinterAttributes(ipp_t *resp
@@ -518,27 +525,27 @@ int __parsePrinterAttributes(ipp_t *response, printer_t **printer_list)
if ( strcmp(attr_name, "printer-name") == 0 &&
val_tag == IPP_TAG_NAME ) {
@ -58,3 +68,6 @@ Index: hplip-3.22.10/protocol/hp_ipp.c
}
else if ( strcmp(attr_name, "printer-state") == 0 &&
val_tag == IPP_TAG_ENUM ) {
--
2.42.0

View File

@ -1,7 +1,17 @@
diff -urEbwBN hplip-3.20.9/protocol/hp_ipp.h hplip-3.20.9.new/protocol/hp_ipp.h
--- hplip-3.20.9/protocol/hp_ipp.h 2020-09-23 07:24:16.000000000 +0200
+++ hplip-3.20.9.new/protocol/hp_ipp.h 2020-11-23 12:17:09.178020748 +0100
@@ -149,6 +149,7 @@
From 10fe460cca9536dbb52c30fa8bec5c6a01e94ea0 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 15 Sep 2023 18:28:47 +0200
Subject: [PATCH 09/19] hp_ipp.h: add missing prototypes
---
protocol/hp_ipp.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/protocol/hp_ipp.h b/protocol/hp_ipp.h
index 032be9a..518d0ae 100644
--- a/protocol/hp_ipp.h
+++ b/protocol/hp_ipp.h
@@ -149,6 +149,7 @@ int auth_cancel_req = 0; // 0--> authentication cancel is not requested,
http_t* acquireCupsInstance();
@ -9,8 +19,8 @@ diff -urEbwBN hplip-3.20.9/protocol/hp_ipp.h hplip-3.20.9.new/protocol/hp_ipp.h
const char *getCupsErrorString(int status);
void freePrinterList(printer_t *list);
@@ -162,6 +163,11 @@
ipp_t * networkDoRequest(ipp_t *request, char* device_uri);
@@ -163,6 +164,11 @@ ipp_t *usbDoFileRequest(ipp_t *request, int iFileHandle,char *device_uri, const
ipp_t * networkDoRequest(ipp_t *request, char* device_uri,const char *resource);
ipp_t * getDeviceStatusAttributes(char* device_uri,char* printer_name, int *count);
int getCupsPrinters(printer_t **printer_list);
+int addCupsPrinter(char *name, char *device_uri, char *location, char *ppd_file,
@ -20,4 +30,7 @@ diff -urEbwBN hplip-3.20.9/protocol/hp_ipp.h hplip-3.20.9.new/protocol/hp_ipp.h
+int controlCupsPrinter(char *pr_name, int op);
HPIPP_RESULT parseResponseHeader(char* header, int *content_length, int *chunked, int* header_size);
HPIPP_RESULT prepend_http_header(raw_ipp *raw_request);
HPIPP_RESULT prepend_http_header(raw_ipp *raw_request,const char *resource);
--
2.42.0