extra/hplip to 3.23.3-3

This commit is contained in:
Kevin Mihelich 2023-05-07 14:05:44 +00:00
parent 5999e6bbf9
commit 81a36cdc51
2 changed files with 155 additions and 1 deletions

View file

@ -0,0 +1,150 @@
From: =?utf-8?b?THVib8WhIERvbGXFvmVs?= <lubos@dolezel.info>
Date: Fri, 22 Jul 2016 09:33:05 +0200
Subject: Allow non-JPEG scanning on the HP DeskJet 3520 All-in-One and
similar devices
LP: #1245578
---
scan/sane/bb_ledm.c | 47 +++++++++++++++++++++++++++++++++++++++++------
scan/sane/ledm.c | 12 +++++++-----
2 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/scan/sane/bb_ledm.c b/scan/sane/bb_ledm.c
index 4b18af8..168a6ab 100644
--- a/scan/sane/bb_ledm.c
+++ b/scan/sane/bb_ledm.c
@@ -189,7 +189,7 @@ Keep-Alive: 20\r\nProxy-Connection: keep-alive\r\nCookie: AccessCounter=new\r\n0
<YStart>%d</YStart>\
<Height>%d</Height>\
<Format>%s</Format>\
-<CompressionQFactor>15</CompressionQFactor>\
+<CompressionQFactor>0</CompressionQFactor>\
<ColorSpace>%s</ColorSpace>\
<BitDepth>%d</BitDepth>\
<InputSource>%s</InputSource>\
@@ -234,6 +234,38 @@ Keep-Alive: 300\r\nProxy-Connection: keep-alive\r\nCookie: AccessCounter=new\r\n
# define JOBSTATE_COMPLETED "<j:JobState>Completed</j:JobState>"
# define PRESCANPAGE "<PreScanPage>"
+static int parse_status_elements(const char *payload, int size, struct wscn_create_scan_job_response *resp)
+{
+ char tag[512];
+ char value[128];
+ char *tail=(char *)payload;
+
+ while (1)
+ {
+ get_tag(tail, size-(tail-payload), tag, sizeof(tag), &tail);
+
+ if (!tag[0])
+ break;
+
+ if (strncmp(tag, "ImageWidth", 10) == 0)
+ {
+ get_element(tail, size-(tail-payload), value, sizeof(value), &tail);
+ resp->pixels_per_line = strtol(value, NULL, 10);
+ }
+ else if (strncmp(tag, "ImageHeight", 11) == 0)
+ {
+ get_element(tail, size-(tail-payload), value, sizeof(value), &tail);
+ resp->lines = strtol(value, NULL, 10);
+ }
+ else if (strncmp(tag, "BytesPerLine", 12) == 0)
+ {
+ get_element(tail, size-(tail-payload), value, sizeof(value), &tail);
+ resp->bytes_per_line = strtol(value, NULL, 10);
+ }
+ }
+ return 0;
+}
+
static int parse_scan_elements(const char *payload, int size, struct wscn_scan_elements *elements)
{
char tag[512];
@@ -764,8 +796,7 @@ int bb_get_parameters(struct ledm_session *ps, SANE_Parameters *pp, int option)
if (ps->currentCompression == SF_RAW && ps->currentScanMode != CE_GRAY8)
{
/* Set scan parameters based on scan job response values */
- //pp->lines = pbb->job.lines;
- pp->lines = (int)(SANE_UNFIX(ps->effectiveBry - ps->effectiveTly)/MM_PER_INCH*ps->currentResolution);
+ pp->lines = pbb->job.lines;
pp->pixels_per_line = pbb->job.pixels_per_line;
pp->bytes_per_line = pbb->job.bytes_per_line;
}
@@ -786,8 +817,8 @@ int bb_get_parameters(struct ledm_session *ps, SANE_Parameters *pp, int option)
break;
case SPO_BEST_GUESS: /* called by xsane & sane_start */
/* Set scan parameters based on best guess. */
- pp->lines = (int)round(SANE_UNFIX(ps->effectiveBry - ps->effectiveTly)/MM_PER_INCH*ps->currentResolution);
- pp->pixels_per_line = (int)round(SANE_UNFIX(ps->effectiveBrx -ps->effectiveTlx)/MM_PER_INCH*ps->currentResolution);
+ pp->lines = (int)(SANE_UNFIX(ps->effectiveBry - ps->effectiveTly)/MM_PER_INCH*ps->currentResolution);
+ pp->pixels_per_line = ps->image_traits.iPixelsPerRow;
pp->bytes_per_line = BYTES_PER_LINE(pp->pixels_per_line, pp->depth * factor);
break;
default:
@@ -896,7 +927,7 @@ SANE_Status bb_start_scan(struct ledm_session *ps)
(int) ((ps->currentBrx / 5548.7133) - (ps->currentTlx / 5548.7133)),//<Width>
(int) (ps->currentTly / 5548.7133),//<YStart>
(int) ((ps->currentBry / 5548.7133) - (ps->currentTly / 5548.7133)),//<Height>
- "Jpeg",//<Format>
+ (ps->currentCompression == SF_RAW) ? "Raw" : "Jpeg", //<Format>
(! strcmp(ce_element[ps->currentScanMode], "Color8")) ? "Color" : (! strcmp(ce_element[ps->currentScanMode], "Gray8")) ? "Gray" : "Gray",//<ColorSpace>
((! strcmp(ce_element[ps->currentScanMode], "Color8")) || (! strcmp(ce_element[ps->currentScanMode], "Gray8"))) ? 8: 8,//<BitDepth>
ps->currentInputSource == IS_PLATEN ? is_element[1] : is_element[2],//<InputSource>
@@ -994,6 +1025,7 @@ SANE_Status bb_start_scan(struct ledm_session *ps)
_DBG("bb_start_scan() read_http_payload FAILED len=%d buf=%s\n", len, buf);
break;
}
+
//For a new scan, buf must contain <PreScanPage>.
if (NULL == strstr(buf,PRESCANPAGE))
{ //i.e Paper is not present in Scanner
@@ -1012,6 +1044,9 @@ SANE_Status bb_start_scan(struct ledm_session *ps)
stat = SANE_STATUS_GOOD;
goto bugout;
}
+ // Parse buf here
+ parse_status_elements(buf, len, &pbb->job);
+
usleep(500000);//0.5 sec delay
}//end while()
diff --git a/scan/sane/ledm.c b/scan/sane/ledm.c
index ac9d604..a56f534 100644
--- a/scan/sane/ledm.c
+++ b/scan/sane/ledm.c
@@ -170,11 +170,11 @@ static int set_scan_mode_side_effects(struct ledm_session *ps, enum COLOR_ENTRY
case CE_GRAY8:
case CE_COLOR8:
default:
-// ps->compressionList[j] = STR_COMPRESSION_NONE;
-// ps->compressionMap[j++] = SF_RAW;
+ ps->compressionList[j] = STR_COMPRESSION_NONE;
+ ps->compressionMap[j++] = SF_RAW;
ps->compressionList[j] = STR_COMPRESSION_JPEG;
ps->compressionMap[j++] = SF_JPEG;
- ps->currentCompression = SF_JPEG;
+ ps->currentCompression = SF_RAW;
ps->option[LEDM_OPTION_JPEG_QUALITY].cap |= SANE_CAP_SOFT_SELECT; /* enable jpeg quality */
break;
}
@@ -690,7 +690,7 @@ SANE_Status ledm_control_option(SANE_Handle handle, SANE_Int option, SANE_Action
}
else
{ /* Set default. */
- ps->currentCompression = SF_JPEG;
+ ps->currentCompression = SF_RAW;
stat = SANE_STATUS_GOOD;
}
break;
@@ -995,7 +995,9 @@ SANE_Status ledm_start(SANE_Handle handle)
}
}
else
- ipGetImageTraits(ps->ip_handle, NULL, &ps->image_traits); /* get valid image traits */
+ {
+ ipGetOutputTraits(ps->ip_handle, &ps->image_traits); /* get valid image traits */
+ }
stat = SANE_STATUS_GOOD;

