diff options
author | Vianney le Clément de Saint-Marcq | 2015-08-15 10:05:32 +0200 |
---|---|---|
committer | Vianney le Clément de Saint-Marcq | 2015-08-15 10:05:32 +0200 |
commit | f47baad52fe257be80e543937601f0a8cb77aa2c (patch) | |
tree | b6a563498610e251f38aa5b3aee06cf5b030f10c | |
download | aur-f47baad52fe257be80e543937601f0a8cb77aa2c.tar.gz |
Initial commit
-rw-r--r-- | .SRCINFO | 43 | ||||
-rw-r--r-- | PKGBUILD | 82 | ||||
-rw-r--r-- | disable_upgrade.patch | 14 | ||||
-rw-r--r-- | hplip.install | 18 | ||||
-rw-r--r-- | hpscan-ledm-raw.patch | 139 |
5 files changed, 296 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..e8adf15ef319 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,43 @@ +pkgbase = hplip-raw-ledm + pkgdesc = HPLIP with patch for uncompressed scanning on LEDM-based peripherals + pkgver = 3.15.7 + pkgrel = 1 + url = http://hplipopensource.com + install = hplip.install + arch = i686 + arch = x86_64 + license = GPL + makedepends = python-pyqt4 + makedepends = python-gobject + makedepends = sane + makedepends = rpcbind + makedepends = cups + makedepends = libusb + depends = python + depends = ghostscript>=8.64-6 + depends = net-snmp>=5.7.1 + depends = wget + depends = foomatic-db-engine + optdepends = cups: for printing support + optdepends = python-dbus: for dbus support + optdepends = sane: for scanner support + optdepends = python-pillow: for commandline scanning support + optdepends = python-reportlab: for pdf output in hp-scan + optdepends = rpcbind: for network support + optdepends = python-pyqt4: for running GUI and hp-toolbox + optdepends = python-gobject: for running hp-toolbox + optdepends = hplip-plugin: binary blobs for specific devices (AUR) or run hp-setup to download the plugin + optdepends = libusb: for advanced usb support + provides = hplip + conflicts = hplip + source = http://downloads.sourceforge.net/hplip/hplip-3.15.7.tar.gz + source = http://downloads.sourceforge.net/hplip/hplip-3.15.7.tar.gz.asc + source = disable_upgrade.patch + source = hpscan-ledm-raw.patch + sha1sums = f84e33b749ef34939c11b253767686c00ca2c30c + sha1sums = SKIP + sha1sums = 2348bcbca0c52dc09cceb47ed13281a4ccb9d83e + sha1sums = 7e4b095d8bf9a0af9f0d035ca37691f733e271e0 + +pkgname = hplip-raw-ledm + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..d5a6aa31e602 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,82 @@ +pkgname=hplip-raw-ledm +pkgver=3.15.7 +pkgrel=1 +pkgdesc="HPLIP with patch for uncompressed scanning on LEDM-based peripherals" +arch=('i686' 'x86_64') +url="http://hplipopensource.com" +license=('GPL') +depends=('python' 'ghostscript>=8.64-6' 'net-snmp>=5.7.1' 'wget' 'foomatic-db-engine') +makedepends=('python-pyqt4' 'python-gobject' 'sane' 'rpcbind' 'cups' 'libusb') +optdepends=('cups: for printing support' + 'python-dbus: for dbus support' + 'sane: for scanner support' + 'python-pillow: for commandline scanning support' + 'python-reportlab: for pdf output in hp-scan' + 'rpcbind: for network support' + 'python-pyqt4: for running GUI and hp-toolbox' + 'python-gobject: for running hp-toolbox' + 'hplip-plugin: binary blobs for specific devices (AUR) or run hp-setup to download the plugin' + 'libusb: for advanced usb support') +conflicts=('hplip') +provides=('hplip') +install=hplip.install +source=(http://downloads.sourceforge.net/hplip/hplip-$pkgver.tar.gz{,.asc} + disable_upgrade.patch + hpscan-ledm-raw.patch) +sha1sums=('f84e33b749ef34939c11b253767686c00ca2c30c' + 'SKIP' + '2348bcbca0c52dc09cceb47ed13281a4ccb9d83e' + '7e4b095d8bf9a0af9f0d035ca37691f733e271e0') +validpgpkeys=('4ABA2F66DBD5A95894910E0673D770CDA59047B9') # HPLIP (HP Linux Imaging and Printing) <hplip@hp.com> + +prepare() { + cd hplip-$pkgver + + # disable insecure update - https://bugs.archlinux.org/task/38083 + patch -Np0 -i ${srcdir}/disable_upgrade.patch + patch -Np1 -i ${srcdir}/hpscan-ledm-raw.patch + + # https://bugs.archlinux.org/task/30085 - hack found in Gentoo + # Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip + # The hpcups driver does not use foomatic-rip + local i + for i in ppd/hpijs/*.ppd.gz ; do + rm -f ${i}.temp + gunzip -c ${i} | sed 's/foomatic-rip-hplip/foomatic-rip/g' | \ + gzip > ${i}.temp || return 1 + mv ${i}.temp ${i} + done + + export AUTOMAKE='automake --foreign' + autoreconf --force --install +} + +build() { + cd hplip-$pkgver + ./configure --prefix=/usr \ + --enable-qt4 \ + --disable-foomatic-rip-hplip-install \ + --enable-foomatic-ppd-install \ + --enable-hpcups-install \ + --enable-new-hpcups \ + --enable-cups-ppd-install \ + --enable-cups-drv-install \ + --enable-hpijs-install \ + --enable-foomatic-drv-install \ + --enable-pp-build #--help + make +} + +package() { + cd hplip-$pkgver + make -j1 rulesdir=/usr/lib/udev/rules.d DESTDIR="$pkgdir/" install + + # remove config provided by sane and autostart of hp-daemon + rm -rf "$pkgdir"/etc/{sane.d,xdg} + + # remove HAL .fdi file because HAL is no longer used + rm -vrf "$pkgdir"/usr/share/hal + + # remove rc script + rm -vrf "$pkgdir"/etc/init.d +} diff --git a/disable_upgrade.patch b/disable_upgrade.patch new file mode 100644 index 000000000000..f7d8fb3222f4 --- /dev/null +++ b/disable_upgrade.patch @@ -0,0 +1,14 @@ +--- upgrade.py.orig 2013-10-31 12:46:54.000000000 +0100 ++++ upgrade.py 2013-12-04 14:58:03.000000000 +0100 +@@ -134,6 +134,11 @@ except getopt.GetoptError, e: + if os.getenv("HPLIP_DEBUG"): + log.set_level('debug') + ++ ++log.error("HPLIP upgrade is disabled by Archlinux for security reasons, see https://bugs.archlinux.org/task/38083 - if you like to upgrade HPLIP, use the Archlinux software package manager pacman.") ++clean_exit(1) ++ ++ + for o, a in opts: + if o in ('-h', '--help'): + usage() diff --git a/hplip.install b/hplip.install new file mode 100644 index 000000000000..74532cde32cb --- /dev/null +++ b/hplip.install @@ -0,0 +1,18 @@ +post_install() { + cat << EOF + +NOTE +---- +# If you want to use this driver with sane: +# echo "hpaio" >> /etc/sane.d/dll.conf + +EOF +} + +post_upgrade() { + if [ "`vercmp $2 3.12.4-2`" -lt 0 ]; then + # important upgrade notice + echo "> Please remove your printer in cups, then add it" + echo "> back and reconfigure it to make it work again!" + fi +} diff --git a/hpscan-ledm-raw.patch b/hpscan-ledm-raw.patch new file mode 100644 index 000000000000..255bfe0094a5 --- /dev/null +++ b/hpscan-ledm-raw.patch @@ -0,0 +1,139 @@ +diff --git a/scan/sane/bb_ledm.c b/scan/sane/bb_ledm.c +index bf2c093..318ea5c 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]; +@@ -762,8 +794,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; + } +@@ -784,8 +815,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: +@@ -889,7 +920,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> +@@ -987,6 +1018,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 +@@ -1005,6 +1037,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 af86bff..65a7447 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; + } +@@ -679,7 +679,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; +@@ -984,7 +984,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; + |