summaryrefslogtreecommitdiff
path: root/extra/hpoj
diff options
context:
space:
mode:
authorParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
committerParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
commit415856bdd4f48ab4f2732996f0bae58595092bbe (patch)
treeede2018b591f6dfb477fe9341ba17b9bc000fab9 /extra/hpoj
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'extra/hpoj')
-rw-r--r--extra/hpoj/PKGBUILD52
-rw-r--r--extra/hpoj/hpoj-gcc4.patch194
-rw-r--r--extra/hpoj/hpoj-kernel26.patch86
-rw-r--r--extra/hpoj/hpoj-pack.patch59
-rw-r--r--extra/hpoj/hpoj.install7
-rw-r--r--extra/hpoj/hpoj0.91-snmp5.5.patch11
-rw-r--r--extra/hpoj/hpoj_gcc43.diff20
7 files changed, 429 insertions, 0 deletions
diff --git a/extra/hpoj/PKGBUILD b/extra/hpoj/PKGBUILD
new file mode 100644
index 000000000..f7a775365
--- /dev/null
+++ b/extra/hpoj/PKGBUILD
@@ -0,0 +1,52 @@
+# $Id: PKGBUILD 112539 2011-03-05 07:01:59Z eric $
+# Maintainer : Tobias Powalowski <tpowa@archlinux.org>
+
+
+pkgname=hpoj
+pkgver=0.91
+pkgrel=16
+pkgdesc="Hewlett-Packard OfficeJet, PSC, LaserJet, and PhotoSmart printer multi-function peripherals (MFPs) drivers"
+arch=('i686' 'x86_64')
+url="http://hpoj.sourceforge.net"
+license=('GPL' 'custom')
+depends=('perl' 'libusb-compat' 'net-snmp>=5.6.1' 'hplip>=1.7.2')
+makedepends=('qt3')
+optdepends=('qt3: for using xojpanel')
+install=hpoj.install
+source=(http://downloads.sourceforge.net/sourceforge/hpoj/$pkgname-$pkgver.tgz \
+ hpoj-gcc4.patch hpoj-kernel26.patch hpoj-pack.patch \
+ hpoj_gcc43.diff hpoj0.91-snmp5.5.patch)
+md5sums=('0e083aeab9b00495aa433fa9465456e0' '347bb155c5dde443a93d92d8e64579a2'\
+ '18481d3dcf6e9cadf0a3d196ee164e37' '1c3b99f1a2178675d56ece29daba0fd7'\
+ '42bb57791cacf83e4d339e3653ad003e' 'af1cf13e95ff2654b84e470d0e18f537')
+sha1sums=('36785cf1a925f569ed3983b8c068620e2c9b4456' 'cd2d37c2620e29b92b96fe779d10a6635c7f31b7'\
+ 'fe3328fd7a43ec83d76d0d7fb7be6c41027cddb3' '80258e3190ffb514c20386e8a7cf70ee18df95a5'\
+ '22409b96d7bc67a10384a88c6b710981c0b90078' '4827cfa319bcd74ff8956e1bc69360f319a26c6a')
+
+build() {
+ cd "$srcdir"/$pkgname-$pkgver
+ # adding various patches
+ patch -Np1 -i ../hpoj-gcc4.patch
+ patch -Np1 -i ../hpoj-kernel26.patch
+ patch -Np1 -i ../hpoj-pack.patch
+ patch -Np1 -i ../hpoj_gcc43.diff
+ patch -Np1 -i ../hpoj0.91-snmp5.5.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "$srcdir"/$pkgname-$pkgver
+ make prefix="$pkgdir"/usr/ user_install
+ mkdir -p "$pkgdir"/etc/rc.d
+ mkdir -p "$pkgdir"/usr/lib/sane
+ mkdir -p "$pkgdir"/usr/lib/cups/backend
+ install -m 644 lib/sane/libsane-hpoj.so.1.0 "$pkgdir"/usr/lib/sane
+ install -D -m644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
+ install -D -m644 LICENSE.OpenSSL $pkgdir/usr/share/licenses/$pkgname/LICENSE.OpenSSL
+ cd "$pkgdir"/usr/lib/sane
+ ln -s libsane-hpoj.so.1.0 libsane-hpoj.so
+ ln -s libsane-hpoj.so.1.0 libsane-hpoj.so.1
+ ln -s /usr/sbin/ptal-init "$pkgdir"/etc/rc.d
+ ln -s /usr/sbin/ptal-cups "$pkgdir"/usr/lib/cups/backend/ptal
+ }
diff --git a/extra/hpoj/hpoj-gcc4.patch b/extra/hpoj/hpoj-gcc4.patch
new file mode 100644
index 000000000..ab1c125dd
--- /dev/null
+++ b/extra/hpoj/hpoj-gcc4.patch
@@ -0,0 +1,194 @@
+--- hpoj-0.91/lib/hpojip/xjpg_fix.c.gcc4 2002-07-25 11:01:24.000000000 +0200
++++ hpoj-0.91/lib/hpojip/xjpg_fix.c 2005-03-01 23:05:52.905482223 +0100
+@@ -389,7 +389,7 @@
+ \*****************************************************************************/
+
+
+-#define MYLOCATE(p) (void *)(p)=(g->headerBuffer+lenAddedHeader)
++#define MYLOCATE(p) (p)=(typeof(p))(g->headerBuffer+lenAddedHeader)
+ #define MYWRITE(p) lenAddedHeader+=sizeof(*(p))
+ #define MYWRITEBUF(data,datalen) \
+ do { \
+--- hpoj-0.91/mlcd/ExMgr.h.gcc4 2003-11-04 02:03:18.000000000 +0100
++++ hpoj-0.91/mlcd/ExMgr.h 2005-03-01 23:38:34.297977986 +0100
+@@ -127,8 +127,8 @@
+ QueueEntry(): prev(0),next(0) { }
+ #ifdef JD_DEBUGLITE
+ void dump(void) {
+- printf("QueueEntry(0x%8.8X): prev=0x%8.8X, next=0x%8.8X\n",
+- (int)this,(int)prev,(int)next);
++ printf("QueueEntry(%p): prev=%p, next=%p\n",
++ this,prev,next);
+ }
+ #endif
+ int isEnqueued(void) { return (prev || next); }
+--- hpoj-0.91/mlcd/ExMgr.cpp.gcc4 2003-11-04 02:03:18.000000000 +0100
++++ hpoj-0.91/mlcd/ExMgr.cpp 2005-03-01 23:41:49.408864110 +0100
+@@ -248,8 +248,8 @@
+
+ #ifdef JD_DEBUGLITE
+ void ExWatchdogTimer::dump(void) {
+- printf("pMsgHandler=0x%8.8X\n",(int)pMsgHandler);
+- printf("pMsg=0x%8.8X\n",(int)pMsg);
++ printf("pMsgHandler=%p\n",pMsgHandler);
++ printf("pMsg=%p\n",pMsg);
+ printf("delay=%d seconds, %d usec\n",
+ (int)delay.tv_sec,(int)delay.tv_usec);
+ printf("cancelled=%d\n",cancelled);
+@@ -1307,13 +1307,13 @@
+ printf("\tstate=%d\n",session[scd].state);
+ printf("\tfd=%d\n",session[scd].fd);
+ printf("\tscdlink=%d\n",session[scd].scdlink);
+- printf("\tpLookup=0x%8.8X\n",(int)session[scd].pLookup);
++ printf("\tpLookup=%p\n",session[scd].pLookup);
+ printf("\toutstandingForwardBdrCount=%d\n",
+ session[scd].outstandingForwardBdrCount);
+ printf("\tpReverseBdrQueue: depth=%d\n",
+ session[scd].pReverseBdrQueue->depth());
+- printf("\ttcd=0x%8.8X\n",(int)session[scd].tcd);
+- printf("\tpCommandBdr=0x%8.8X\n",(int)session[scd].pCommandBdr);
++ printf("\ttcd=%p\n",session[scd].tcd);
++ printf("\tpCommandBdr=%p\n",session[scd].pCommandBdr);
+ printf("\tpmlTrapsRegistered=%d\n",session[scd].pmlTrapsRegistered);
+ printf("\tbitbucketSocket=%d\n",session[scd].bitbucketSocket);
+
+@@ -2407,8 +2407,8 @@
+ }
+ printf("llioPossibleNameCount=%d\n",llioPossibleNameCount);
+ printf("llioName=<%s>\n",SAFE_STRING(llioName));
+- printf("llioGlobBuffer.gl_pathc=%d\n",llioGlobBuffer.gl_pathc);
+- printf("llioGlobBuffer.gl_offs=%d\n",llioGlobBuffer.gl_offs);
++ printf("llioGlobBuffer.gl_pathc=%lu\n",(unsigned long)llioGlobBuffer.gl_pathc);
++ printf("llioGlobBuffer.gl_offs=%lu\n",(unsigned long)llioGlobBuffer.gl_offs);
+ printf("llioGlobFlags=%d\n",llioGlobFlags);
+ for (i=0;i<llioMatchDeviceIDCount;i++) {
+ printf("llioMatchDeviceID[%d]=<%s>\n",i,
+--- hpoj-0.91/mlcd/transport/ExTransport.cpp.gcc4 2005-03-04 14:00:57.000000000 +0000
++++ hpoj-0.91/mlcd/transport/ExTransport.cpp 2005-03-04 14:03:37.000000000 +0000
+@@ -70,6 +70,7 @@
+
+ #ifdef JD_DEBUGLITE
+ void ExLookup::dump(void) {
++#if 0
+ printf("sizeof(ExLookup)=%d, this=0x%8.8X\n",
+ sizeof(ExLookup),(int)this);
+ printf("pService=0x%8.8X\n",
+@@ -82,6 +83,7 @@
+ lastSet);
+ printf("status=%d\n",
+ status);
++#endif
+ }
+ void ExLookup__dump(ExLookup *_this) {
+ return _this->dump();
+@@ -316,6 +318,7 @@
+
+ #ifdef JD_DEBUGLITE
+ void ExTransportChannel::dump(void) {
++#if 0
+ printf("this=0x%8.8X\n",
+ (int)this);
+ printf("port=%d\n",
+@@ -378,6 +381,7 @@
+ currentGrabbedCredit);
+ printf("currentGrabbedTransaction=%d\n",
+ currentGrabbedTransaction);
++#endif
+ }
+ #endif
+
+@@ -922,6 +926,7 @@
+ #ifdef JD_DEBUGLITE
+
+ void ExTransport::dump(void) {
++#if 0
+ int channel;
+
+ printf("this=0x%8.8X\n",
+@@ -971,6 +976,7 @@
+ if (pLookupRequest) {
+ pLookupRequest->dump();
+ }
++#endif
+ }
+
+ void ExTransport::dumpall(void) {
+@@ -1101,7 +1107,7 @@
+ ExMsg *pMsg=pMgr->getFreeMsg();
+
+ pMsg->setType(eEXMSG_ACTIVATE_WAIT);
+- pMsg->setParams(eEXCLASS_TRANSPORT,(int)this);
++ pMsg->setParams(eEXCLASS_TRANSPORT,(int)(long)this); // HACK
+ pMsg->send(pMgr);
+ }
+
+@@ -1248,7 +1254,7 @@
+ ExMsg *pMsg=pMgr->getFreeMsg();
+
+ pMsg->setType(eEXMSG_ACTIVATE_RESPONSE);
+- pMsg->setParams(eEXCLASS_TRANSPORT,(int)this,status);
++ pMsg->setParams(eEXCLASS_TRANSPORT,(int)(long)this,status); // HACK
+ pMsg->send(pMgr);
+ }
+
+@@ -1282,7 +1288,7 @@
+ ExMsg *pMsg=pMgr->getFreeMsg();
+
+ pMsg->setType(eEXMSG_DEACTIVATE_RESPONSE);
+- pMsg->setParams(eEXCLASS_TRANSPORT,(int)this,status);
++ pMsg->setParams(eEXCLASS_TRANSPORT,(int)(long)this,status); // HACK
+ pMsg->send(pMgr);
+ }
+
+--- hpoj-0.91/mlcd/transport/ExMlcTransport.cpp.gcc4 2005-03-04 14:28:28.000000000 +0000
++++ hpoj-0.91/mlcd/transport/ExMlcTransport.cpp 2005-03-04 14:29:40.000000000 +0000
+@@ -409,6 +409,7 @@
+
+ #ifdef JD_DEBUGLITE
+ void ExMlcTransportChannel::dump(void) {
++#if 0
+ ExTransportChannel::dump();
+ printf("----------------\n");
+ printf("pMlcTransport=0x%8.8X\n",
+@@ -487,6 +488,7 @@
+ countHandleEmptyCreditRequestReply.get());
+ printf("isGusher=%d\n",
+ isGusher());
++#endif
+ }
+ #endif
+
+@@ -1597,6 +1599,7 @@
+
+ #ifdef JD_DEBUGLITE
+ void ExMlcTransport::dump(void) {
++#if 0
+ int i;
+
+ ExTransport::dump();
+@@ -1631,6 +1634,7 @@
+ remoteSocketArray[i].maxForwardPacketSize,
+ remoteSocketArray[i].maxReversePacketSize);
+ }
++#endif
+ }
+ #endif
+
+--- hpoj-0.91/mlcd/transport/ExMlcCommandChannel.cpp.gcc4 2005-03-04 14:37:19.000000000 +0000
++++ hpoj-0.91/mlcd/transport/ExMlcCommandChannel.cpp 2005-03-04 14:37:46.000000000 +0000
+@@ -214,6 +214,7 @@
+
+ #ifdef JD_DEBUGLITE
+ void ExMlcCommandChannel::dump(void) {
++#if 0
+ ExMlcTransportChannel::dump();
+ printf("----------------\n");
+ printf("pForwardCommandPool=0x%8.8X\n",
+@@ -238,6 +239,7 @@
+ lastPsid);
+ printf("lastSsid=%d\n",
+ lastSsid);
++#endif
+ }
+ #endif
+
diff --git a/extra/hpoj/hpoj-kernel26.patch b/extra/hpoj/hpoj-kernel26.patch
new file mode 100644
index 000000000..38b8d0464
--- /dev/null
+++ b/extra/hpoj/hpoj-kernel26.patch
@@ -0,0 +1,86 @@
+--- hpoj-0.91/scripts/ptal-init.in.kernel26 2004-03-03 17:30:47.000000000 +0000
++++ hpoj-0.91/scripts/ptal-init.in 2004-03-03 17:30:59.000000000 +0000
+@@ -90,6 +90,11 @@
+ my $varLock="/var/lock";
+ my $varLockSubsys="$varLock/subsys";
+ my $osPlatform=`uname -s 2>/dev/null`;
++chomp $osPlatform;
++my $linuxVersion=($osPlatform eq 'Linux' ? `uname -r 2>/dev/null` : '');
++$linuxVersion=~s/^(\s*)(\d+\.\d+)(\..*)$/$2/;
++chomp $linuxVersion;
++my $usbprintermodule = ($linuxVersion eq '2.6' ? "usblp" : "printer");
+ my %devnames;
+ my %obsoleteDevnames;
+ my %configInfo;
+@@ -1222,12 +1227,12 @@
+ # undef -- skip USB probe
+ # 0 -- do nothing, proceed with USB probe
+ # >0 -- load printer.o
+-# <0 -- disable and unload printer.o
++# <0 -- disable and unload printer.o/usblp.o
+ sub linuxWhatShouldWeDoAboutUsbPrinterModule {
+ my $isSmp=&linuxIsSmp;
+ my $libusbSupported=&ptalMlcdSupportsLibusb;
+ my $usblpIsLoaded=&linuxUsblpIsLoaded;
+- my $printerIsLoaded=&linuxModuleIsLoaded("printer");
++ my $printerIsLoaded=&linuxModuleIsLoaded($usbprintermodule);
+
+ # non-SMP:
+ if (!$isSmp) {
+@@ -1261,9 +1266,10 @@
+ }
+ goto allowInsmodPrinter;
+
+- # SMP, libusb support, some sort of printer.c functionality loaded:
++ # SMP, libusb support, some sort of printer.c/usblp.c
++ # functionality loaded:
+ } elsif ($usblpIsLoaded) {
+- # printer.c compiled into the kernel:
++ # printer.c/usblp.c compiled into the kernel:
+ if (!$printerIsLoaded) {
+ if (!&askYN(
+ "\n".
+@@ -1280,7 +1286,7 @@
+ return undef;
+ }
+
+- # printer.c compiled and loaded as a module:
++ # printer.c/usblp.c compiled and loaded as a module:
+ } else {
+ promptDisableRmmodPrinter:
+ my $r=&askYN(
+@@ -1301,8 +1307,9 @@
+ }
+ }
+
+- # SMP, libusb support, printer.c enabled although not loaded:
+- } elsif (!&linuxModuleIsDisabled("printer")) {
++ # SMP, libusb support, printer.c/usblp.c enabled although not
++ # loaded:
++ } elsif (!&linuxModuleIsDisabled($usbprintermodule)) {
+ goto promptDisableRmmodPrinter;
+ }
+
+@@ -1326,11 +1333,11 @@
+ return 1;
+ }
+ if ($r<0) {
+- $r=&linuxDisableAndUnloadModule("printer",
++ $r=&linuxDisableAndUnloadModule($usbprintermodule,
+ "to prevent possible system instability due to SMP+USB");
+ } else {
+ linuxJustLoad:
+- $r=&linuxInsmod("printer",$quiet);
++ $r=&linuxInsmod($usbprintermodule,$quiet);
+ }
+ if (!$r && !$quiet &&
+ &askYN("\n*** Continue with the USB probe anyway".$msg,0)) {
+@@ -1601,7 +1608,7 @@
+
+ } else {
+ my $parModulesLoaded=0;
+- # Don't "modprobe printer" on SMP Linux with libusb support:
++ # Don't "modprobe printer/usblp" on SMP Linux with libusb support:
+ my $usbModulesLoaded=
+ (&ptalMlcdSupportsLibusb &&
+ $osPlatform=~/Linux/ && &linuxIsSmp);
diff --git a/extra/hpoj/hpoj-pack.patch b/extra/hpoj/hpoj-pack.patch
new file mode 100644
index 000000000..beb7040dc
--- /dev/null
+++ b/extra/hpoj/hpoj-pack.patch
@@ -0,0 +1,59 @@
+There is a rather scary and longstanding GCC bug [1] which causes
+instant crashes if a program defines a struct with function-pointers
+and that structure happens to be "packed". Why anybody would want to
+do such a thing is beyond me, but suffice it to say that hpoj v0.91 is
+doing precisely that. The current Debian/sarge package for hpoj is
+definitely affected (any attempt to scan an image results in an
+instant crash).
+
+A patch to work around the problem is attached.
+
+Perhaps the hpoj developers can tell us whether it was really
+intentional to have the #pragma pack(1) span all of <stdlib.h> and
+<xform.h>?
+
+Thanks,
+
+ --david
+
+[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1844
+
+--- hpoj-0.91/include/hpojip.h 2002-07-25 02:01:24.000000000 -0700
++++ hpoj-0.91-davidm/include/hpojip.h 2004-11-11 21:19:58.775236374 -0800
+@@ -131,12 +132,15 @@
+ float fl;
+ } DWORD_OR_PVOID;
+
++#pragma pack ()
++
+ #ifdef HPOJIP_INTERNAL
+ #include "../lib/hpojip/xform.h" // this file uses the above definitions
+ #else
+ typedef struct IP_XFORM_TBL_s FAR *LPIP_XFORM_TBL;
+ #endif
+
++#pragma pack (1)
+
+ /****************************************************************************\
+ ****************************************************************************
+@@ -587,8 +591,6 @@
+
+ EXPORT(WORD) ipGetFuncPtrs (LPIP_JUMP_TBL lpJumpTbl);
+
+-#pragma pack ()
+-
+ /****************************************************************************\
+ ****************************************************************************
+ *
+
+
+-------------------------------------------------------
+This SF.Net email is sponsored by:
+Sybase ASE Linux Express Edition - download now for FREE
+LinuxWorld Reader's Choice Award Winner for best database on Linux.
+http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
+
+_______________________________________________
+hpoj-devel mailing list
+hpoj-devel@lists.sourceforge.net
+https://lists.sourceforge.net/lists/listinfo/hpoj-devel
diff --git a/extra/hpoj/hpoj.install b/extra/hpoj/hpoj.install
new file mode 100644
index 000000000..acce9b033
--- /dev/null
+++ b/extra/hpoj/hpoj.install
@@ -0,0 +1,7 @@
+post_install() {
+cat << EOF
+==> To get the HP-Officejet working run as root: ptal-init setup
+==> Add ptal-init to /etc/rc.conf daemon list and place it before cups is started!
+==> To access scanner enable in /etc/sane.d/dll.conf hpoj line.
+EOF
+}
diff --git a/extra/hpoj/hpoj0.91-snmp5.5.patch b/extra/hpoj/hpoj0.91-snmp5.5.patch
new file mode 100644
index 000000000..2042d6f1a
--- /dev/null
+++ b/extra/hpoj/hpoj0.91-snmp5.5.patch
@@ -0,0 +1,11 @@
+diff -Naur hpoj-0.91-orig/lib/ptal/ptal-hpjd.c hpoj-0.91/lib/ptal/ptal-hpjd.c
+--- hpoj-0.91-orig/lib/ptal/ptal-hpjd.c 2010-02-19 22:33:54.000000000 -0500
++++ hpoj-0.91/lib/ptal/ptal-hpjd.c 2010-02-19 22:34:45.000000000 -0500
+@@ -45,6 +45,7 @@
+ #include <stdlib.h>
+
+ #ifdef HAVE_SNMP
++#include <net-snmp/net-snmp-config.h>
+ #include <asn1.h>
+ #include <snmp.h>
+ #include <snmp_api.h>
diff --git a/extra/hpoj/hpoj_gcc43.diff b/extra/hpoj/hpoj_gcc43.diff
new file mode 100644
index 000000000..099c9d755
--- /dev/null
+++ b/extra/hpoj/hpoj_gcc43.diff
@@ -0,0 +1,20 @@
+diff -Nru --exclude changelog hpoj-0.91/mlcd/transport/ExMlcTransport.h hpoj-0.91/mlcd/transport/ExMlcTransport.h
+--- hpoj-0.91/mlcd/transport/ExMlcTransport.h 2003-11-04 06:33:19.000000000 +0530
++++ hpoj-0.91/mlcd/transport/ExMlcTransport.h 2008-03-20 10:14:02.000000000 +0530
+@@ -888,14 +888,14 @@
+ void remsockReset(void);
+ public:
+ STATUS remsockLookup(int socketID,int *pState,
+- int *pMaxForwardPacketSize,int *pMaxForwardPacketSize);
++ int *pMaxForwardPacketSize,int *pMaxForwardPacketSize2);
+ STATUS remsockAdd(int socketID);
+ void handleConfigSocketReply(int result,int socketID,
+ int maxPriToSecPacketSize,int maxSecToPriPacketSize,
+ int statusLevel);
+ protected:
+ STATUS remsockUpdate(int socketID,
+- int maxForwardPacketSize,int maxForwardPacketSize);
++ int maxForwardPacketSize,int maxForwardPacketSize2);
+ STATUS remsockDelete(int socketID);
+
+ // Peripheral-initiated opens (not supported):