summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Kursawe <phosphan@gentoo.org>2005-11-03 19:25:16 +0000
committerPatrick Kursawe <phosphan@gentoo.org>2005-11-03 19:25:16 +0000
commitc5414d25dcffbc8007f514053c955a075a20ded7 (patch)
tree7c64b9468b0656c2eb5654944f621f7710f0ce53 /media-gfx/sane-backends
parentadded examples (#72183) (diff)
downloadgentoo-2-c5414d25dcffbc8007f514053c955a075a20ded7.tar.gz
gentoo-2-c5414d25dcffbc8007f514053c955a075a20ded7.tar.bz2
gentoo-2-c5414d25dcffbc8007f514053c955a075a20ded7.zip
Additional fix for sm3600 USB from sane-CVS
(Portage version: 2.0.51.22-r2)
Diffstat (limited to 'media-gfx/sane-backends')
-rw-r--r--media-gfx/sane-backends/ChangeLog6
-rw-r--r--media-gfx/sane-backends/Manifest3
-rw-r--r--media-gfx/sane-backends/files/sm3600usb.patch291
-rw-r--r--media-gfx/sane-backends/sane-backends-1.0.16-r4.ebuild3
4 files changed, 300 insertions, 3 deletions
diff --git a/media-gfx/sane-backends/ChangeLog b/media-gfx/sane-backends/ChangeLog
index c0308693184f..8d1a6eedc2e4 100644
--- a/media-gfx/sane-backends/ChangeLog
+++ b/media-gfx/sane-backends/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for media-gfx/sane-backends
# Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-gfx/sane-backends/ChangeLog,v 1.82 2005/11/02 12:17:45 phosphan Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/sane-backends/ChangeLog,v 1.83 2005/11/03 19:25:16 phosphan Exp $
+
+ 03 Nov 2005; Patrick Kursawe <phosphan@gentoo.org> +files/sm3600usb.patch,
+ sane-backends-1.0.16-r4.ebuild:
+ Additional fix for sm3600 USB from sane-CVS
*sane-backends-1.0.16-r4 (02 Nov 2005)
diff --git a/media-gfx/sane-backends/Manifest b/media-gfx/sane-backends/Manifest
index 23b505727235..cfc393c03866 100644
--- a/media-gfx/sane-backends/Manifest
+++ b/media-gfx/sane-backends/Manifest
@@ -1,6 +1,6 @@
MD5 a89929370bb0df2da7a794efc7811785 sane-backends-1.0.16-r2.ebuild 4297
MD5 ebd00143bfe66f76d0d0da95cbc84923 sane-backends-1.0.15.ebuild 2598
-MD5 08e05309f64f09038d7d05dcf3a6b8dd sane-backends-1.0.16-r4.ebuild 4350
+MD5 97b164ed2bc6ddc5e3e7a99b06298747 sane-backends-1.0.16-r4.ebuild 4386
MD5 544c2bc7c5a23b2ae8280b879eac1fbb sane-backends-1.0.15-r2.ebuild 3912
MD5 4c8053c87e31c8209998ba49c07d60a5 sane-backends-1.0.13-r3.ebuild 1717
MD5 61d573be9593ba3be2da335586ac7eb2 sane-backends-1.0.16-r1.ebuild 3743
@@ -26,3 +26,4 @@ MD5 d5d1e4a4c8d3839c16329c105f2580d3 files/digest-sane-backends-1.0.16-r3 151
MD5 d5d1e4a4c8d3839c16329c105f2580d3 files/digest-sane-backends-1.0.16-r4 151
MD5 0bc1f6b8682b5585c8e87a325f983ade files/lide25.patch 5565
MD5 83640d1e7caa2aa50c676d40b64866c7 files/digest-sane-backends-1.0.15 157
+MD5 77ad69b7090299a5f758c15aef0ee513 files/sm3600usb.patch 7348
diff --git a/media-gfx/sane-backends/files/sm3600usb.patch b/media-gfx/sane-backends/files/sm3600usb.patch
new file mode 100644
index 000000000000..52909c42b1f5
--- /dev/null
+++ b/media-gfx/sane-backends/files/sm3600usb.patch
@@ -0,0 +1,291 @@
+--- backend/sm3600.c 3 Jul 2005 13:35:48 -0000 1.13
++++ backend/sm3600.c 16 Aug 2005 19:50:34 -0000 1.14
+@@ -55,24 +55,25 @@
+
+ ====================================================================== */
+
+-#include "sane/config.h"
++#include "../include/sane/config.h"
+ #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
+
+-#include <usb.h>
+-
+-#define BUILD 5
++#define BUILD 6
+
+ #ifndef BACKEND_NAME
+ #define BACKEND_NAME sm3600
+ #endif
+
+-#include "sane/sane.h"
+-#include "sane/sanei.h"
+-#include "sane/sanei_backend.h"
+-#include "sane/sanei_config.h"
+-#include "sane/saneopts.h"
++#include "../include/sane/sane.h"
++#include "../include/sane/sanei.h"
++#include "../include/sane/sanei_backend.h"
++#include "../include/sane/sanei_config.h"
++#include "../include/sane/saneopts.h"
++#include "../include/sane/sanei_usb.h"
++
++#undef HAVE_LIBUSB
+
+ /* prevent inclusion of scantool.h */
+ #define SCANTOOL_H
+@@ -326,7 +327,8 @@
+ }
+
+ static SANE_Status
+-RegisterSaneDev (struct usb_device *pdevUSB, TModel model, char *szName){
++RegisterSaneDev (TModel model, SANE_String_Const szName)
++{
+ TDevice * q;
+
+ errno = 0;
+@@ -342,7 +344,6 @@
+ q->sane.model = "ScanMaker 3600";
+ q->sane.type = "flatbed scanner";
+
+- q->pdev=pdevUSB;
+ q->model=model;
+
+ ++num_devices;
+@@ -351,13 +352,37 @@
+
+ return SANE_STATUS_GOOD;
+ }
++
++static SANE_Status
++sm_usb_attach (SANE_String_Const dev_name)
++{
++ int fd;
++ SANE_Status err;
++ SANE_Word v, p;
++ TModel model;
++
++ err = sanei_usb_open(dev_name, &fd);
++ if (err)
++ return err;
++ err = sanei_usb_get_vendor_product (fd, &v, &p);
++ if (err)
++ {
++ sanei_usb_close (fd);
++ return err;
++ }
++ DBG (DEBUG_JUNK, "found dev %04X/%04X, %s\n", v, p, dev_name);
++ model = GetScannerModel (v, p);
++ if (model != unknown)
++ RegisterSaneDev (model, dev_name);
++
++ sanei_usb_close(fd);
++ return SANE_STATUS_GOOD;
++}
+
+ SANE_Status
+ sane_init (SANE_Int *version_code, SANE_Auth_Callback authCB)
+ {
+- struct usb_bus *pbus;
+- struct usb_device *pdev;
+- int iBus;
++ int i;
+
+ DBG_INIT();
+
+@@ -372,38 +397,11 @@
+ }
+
+ pdevFirst=NULL;
+-
+- usb_init();
+- usb_find_busses();
+- if (!usb_busses)
+- return SANE_STATUS_IO_ERROR;
+-
+- usb_find_devices();
+-
+- iBus=0;
+- DBG(DEBUG_INFO,"starting bus scan\n");
+- for (pbus = usb_busses; pbus; pbus = pbus->next)
+- {
+- int iDev=0;
+- iBus++;
+- /* 0.1.3b no longer has a "busnum" member */
+- DBG(DEBUG_JUNK,"scanning bus %s\n", pbus->dirname);
+- for (pdev=pbus->devices; pdev; pdev = pdev->next)
+- {
+- TModel model;
+- iDev++;
+- DBG(DEBUG_JUNK,"found dev %04X/%04X\n",
+- pdev->descriptor.idVendor,
+- pdev->descriptor.idProduct);
+- model=GetScannerModel(pdev->descriptor.idVendor,
+- pdev->descriptor.idProduct);
+- if (model!=unknown)
+- {
+- char ach[100];
+- sprintf(ach,"%d/%d",iBus,iDev);
+- RegisterSaneDev(pdev,model,ach);
+- }
+- }
++
++ sanei_usb_init();
++ for (i = 0; aScanners[i].idProduct; i++)
++ {
++ sanei_usb_find_devices(SCANNER_VENDOR, aScanners[i].idProduct, sm_usb_attach);
+ }
+ return SANE_STATUS_GOOD;
+ }
+@@ -464,8 +462,11 @@
+ if (devicename[0]) /* selected */
+ {
+ for (pdev=pdevFirst; pdev; pdev=pdev->pNext)
++{
++DBG(DEBUG_VERBOSE,"%s<>%s\n",devicename, pdev->sane.name);
+ if (!strcmp(devicename,pdev->sane.name))
+ break;
++}
+ /* no dynamic post-registration */
+ }
+ else
+@@ -482,14 +483,11 @@
+ pinstFirst=this;
+ this->model=pdev->model; /* memorize model */
+ /* open and prepare USB scanner handle */
+- this->hScanner=usb_open(pdev->pdev);
+- if (!this->hScanner)
+- return SetError(this,SANE_STATUS_IO_ERROR, "cannot open scanner device");
+- rc=SANE_STATUS_GOOD;
+- if (usb_claim_interface(this->hScanner, 0))
+- return SetError(this,SANE_STATUS_IO_ERROR, "cannot claim IF");
+- if (usb_set_configuration(this->hScanner, 1))
+- return SetError(this,SANE_STATUS_IO_ERROR, "cannot set USB config 1");
++
++ if (sanei_usb_open (devicename, &this->hScanner) != SANE_STATUS_GOOD)
++ return SetError (this, SANE_STATUS_IO_ERROR, "cannot open scanner device");
++
++ rc = SANE_STATUS_GOOD;
+
+ this->quality=fast;
+ return InitOptions(this);
+@@ -505,8 +503,9 @@
+ {
+ if (this->state.bScanning)
+ EndScan(this);
+- usb_close(this->hScanner);
+- this->hScanner=NULL;
++
++ sanei_usb_close(this->hScanner);
++ this->hScanner=-1;
+ }
+ ResetCalibration(this); /* release calibration data */
+ /* unlink active device entry */
+--- backend/sm3600.h 30 Apr 2004 21:02:04 -0000 1.10
++++ backend/sm3600.h 16 Aug 2005 19:50:34 -0000 1.11
+@@ -190,7 +190,7 @@
+ TQuality quality;
+ TMode mode;
+ TModel model;
+- usb_dev_handle *hScanner;
++ int hScanner;
+ FILE *fhLog;
+ FILE *fhScan;
+ int ichPageBuffer; /* write position in full page buffer */
+--- backend/sm3600-scanusb.c 15 Apr 2004 21:06:58 -0000 1.11
++++ backend/sm3600-scanusb.c 16 Aug 2005 19:50:34 -0000 1.12
+@@ -43,7 +43,7 @@
+
+ Userspace scan tool for the Microtek 3600 scanner
+
+-$Id: sm3600-scanusb.c,v 1.11 2004/04/15 21:06:58 eichholz-guest Exp $
++$Id: sm3600-scanusb.c,v 1.12 2005/08/16 19:50:34 hmg-guest Exp $
+
+ (C) Marian Eichholz 2001
+
+@@ -68,14 +68,20 @@
+ int cchBuffer,
+ int cJiffiesTimeout)
+ {
+- return usb_control_msg(this->hScanner,
++ SANE_Status err;
++
++ cJiffiesTimeout = cJiffiesTimeout;
++
++ err = sanei_usb_control_msg (this->hScanner,
+ nReqType,
+ nRequest,
+ nValue,
+ nIndex,
+- pBuffer,
+ cchBuffer,
+- cJiffiesTimeout);
++ pBuffer);
++ if (err)
++ return err;
++ return cchBuffer;
+ }
+
+ /* **********************************************************************
+@@ -90,11 +96,18 @@
+ int cchMax,
+ int cJiffiesTimeout)
+ {
+- return usb_bulk_read(this->hScanner,
+- nEndPoint,
+- pBuffer,
+- cchMax,
+- cJiffiesTimeout);
++ int err;
++ size_t sz = cchMax;
++
++ nEndPoint = nEndPoint;
++ cJiffiesTimeout = cJiffiesTimeout;
++
++ err = sanei_usb_read_bulk(this->hScanner,
++ pBuffer,
++ &sz);
++ if (err)
++ return err;
++ return sz;
+ }
+
+ /* **********************************************************************
+@@ -310,7 +323,9 @@
+ {
+ rc=SetError(this,SANE_STATUS_IO_ERROR,
+ "bulk read of %d bytes failed: %s",
+- cchChunk,usb_strerror());
++ cchChunk,
++ "I/O error"
++ );
+ continue;
+ }
+ }
+@@ -371,7 +386,9 @@
+ else
+ rc=SetError(this,SANE_STATUS_IO_ERROR,
+ "bulk read of %d bytes failed: %s",
+- cchChunk,usb_strerror());
++ cchChunk,
++ "I/O error"
++ );
+ }
+ dprintf(DEBUG_COMM,"writing %d bytes\n",cchRead);
+
+--- backend/sm3600-scanutil.c 15 Apr 2004 21:06:58 -0000 1.11
++++ backend/sm3600-scanutil.c 16 Aug 2005 19:50:34 -0000 1.12
+@@ -43,10 +43,11 @@
+
+ Userspace scan tool for the Microtek 3600 scanner
+
+-$Id: sm3600-scanutil.c,v 1.11 2004/04/15 21:06:58 eichholz-guest Exp $
++$Id: sm3600-scanutil.c,v 1.12 2005/08/16 19:50:34 hmg-guest Exp $
+
+ ====================================================================== */
+
++#include <unistd.h>
+ #include "sm3600-scantool.h"
+
+ /* **********************************************************************
diff --git a/media-gfx/sane-backends/sane-backends-1.0.16-r4.ebuild b/media-gfx/sane-backends/sane-backends-1.0.16-r4.ebuild
index fb3837ac4340..ab7363d1074e 100644
--- a/media-gfx/sane-backends/sane-backends-1.0.16-r4.ebuild
+++ b/media-gfx/sane-backends/sane-backends-1.0.16-r4.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-gfx/sane-backends/sane-backends-1.0.16-r4.ebuild,v 1.1 2005/11/02 12:17:45 phosphan Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/sane-backends/sane-backends-1.0.16-r4.ebuild,v 1.2 2005/11/03 19:25:16 phosphan Exp $
inherit eutils flag-o-matic
@@ -89,6 +89,7 @@ src_unpack() {
fi
epatch ${FILESDIR}/lide25-r1.patch
epatch ${FILESDIR}/kernel2.6.13usb-problem.patch
+ epatch ${FILESDIR}/sm3600usb.patch
# trouble with -ffast-math, see bug #103118
for file in backend/matsushita.c backend/sceptre.c backend/leo.c \