Viceo Backend for SANE with libusb support

After many years of failure, countless hours of digging into the World Wide Web for information, numerous failed attempts due to lack of knowledge to modify the v0.6 E3 driver for USB scanners (Viceo backend) and add support for libusb, yesterday I was sent a patch, which contained the Viceo backend for SANE with libusb support. My old Primax Colorado 19200 USB scanner worked for the first time under Linux. If you own such an old scanner and care to make it work under a modern Linux distribution, read on for instructions and files.

It all happened when I stumbled upon Pat’s blog post (note: page is down) a couple of days ago, which gave me hope that someone had cared to modify the E3 USB scanner driver and make it work with libusb. I sent an email to Pat and received a patch (thanks a million!) for sane-backends-1.0.14. The patch did not work initially with today’s sane-backends-1.0.18, but this would not stop a determined soul from fixing it. Adding support for libusb was completely out of my league, but fixing that particular patch was definitely something I could deal with. It took me some hours, but, finally, I, not only had a patch that could be applied succesfully into the sane-backends-1.0.18 source, but also had a working Viceo backend for SANE, which means… a working scanner under Linux. I admit that I use the scanner rather rarely, but knowing that this piece of hardware can work under Linux is good.

Driver History

Here goes some brief history about the driver.

The E3 driver was initially developed by Steven Ellis (http://viceo.orcon.net.nz/). 0.6 was the last released version (2002), which lacked support for libusb. It seems that Steven abandoned the development of the driver at that point. Until a few days ago, the 0.6 release was what I had considered as the latest available version of the E3 driver.

What I missed, was the fact that Jimmy Nguyen had modified the 0.6 driver and had added support for libusb. I had spent countless hours searching the web in the past but I could not locate such a release of the driver. Anyhow, Jimmy’s patch was released in 2004 for sane-backends-1.0.14.

The rest has been already described above.

Supported Devices

This driver works with USB scanners equipped with the E3 chipset. Some of these scanner models (if not all) are the following:

  • Genius Vivid Pro USB
  • Primax Colorado USB 19200
  • Visioneer OneTouch 7600
  • Visioneer OneTouch 6100
  • IBM IdeaScan 2000 USB
  • LG Electronics Scanworks 600U

Download

I have modified the original patch in order to make it work with sane-backends-1.0.18 and also wrote a SPEC file for RPM packaging. Using a package will greatly simplify the installation procedure.

Here follows a list of files you can download:

RPM – sane-backends-viceo-1.0.18-0.7-rcnst.1.i386.rpm
RPM package of Viceo backend. Requires sane-backends-1.0.18. Installs the Viceo backend only and will not touch any other files. Please read the Installation and Configuration sections for instructions.
DEB – TODO
A DEB file for debian-based distributions is not currently available. You can still generate a deb package from the RPM using alien. In order to convert the the RPM package to a DEB, use alien like: alien -k sane-backends-viceo-1.0.18-0.7-rcnst.1.i386.rpm and a deb package will be generated for you. You can install the DEB package with: dpkg -i sane-backends-viceo-1.0.18-0.7-rcnst.1.i386.deb. Please note that this procedure has not been tested.
SPEC – viceo.spec
Required if you need to build the RPM package.
Patch – sane-backends-1.0.18-viceo.diff.gz
New Viceo backend patch for sane-backends 1.0.18. Note, that in addition to the required modifications in order to make this patch suitable for sane-backends-1.0.18, this diff does not include the modifications of the core SANE file sanei/sanei_usb.c. Everything seems to work just fine without having to patch any core SANE file.
Patch – viceoDriver4Sane1.0.14.tar.gz
Old package with Viceo patch for sane-backends 1.0.14 and some notes by Jimmy Nguyen about the release. Reading them is recommended.

All versions are available from the development web site’s download area.

Installation

Using the RPM or DEB package (see above for info) is the recommended method of installing. This package has been built in Fedora 8, but, since it is rather generic and does not contain any Fedora-specific information, it should work on any RPM-based distribution.

Using the RPM

The package sane-backends-1.0.18 is a dependency. Make sure you have installed it.

# wget http://www.codetrax.org/attachments/download/42/sane-backends-viceo-1.0.18-0.7-rcnst.1.i386.rpm
# rpm -ivh sane-backends-viceo-1.0.18-0.7-rcnst.1.i386.rpm

Please make sure you read the Configuration section for instructions on how to setup the scanner.

Manual installation

This information has been written with as much detail as possible, if you still have questions, please use the forums.

Note: The compilation of the backend should be performed by a regular user and not root.

First, download and extract the required packages. Although the sane-backends-1.0.18 package is used, we will only use it in order to build the Viceo backend.

$ wget ftp://ftp.sane-project.org/pub/sane/sane-backends-1.0.18/sane-backends-1.0.18.tar.gz
$ tar -xzf sane-backends-1.0.18.tar.gz
$ wget http://www.codetrax.org/attachments/download/41/sane-backends-1.0.18-viceo.diff.gz
$ gunzip sane-backends-1.0.18-viceo.diff.gz

Patch the sane-backends source code:

$ patch -p1 -b -d sane-backends-1.0.18/ < sane-backends-1.0.18-viceo.diff

Change to the sane-backends source code top-directory:

$ cd sane-backends-1.0.18/

We only care to build the Viceo backend, so set the BACKENDS environment variable to “viceo“.

$ export BACKENDS=viceo

Compile the backend:

$ ./configure --prefix=/usr --sysconfdir=/etc
$ make

We perform an installation in a temporary directory (1_test_install). This will help you pick up the correct files for the manual installation later. Also, you do not need root privileges for this.

$ mkdir 1_test_install
$ make DESTDIR="$PWD/1_test_install" install

Now, SANE and the viceo backend have been temporarily installed in the 1_test_install/ directory.

The following actions need to be performed by root or you can use sudo.

Make sure that sane-backends has been installed using your distribution’s package manager. Then copy the following files to the proper locations:

# cp 1_test_install/etc/sane.d/{e1.ini,lut.plg,viceo.conf} /etc/sane.d/
# cp 1_test_install/usr/lib/sane/libsane-viceo.so.1.0.18 /usr/lib/sane/

Finally, create a needed symbolic link to libsane-viceo.so.1.0.18.

# ln -s /usr/lib/sane/libsane-viceo.so.1.0.18 /usr/lib/sane/libsane-viceo.so.1

Update the library database. Run:

# ldconfig

That will be it.

SANE Configuration

The scanner configuration needs to be performed by root or you need to use sudo
The first thing to do is to add the viceo backend in /etc/sane.d/dll.conf. Note that the RPM will not do this, so you need to perform this step manually. Either add the work “viceo” (without quotes) at the end of /etc/sane.d/dll.conf or use the following command:

# echo "viceo" >> /etc/sane.d/dll.conf

If your scanner is not connected, please do so now.

Run the following command:

# sane-find-scanner

Your scanner should be identified:

[...]
found USB scanner (vendor=0x0461 [Primax], product=0x0360 [Colorado USB 19200]) at libusb:002:003
[...]

Take a note of the vendor and product codes and add a line using the following format to /etc/sane.d/viceo.conf:

usb <vendor> <product>

For me, that line inside /etc/sane.d/viceo.conf should be:

usb 0x0461 0x0360

Now list the available imaging devices. You scanner should be listed:

# scanimage -L

And this was the device listing:

device `viceo:usb 0x0461 0x0360' is a Visioneer Genius ColorPage-Vivid Pro USB flatbed scanner

Scanning

You can use the scanner either from the command-line or from within GIMP, provided that you have installed the xsane-gimp package.

If you use the scanner from the command line, wherever a device name is needed, use the device name that scanimage -L lists. For example:

# scanimage -d "viceo:usb 0x0461 0x0360" --mode Color --format=tiff --resolution 200 > z_out.tiff

Alternatively, you can set the following environment variable:

# export SANE_DEFAULT_DEVICE="viceo:usb 0x0461 0x0360"

Please read the SANE documentation for more information.

Licensing

The viceo backend is accompanied by two files which were included in the drivers for Windows, e1.ini and lut.plg. Although, you, as the owner of the hardware may use these files since you have paid for them, it is unclear whether there is a problem or not with distributing these files separately from the Windows driver package. The fact that these files are available from the home of the E3 driver v0.6, and are also included in sane-backends-1.0.14-viceo.diff, has led me to the conclusion that there is no problem in distributing these files. So, they are included in the my modified patch and RPM package. Please note that the aforementioned files e1.ini and lut.plg have neither been released nor distributed under the terms of a free license, eg GPL, so they are not free software.

Conclusion

Although the scanner is pretty old, it performs quite well. The driver won’t let you use resolutions over 600dpi, but I guess this is acceptable.

This article has been written in a fast pace. I have tried to provide as much detail as possible. If you still need help, please use our forums for your questions.

Happy scanning!

Viceo Backend for SANE with libusb support by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2008 - Some Rights Reserved

George Notaras avatar

About George Notaras

George Notaras is the editor of the G-Loaded Journal, a technical blog about Free and Open-Source Software. George, among other things, is an enthusiast self-taught GNU/Linux system administrator. He has created this web site to share the IT knowledge and experience he has gained over the years with other people. George primarily uses CentOS and Fedora. He has also developed some open-source software projects in his spare time.

19 responses on “Viceo Backend for SANE with libusb support

  1. flavio Permalink →

    Thank you for this effort to help support these old scanners. I was very excited to find your page.

    I installed the rpm via alien on my ubuntu box but the direver does not seem to work.

    sane-find-scanner gives the following output:
    found USB scanner (vendor=0x0458, product=0x2001) at libusb:003:003

    but scanimage -L does not recognize the scanner

    I tried also compiling from scratch according to your instructions but it didn’t help either…

    my scanner is a genius colorpage-vivid pro USB model FU614D
    I am on ubuntu gutsy

    any hints on how to debug this?

  2. George Notaras Post authorPermalink →

    Hello Flavio,

    just a few days ago I was informed about the DEB not working with Ubuntu 7.10. This is because this Ubuntu version includes a CVS version (1.0.19 unstable) of sane-backends and not sane-backends v1.0.18, which has been used in order to create the initial RPM package. Please note that the package is actually named libsane in Ubuntu.

    The solutions to this problem are:

    1) to download the source of the CVS version with:

    apt-get source libsane

    then try to apply the patch to the source and continue with the manual installation. This would work, but my patch does not apply correcty to this source code at the current time. It needs some adjustments for sane-backends-1.0.19. I will make these modifications as soon as I find some free time. So, this is not a solution at the moment…

    2) The second workaround is to manually compile sane-backends-1.0.18 in your home directory and set some environment variables so that the system finds and uses your custom installation of the sane-backends.

    I had posted the following instructions in a greek forum a few days ago and it was reported that this workaround works for Ubuntu Gutsy.

    The following steps are described in detail, so that even a non experienced Ubuntu user can perform the manual unstallation. If any user has further questions, please feel free to post a comment.

    i) Download sane-backends-1.0.18 and the patch and follow the steps of the “manual installation” described in the above article until the step:

    make DESTDIR="$PWD/1_test_install" install

    Make sure you also issue that last command above. After issuing it, follow the rest of the installation instructions here:

    ii) Without changing directory, issue the command:

    pwd

    iii) pwd will print the current directory path to the stdout. Substitute XXX with that path in the commands below:

    export MY_SANE_DIR=ΧΧΧ/1_test_install
    export PATH=$MY_SANE_DIR/usr/bin:$PATH
    export LD_LIBRARY_PATH=$MY_SANE_DIR/usr/lib:$LD_LIBRARY_PATH
    

    By setting the above environment variables the system is able to find your custom installation of SANE and use it for scanning. They are absolutely safe.

    iv) Without changing directory, copy the configuration files to /etc/sane.d/

    cp 1_test_install/etc/sane.d/e1.ini /etc/sane.d/
    cp 1_test_install/etc/lut.plg /etc/sane.d/
    cp 1_test_install/etc/viceo.conf /etc/sane.d/
    

    Finally, perform the configuration of the viceo backend in /etc/sane.d/ as it has been described in the article.

    If your scanner is supported, scanimage -L should list your scanner and you should be able to scan from within GIMP.

    You can also insert the above three “export” statements in ~/.bash_profile, so that you do not have to write them every time you log in.

    Hope this works.

  3. perc Permalink →

    Hello George,

    Thanks for taking time in doing this project.

    Anyway, I’ve spent at least a whole day (dial-up) trying to make sense out of the conflicting packages/versions in Gutsy repo, as well as the sources found in Sourceforge. I still need further clarification regarding certain things. Following solution no. 2,

    1.) which do I compile, sane-backends-1.0.18 (sourceforge version) or sane-backends_1.0.18.orig.tar.gz (http://es.archive.ubuntu.com/ubuntu/pool/main/s/sane-backends)?
    2.) If I am to take sane-backends source from ubuntu, do I need to rename my source to libsane.xxx, or to the filename preferred in your instruction?

    [ If this seem too elementary to most… sorry, I’m just a newbie, but I’ll get better. ;) ]

    Thanks.

  4. Mark Morgan Lloyd Permalink →

    Nice clear build instructions but I’m afraid the symlink’s the wrong way round.

    Segfaults on SPARC but that’s my fault for trying an uncomon CPU. I’m scratching around to see what I’ve got based on x86.

    — MarkMLl

  5. Mark Morgan Lloyd Permalink →

    Now working nicely locally, but trying to network it is a bit more of a problem. Work continues here but please note that I’m no guru so “your mileage may vary” :-)

    Once the driver is working one is likely to find that this

    # scanimage -d ‘viceo:usb 0x0461 0x0360’ >/dev/null

    works as root, but not as an unprivileged user. What’s more, this format isn’t accepted by xsane (etc.) attempting to work across a LAN, which wants something like

    $ scanimage -d ‘net:localhost:viceo:/dev/usb/scanner0’ >/dev/null

    if udev etc. has been set up to detect when the scanner is plugged in, otherwise something like

    $ scanimage -d ‘net:localhost:viceo:/dev/.static/dev/usb/scanner0’ >/dev/null

    In both these cases there might be additional problems if saned is running as a user.group which doesn’t have unrestricted access to the scanner device.

    There’s an obvious inetd hack which experienced users might like to try with due consideration to the security implications, but the correct way to tackle the problem is to get device node security right which I think implies udev hacking.

    — MarkMLl

  6. George Notaras Post authorPermalink →

    Thanks for posting this info about using the scanner over the network. Unfortunately, I’ve never used it in such a way, so I have no clue about the resolution of any issues.

    But, this sounds like a cool idea and I might try it myself.

  7. Robert Brijder Permalink →

    Great work.

    Some time ago I invested quite some time to modify the linux GPL driver of the E3 chip found on

    [Moderated: Link removed as per the new comment policy]

    in order to make it work using USB (this one uses parallel port). I had success on my Primax Colorado USB 19200. However, my code is messy and only works through the scanimage command. It is actually not really usable right now, and unfortunately I don’t have anymore time to work on it…

    Anyway, good job!

  8. Paul Goodliffe Permalink →

    Running on Fedora 10. de-installed sane-backends-1.0.19.12 using yumex, noted the package dependencies that were also deinstalled, downloaded old version of sane-backends-1.0.18, installed by following instructions above, re-installed sane-backends-1.0.19 and the other packages that had been removed, and tried it in gimp. Worked first time.

  9. Paul Goodliffe Permalink →

    You, Sir, are a gentleman and a scholar. Thank you for the work you have put in and for the easy-to-follow instructions. It worked first time for me, I’ve been trying for a long time to get this scanner working. (Primax Colorado 19200 USB).

    Best wishes.

  10. George Notaras Post authorPermalink →

    @Paul: Thanks a lot for the feedback about Fedora 10. Very useful information. As soon as I find some free time I will organize things better here. I am glad this information has been useful to you. Best regards.

  11. Mark Morgan Lloyd Permalink →

    On Debian x86 “Lenny” the driver may crash when

    # scanimage -L

    is run. A workaround is to create a dummy preferences file /etc/sane.d/e1.ini assuming a standard layout.

    George, if you’re still maintaining this I suggest you check the fclose()s in windows.c: I’m told that fclose(NULL) is implementation-defined.

    — MarkMLl

  12. Markus Permalink →

    Thanks a lot for the nice step by step guide.
    It works for my Visioneer 6100 (old, but still nice)

    I’m using debian lenny, and the “alien rpm…” did not work for me, instead I compiled and installed the backend with checkinstall.

    In case anybody wants to giveit a try (its a great way if you did not install the libsane deb):

    checkinstall is an amazing tool, it creates a .deb package from a source dir (using make/make install)
    All you have to do is the ./configure step, then make, then execute “checkinstall” in the same dir, and it builds a deb which you can easily remove in case you want to. (checkinstall ~= make install for debian)

    Atm scanning only works as root, but I’ll check that later.

    Thanks for your guide !

  13. Stefan Permalink →

    Hi,

    I was desperately looking for information like this. Unfortunately when trying to acces http://www.codetrax.org/attachments/download/41/sane-backends-1.0.18-viceo.diff.gz I get this message:
    “The web site is temporarily unable to service your request due to scheduled maintenance downtime.
    Please, check back in a few minutes… ”

    I have searched the web for sane-backends-1.0.18-viceo.diff.gz but was not able to find it. Could anyone supply me with a link to a copy of it? Any help is really appreciated.
    Thanks for this Guide!

  14. George Notaras Post authorPermalink →

    @Stefan: I am sorry for the inconvenience. CodeTRAX will be back online really soon.

    Temporary file location:

    [Update: Oct 25 2009]

    All files are available again.

  15. Angelo Permalink →

    hello, does this work on ubuntu 10.10? I coould give it a try… Although i haven’t understood the difference between the instructions in the article and the ones from the comments.

  16. Tom Permalink →

    Has anybody got this working with an IBM IdeaScan 2000?

    I can get it detected, and scanimage -L gives:
    device `viceo:usb 0x04b3 0x7512′ is a Visioneer Unknown Scanner – Update viceo.c flatbed scanner
    after I have updated viceo.conf, but don’t know what to update in viceo.c, and then when I run scanimage -d 'viceo:usb 0x04b3 0x7512' ... it just stalls for me.

  17. RT Permalink →

    Great instructions! Got this running on Ubuntu 12.04 in about 30 minutes. Manual install worked perfectly. Visoneer OneTouch 7600USB. The very first scan with resolution 200 was completely blank…maybe it just wasn’t warmed up, but 100, 300, 600 all worked great!
    I love the internet!