plustek@linuxhacker.org

plustek@linuxhacker.org


Subject: Mandriva 2005LE and plustek_pp - How to fix
From: Andreas Funke
Date: Sat, 25 Jun 2005 22:35:04 -0400

I have found 2 problems regarding the abovementioned backend in Mandriva 2005 LE (Mandrake
10.2), and they affect both the "direct" and "kernel module" access methods to my parallel
port scanner (a BrightScan OptiPro, which is a rebadged Plustek PT12):

1. Scanning never takes place unless I set warmup time to 0 (zero) seconds. The last
line in the debug output is related to the warmup time (the program seems unable to
perform a simple countdown starting at any number of seconds!);

2. The scanner "hangs" unpredictably after scanning some pages, or particularly when
the current settings result in big output files (bigger than 2 or 3MB).

3. Compiling the kernel module fails due to the new gcc 3.4.3 (the "inline" functions
result in an unrecoverable compilation error).

Well, after scanning the archives of this mailing list, and experimenting myself with
the source code of the backend, I found out how to get this backend to function properly
with Mandriva 2005 LE:

1. Visit any download mirror of Mandriva, and browser the FTP directory structure until
you find the source rpm for sane. Save it to your computer:

sane-1.0.15-7mdk.src.rpm

2. Become root (type "su" in a terminal) and install the source rpm:

rpm -ivh sane-1.0.15-7mdk.src.rpm

3. Change to the sources directory:

cd /usr/src/RPM/SOURCES

4. Unpack the sane-backends source code:

tar -jxvf sane-backends-1.0.15.tar.bz2

5. Enter the backend source code subdirectory:

cd sane-backends-1.0.15/backend

6. In order to fix the GCC 3.4.3 compilation error, edit the file plustek-pp_procs.h
and modify line 81:

from
# define _INL   inline
to
# define _INL

7. In order to fix the timer (warmup) problem, and possibly the "hang" problem in the
motor driver with particular scanning settings or file sizes, edit the file "plustek-pp_misc.c"
and modify the following lines:

Line 604
From 
_LOC _INL void MiscStartTimer( pTimerDef timer , unsigned long us)
to
_LOC void MiscStartTimer( pTimerDef timer , unsigned long us)

Line 623
From
_LOC _INL int MiscCheckTimer( pTimerDef timer )
to
_LOC int MiscCheckTimer( pTimerDef timer )

8. Don't forget to save changes to the edited files

9. Change again to the SOURCES directory:
/usr/src/RPM/SOURCES

10. Remove the old sane-backend source tarball:
rm -f sane-backends-1.0.15.tar.bz2

11. Recreate it from the modified source code:
tar -jcvf sane-backends-1.0.15.tar.bz2 sane-backends-1.0.15

12. Rebuild the binary as well as the source packages:
rpmbuild -ba /usr/src/RPM/SPECS/sane.spec

13. After the build process is complete, reinstall your libsane1 and sane-backends packages
from the newly compiled binaries, for your apropriate architecture, located at 
/usr/src/RPM/RPMS

For example, the binaries for my Pentium4 machine were created at:
/usr/src/RPM/RPMS/i586

In order to reinstall them, I have first removed the old packages with "rpm -e --nodeps
sane-backends libsane1" and then reinstalled them from the location above ("rpm -Uvh
libsane1-1.0.15-7mdk.i586.rpm sane-backends-1.0.15-7mdk.i586.rpm")

14. Restore sane configuration files from the "rpmsave" files:

cp -f /etc/sane/dll.conf.rpmsave /etc/sane/dll.conf
cp -f /etc/sane/plustek_pp.conf.rpmsave /etc/sane/plustek_pp.conf

15. First test the scanner with "option warmup 0" and then try another warmup values.
It should work now. 

__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register

Netscape. Just the Net You Need.

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp

plustek@linuxhacker.org