Introduction

If you have a scanner that is not supported by Sane, there is a (slim) chance that it might be almost identical to another scanner that is already supported by sane. This is a relatively advanced process, but this tutorial will hopefully help you through. The example will use a specific scanner, but the principles should be generalizable to other scanners.

First, you need to gather some information about your scanner. Run:

sane-find-scanner -v -v

You should write down the usb vendor id and product id. These will be very important in this procedure. Also write down the chipset, if one is detected. Go to the Sane Project website and search the supported scanner section and the mailing list archives to find out as much information about your scanner as you can. You need to find out which sane backend your scanner could be added to. You can also do a web search using your scanner model and linux as search terms.

Warning

Your scanner could be damaged by this process. If you hear banging noises or grinding, unplug your scanner right away.

Example

In this example, we have a Xerox 2400 scanner. From Xerox webpage, we know that this is a flatbed scanner with a CCD sensor. From sane-find-scanner -v -v, we know the usb vid is 0x0461 and the usb pid is 0x038b. It has a genesys GL646 chip. From our research, we also observe that the vendor id is for a company called Primax. Primax sells some scanners under its own brand name, but a lot of their scanners are branded by other companies. By reading the sane mailing list, we learn that the genesys backend supports several chips, including the GL646, GL842, GL842 and GL847. We want to test the Xerox 2400 against another flatbed, CCD scanner that has a GL646 chip. There are a few that fit this description, including the Medion MD5345 and several HP scanners. We notice that the MD5345 also has a vid of 0x0461, so we will choose to test this scanner first. If it does not work, we can always repeat this process for the other scanners.

We are going to have to build sane from source and make some minor changes to a few lines of code using a text editor.

Let's download some sane dependencies and the source code.

sudo apt-get install libusb-dev build-essential libsane-dev
sudo apt-get install git-core
git clone git://git.debian.org/sane/sane-backends.git

Now, we are going to "hijack" the settings of the supported scanner. Most sane backends have a file where supported scanners are listed, with their associated usb id. In the genesys backend that file is called genesys_devices.c. We are going to open that file and change the usb id of the MD5345 to that of our Xerox. We will backup the files before we make any changes to them.

cp ~/sane-backends/backend/genesys_devices.c ~/genesys_devices.c_copy
gedit ~/sane-backends/backend/genesys_devices.c

At the very bottom of this file, there scanners are listed.

static Genesys_USB_Device_Entry genesys_usb_device_list[] = {
  {0x03f0, 0x0901, &hp2300c_model},
  {0x03f0, 0x0a01, &hp2400c_model},
  {0x03f0, 0x1405, &hp3670c_model},
  {0x0461, 0x0377, &medion_md5345_model},

On the forth line, we will change the 0x0377 to 0x038b and save.

Next, we will make a similar change to /etc/sane.d/genesys.conf

cp /etc/sane.d/genesys.conf ~/genesys.conf_copy
gksu gedit /etc/sane.d/genesys.conf

In the middle of the file you will find:

#
# supported scanners
#

# Medion MD5345/MD6228/MD6471
usb 0x0461 0x0377

# Hewlett Packard ScanJet 2300c
usb 0x03f0 0x0901

Change the 0x0377 to 0x038b. Save and close gedit. Now we are ready to build sane from source.

cd sane-backends
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make
sudo make install

Plug in scanner and try

sudo scanimage -L
scanimage -L

If your scanner is detected by one of these, try to scan something:

scanimage >image.pnm

If that works, try to scan using Xsane. Try different resolutions and color/greyscale/lineart modes.

Example #2, microtek scan maker 3800 4850

These scanners may be clones of the 3840 and 4800 scanners, which are supported by the sm3840 backend. Here is a quick and dirty way of testing this.

sudo apt-get install libusb-dev build-essential libsane-dev
sudo apt-get install git-core
git clone git://git.debian.org/sane/sane-backends.git

cp ~/sane-backends/backend/sm3840.c ~/sm3840.c_copy
gedit ~/sane-backends/backend/sm3840.c

On about line 619, you will find:

 /* If we get enough scanners should use an array, but for now */
  /* do it one-by-one... */
  sanei_usb_find_devices (0x05da, 0x30d4, add_sm3840_device);
  sanei_usb_find_devices (0x05da, 0x30cf, add_sm4800_device);

Change the 0x30d4 to 0x30ce for the sm3800 (or 0x30d9 for the sm4850). Save and close your text editor.

Next we are going to add this scanner to /etc/sane.d/sm3840.conf

sudo gedit /etc/sane.d/sm3840.conf

Add the following lines to this file

# Microtek ScanMaker 3800 ID
usb 0x05da 0x30ce

or

# Microtek ScanMaker 4850 ID
usb 0x05da 0x30d9

Save the file and exit gedit.

cd sane-backends
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make
sudo make install

Plug in scanner and try

sudo scanimage -L
scanimage -L

If your scanner is detected by one of these, try to scan something:

scanimage >image.pnm

Additional Comments

If you can scan with sudo, but not as user, you have a permission problem.

Please report any successes to the sane-devel mailing list. Someone there may be able to help you prepare a patch, so that your scanner can be included in the next release of Sane.


CategoryHardware

CheckIfScannerIsClone (last edited 2015-12-04 16:52:18 by cable-82-119-27-161)