View file

@ -8,7 +8,7 @@
pkgname=hplip
pkgver=3.23.3
pkgrel=2
pkgrel=3
epoch=1
pkgdesc="Drivers for HP DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet"
arch=('x86_64')
@ -30,6 +30,7 @@ backup=('etc/hp/hplip.conf' 'etc/sane.d/dll.d/hpaio')
source=(https://downloads.sourceforge.net/${pkgname}/$pkgname-$pkgver.tar.gz{,.asc}
disable_upgrade.patch
0003-models.dat-Re-add-drivers-missing-from-3.19.1.patch
0018-Allow-non-JPEG-scanning-on-the-HP-DeskJet-3520-All-i.patch
0022-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch
0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch
0025_fix-Werror-format-security.patch
@ -42,6 +43,7 @@ sha512sums=('b3c061d59ec4c4b8c2cb5a90a66a706439a75362d19bc7a14b6a8656812334f6de4
'SKIP'
'a12aaeece5285ffb86bdbc24871bf512fbc1f29da44ae51ded314378032662074a42b8aca23bebb378bf78ed15bb7f99da59bfb4cd456f3458e7a5ef42a900f8'
'f79b3f09d022178099f38b9eae1792396e730eb5352a03d088e6610d92b3895f3f65bb92089ce7f5b21d794f9716ceb176d29ca7283e8a48bb04cf6aba305a2f'
'93e29a9ef893636b2b84443e75525c4ed42531d6e68a182dfbb725c3919c77b966b5e7d9381a34d3b5853423995a7b15efb69ce3e500ec72b25b65b2ad6bd64c'
'22aeb5b851f78bc6bc62e0bc3da99fecaf42d7604af41e2f3343f8d3666541f7b06b7d1a7d0ddf24f1731ac7b12dfe582375a98e3b94dfa323d6ce954549ca67'
'b7e67bccb2516f4d98e4c5ea55f7d2299d95bfdc341dbc0149af1423169bedcd8bcfdb125c92f373e9e7be57ea284fef80a8343035fb42572b9cb927929cd257'
'763949a0bc460dcc9faefc86f2a91cf342781bfce696ed0c3826758572dd03ac266bbeb7b6a4f9376ac298d7d3c9c4def42d94921a8e1d1695e39396e36d95ff'
@ -72,6 +74,8 @@ prepare() {
# https://bugs.launchpad.net/hplip/+bug/1879445
# broken scanning - https://bugs.archlinux.org/task/66704
patch -Np1 -i ../hplip-configure-python.patch
# allow non-jpeg scanning on all-in-one devices - FS#78135
patch -Np1 -i ../0018-Allow-non-JPEG-scanning-on-the-HP-DeskJet-3520-All-i.patch
# make gzip creation reproducible by removing the timestamp
patch -Np1 -i ../reproducible-gzip.patch