Difference between revisions of "SANE (简体中文)"

From ArchWiki
Jump to: navigation, search
(Update category)
(Sync to latest English version.)
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
[[Category:Imaging (简体中文)]]
 
[[Category:Imaging (简体中文)]]
[[Category:HOWTOs (简体中文)]]
+
[[en:Sane]]
[[Category:简体中文]]
+
[[es:Sane]]
{{i18n|Sane}}
+
[[fr:Sane]]
 +
{{Translateme (简体中文)}}
 +
{{Article summary start|Summary}}
 +
{{Article summary text|Installing and configuring Sane}}
 +
{{Article summary heading|Related}}
 +
{{Article summary wiki|Scan print and save Script}}
 +
{{Article summary end}}
  
== 介绍 ==
+
Sane provides a library and a command-line tool to use scanners under GNU/Linux.
Sane提供GNU/Linux下使用扫描仪的库文件及命令行工具。
+
[http://www.sane-project.org/sane-supported-devices.html Here] you can check if sane supports your scanner.
  
== 第一步:检查sane是否支持您的扫描仪 ==
+
== Installation ==
参照这个链接 http://www.sane-project.org/sane-supported-devices.html 。
+
[[pacman|Install]] {{Pkg|sane}} from the [[official repositories]].
  
== 第二步:安装 ==
+
== Configuration ==
sane已经被存放到extra仓库中,可以直接运行:<br>
+
Now you can try to see if sane recognizes your scanner
'' #pacman -S sane ''
+
$ scanimage -L
 +
If that fails, check that your scanner is plugged into the computer. You also might have to unplug/plug your scanner for {{ic|/etc/udev/rules.d/sane.rules}} to recognize your scanner.
  
== 第三步:设置 ==
+
Now you can see if it actually works
用户必须被加到scanner组中才能使用扫描仪。使用gpasswd命令:<br>
+
$ scanimage --format=tiff > test.tiff
'' #gpasswd -a username scanner '' <br>
+
''' 注意:您必须重新登录使改动生效 ''' <br>
+
然后您可以试着看看sane是否识别了您的扫描仪,使用:<br>
+
'' #scanimage -L '' <br>
+
''' 注意:有的用户可以需要CUPS服务,请注意检查CPUS是否开启。有关CPUS的具体内容请参照相关WIKI。 ''' <br>
+
如果失败,请检查扫描仪和电脑的线路是否完好。您也可能需要重新接入扫描仪以便/etc/udev/rules.d/sane.rules识别您的扫描仪。<br>
+
''' 注意:如果是HP的硬件您也可能需要安装extra仓库中的hplip包: ''' <br>
+
'' #pacman -S hplip '' <br>
+
别忘记在/etc/sane.d/dll.conf中启用hpaio。以root方式运行hp-setup可能会方便您添加设备。<br>
+
  
== 第四步:固件 ==
+
=== For HP hardware ===
''' 注意:如果您需要加载固件到扫描仪上,才需要阅读部分文档。 '''
+
For HP hardware you may also need to install {{Pkg|hplip}} from the [[official repositories]] and/or {{AUR|hpoj}} from the [[Arch User Repository|AUR]].
  
=== 取得固件 ===
+
* Uncomment or add {{Ic|hpaio}} and {{Ic|hpoj}} to a new line in {{ic|/etc/sane.d/dll.conf}}.
''' 注意:如果您没有安装CD,您需要从扫描仪供应商网站上取得必须的驱动程序。 ''' <br>
+
* Running {{Ic|hp-setup}} as root may help you add your device.
提取扫描仪安装CD中的文件,固件通常是.bin后缀名。<br>
+
* {{Ic|hp-plugin}} is the 'HPLIP Plugin Download and Install Utility'.
但它也可能在:<br>
+
* {{Ic|hp-scan}} is the 'HPLIP Scan Utility'.
*.exe文件中;在这个例子中可能是zip压缩文件,安装和运行unzip可以找出它。<br>
+
For Hewlett-Packard OfficeJet, PSC, LaserJet, and PhotoSmart printer multi-function peripherals, run ptal-init setup as root and follow instructions:
*.cab文件中;安装和运行cabextract解压它。<br>
+
# ptal-init setup
 +
Then start the '''ptal-init''' daemon.
  
=== 安装固件 ===
+
=== For Brother hardware ===
首先您需要将固件放置到安全的位置,推荐放到/usr/share/sane的子目录下。<br>
+
In order to install a Brother Scanner or Printer/Scanner Combo you need the right driver (which can be found in the AUR).
然后您需要告诉sane固件的位置:<br>
+
There are only four drivers to choose from (brscan1-4).  In order to find the right one you should search for your model at the [http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/download_scn.html brother linux scanner page].
*在sane支持设备列表http://www.sane-project.org/sane-supported-devices.html 中找到您的扫描仪后端程序名称。<br>
+
*打开/etc/sane.d/<backend-name>.conf文件。<br>
+
*请确保固件入口未被注释,及文件路径正确的指向了您扫描仪的固件文件。还有scanner组的成员都能访问/etc/sane.d/<backend-name>.conf文件。
+
  
== 第五步:安装前端 ==
+
After you installed the driver you need to run
Xsane为Sane提供基于GTK的前端。在extra仓库中可以找到它:<br>
+
# /usr/local/Brother/sane/setupSaneScan1 -i
'' #pacman -S xsane '' <br>
+
还有其他的前端可以使用,您可以通过以下方法找到它们:<br>
+
*使用pacman -Ss 以 ”sane” 或者 “scanner” 作为关键字寻找。<br>
+
*在sane-project的网站上查看前端列表http://www.sane-project.org/sane-frontends.html
+
  
== 疑难解答 ==
+
so the drivers/scanner are recognized by sane.
''' Invalid argument ''' <br>
+
 
如果您遇到 ”Invalid argument” 的错误提示,可能需要安装固件。参照上面的详细说明。<br>
+
For network scanners, Brother provides a configuration tool:
''' 权限问题 ''' <br>
+
$ brsaneconfig2 -a name=<ScannerName> model=<ScannerModel> ip=<ScannerIP>
如果您只能在执行”sudo lsusb”时看到扫描仪,您需要加入您的用户到lp组。<br>
+
Example:
'' #gpasswd -a username lp '' <br>
+
$ brsaneconfig2 -a name=SCANNER_DCP770CW model=DCP-770CW ip=192.168.0.110
''' Dbus 问题 ''' <br>
+
 
如果您遇到下列错误:<br>
+
=== For Epson hardware ===
arguments to dbus_connection_send() were incorrect, assertion “connection != NULL” failed in file dbus-connection.c<br>
+
For Wi-Fi and/or network scanners, you can use "Image Scan! for Linux".
将dbus用户加入到lp,scanner组<br>
+
 
'' #gpasswd -a dbus lp '' <br>
+
Install {{AUR|iscan}} and {{AUR|iscan-plugin-network}} from the [[AUR]], then update {{ic|/etc/sane.d/epkowa.conf}} and add the line:
'' #gpasswd -a dbus scanner '' <br>
+
net {IP_OF_SCANNER}
 +
 
 +
=== For Samsung hardware ===
 +
For some Samsung MFP printers you may need to edit /etc/sane.d/xerox_mfp.conf.
 +
 
 +
example entry:
 +
#Samsung SCX-3200
 +
usb 0x04e8 0x3441
 +
 
 +
Change the printer model as needed.  You can get the ipVendor and idProduct code with lsusb.  See [https://bbs.archlinux.org/viewtopic.php?id=123934 this thread].
 +
 
 +
=== For plustek scanners ===
 +
Some plustek scanners (noticeably Canoscan ones), require a lock directory. Make sure that /var/lock/sane directory exists, that its permissions are 660, and that it is owned by <user>:scanner. If the directory permissions are wrong, only root will be able to use the scanner. Seems (at least on x86-64) that some programs using libusb (noticeably xsane and kooka) need scanner group rw permissions also for accessing /proc/bus/usb to work for a normal user.
 +
 
 +
==Firmware==
 +
{{Note|This section is only needed if you need to upload firmware to your scanner.}}
 +
 
 +
Firmwares usually have the '''{{Ic|.bin}}''' extension.
 +
 
 +
Firstly you need to put the firmware someplace safe, it is recommended to put it in a subdirectory of {{ic|/usr/share/sane}}.
 +
 
 +
Then you need to tell sane where the firmware is:
 +
*Find the name of the backend for your scanner from the [http://www.sane-project.org/sane-supported-devices.html sane supported devices list].
 +
*Open the file {{ic|/etc/sane.d/<backend-name>.conf}}.
 +
*Make sure the firmware entry is uncommented and let the file-path point to where you put the firmware file for your scanner. Be sure that members of the group {{Ic|scanner}} can access the {{ic|/etc/sane.d/<backend-name>.conf}} file.
 +
 
 +
If the backend of your scanner is not part of the sane package (such as hpaio.conf which is part of hplip), you need to uncomment the relevant entry in /etc/sane.d/dll.d/hplip.
 +
 
 +
==Install a frontend==
 +
XSane provides a GTK-based frontend to Sane. It is available in the {{Ic|extra}} repository.
 +
# pacman -S xsane
 +
{{Note|Scanning directly to pdf using Xsane in 16bit color depth mode is known to produces [https://bugs.launchpad.net/ubuntu/+source/xsane/+bug/539162 corrupted files]. 8bit mode should work.}}
 +
 
 +
Other frontends exist, to find them you can:
 +
*use {{Ic|pacman -Ss}} to search for keywords such as "sane" or "scanner"
 +
*see the [http://www.sane-project.org/sane-frontends.html list of frontends] on the sane-project website
 +
 
 +
==Network scanning==
 +
==== Sharing Your Scanner Over a Network ====
 +
 
 +
You can share your scanner with other hosts on your network who use sane, xsane or xsane-enabled Gimp. To set up the server, first indicate which hosts on your network are allowed access.
 +
 
 +
Change the {{ic|/etc/sane.d/saned.conf}} file to your liking, for example:
 +
# required
 +
localhost
 +
# allow local subnet
 +
192.168.0.0/24
 +
 
 +
Ensure xinetd is installed:
 +
# pacman -S xinetd
 +
 
 +
Next, make sure the a file called {{ic|/etc/xinetd.d/sane}} exists and disabled is set to no:
 +
service sane-port
 +
{
 +
    port        = 6566
 +
    socket_type = stream
 +
    wait        = no
 +
    user        = root
 +
    group      = scanner
 +
    server      = /usr/sbin/saned
 +
    disable    = no
 +
}
 +
 
 +
Add the following line to {{ic|/etc/services}}:
 +
sane-port 6566/tcp
 +
 
 +
Start the '''xinetd''' [[daemons|daemon]].
 +
 
 +
Your scanner can now be used by other workstations, across your local area network.
 +
 
 +
==== Accessing Your Scanner from a Remote Workstation ====
 +
You can access your network-enabled scanner from a remote Arch Linux workstation.
 +
 
 +
To set up your workstation, begin by installing xsane:
 +
# pacman -S xsane
 +
 
 +
Next, specify the server's host name or IP address in the {{ic|/etc/sane.d/net.conf}} file:
 +
# static IP address
 +
192.168.0.1
 +
# or host name
 +
stratus
 +
 
 +
Now test your workstation's connection, from a non-root login prompt:
 +
$ xsane
 +
 
 +
or
 +
$ scanimage -L
 +
 
 +
After a short while, xsane should find your remote scanner and present you with the usual windows, ready for network scanning delight!
 +
 
 +
For HP All in one network printer/scanner/fax you need to configure it via:
 +
$ hp-setup <printer ip>
 +
 
 +
==Troubleshooting==
 +
===Invalid argument===
 +
If you get an "Invalid argument" error with xsane or another sane front-end, this could be caused by one of the following reasons:
 +
 
 +
==== Missing firmware file ====
 +
No firmware file was provided for the used scanner (see above for details).
 +
 
 +
==== Wrong firmware file permissions ====
 +
The permissions for the used firmware file are wrong. Correct them using
 +
# chown root:scanner /usr/share/sane/SCANNER_MODEL/FIRMWARE_FILE
 +
# chmod ug+r /usr/share/sane/SCANNER_MODEL/FIRMWARE_FILE
 +
 
 +
==== Multiple backends claim scanner ====
 +
It may happen, that multiple backends support (or pretend to support) your scanner, and sane chooses one that doesn't do after all (the scanner won't be displayed by scanimage -L then). This has happend with older Epson scanners and the <code>epson2</code> resp. <code>epson</code> backends. In this case, the solution is to comment out the unwanted backend in <code>/etc/sane.d/dll.conf</code>. In the Epson case, that would be to change
 +
 
 +
  epson2
 +
  #epson
 +
 
 +
to
 +
 
 +
  #epson2
 +
  epson
 +
 
 +
===Slow startup===
 +
If you encounter slow startup issue (e.g. xsane or scanimage -L take a lot to find scanner) it may be that more than one driver supporting it is available.
 +
 
 +
Have a look at /etc/sane.d/dll.conf and try commenting out one (e.g. you may have epson, epson2 and epkowa enabled at the same time, try leaving only epson or epkowa uncommented)
 +
 
 +
===Permission problem===
 +
If you see your scanner only when running {{Ic|lsusb}} (as root), you might get it working by adding your user to {{Ic|scanner}} and/or {{Ic|lp}} group.
 +
# gpasswd -a username scanner
 +
# gpasswd -a username lp
 +
This is reported to work on HP all-in-one models (e.g., PSC 1315 and PSC 2355).
 +
 
 +
You can also try to change permissions of usb device but this is not recommended, a better solution is to fix the Udev rules so that your scanner is recognized.
 +
 
 +
Example:
 +
 
 +
First, as root, check connected usb devices with {{ic|lsusb}}:
 +
#Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 +
#Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 +
#Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 +
#Bus 003 Device 003: ID 04d9:1603 Holtek Semiconductor, Inc.
 +
#Bus 003 Device 002: ID 04fc:0538 Sunplus Technology Co., Ltd
 +
#Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 +
#Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 +
#Bus 001 Device 006: ID 03f0:2504 Hewlett-Packard
 +
#Bus 001 Device 002: ID 046d:0802 Logitech, Inc. Webcam C200
 +
#Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 +
 
 +
In our example we see scanner - ''''Bus 001 Device 006: ID 03f0:2504 Hewlett-Packard''''
 +
 
 +
Now edit {{ic|/lib/udev/rules.d/53-sane.rules}} and look for the first part of the ID number found previously and check if there is a line that also reports the second part of the number (model numer), in this example 2504. If not found change or copy a line and enter the idVendor and idProduct of your scanner, in this example it would be:
 +
 
 +
# Hewlett-Packard ScanJet 4100C
 +
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="2504", MODE="0664", GROUP="scanner",
 +
  ENV{libsane_matched}="yes"
 +
 
 +
Save the file, plug out and back in your scanner and the file permissions should be now correct.
 +
 
 +
Another tip, is that you can add your device (scanner) in backend file:
 +
 
 +
Add ''''usb 0x03f0 0x2504'''' to {{ic|/etc/sane.d/hp4200.conf}} so it looks like this:
 +
#
 +
# Configuration file for the hp4200 backend
 +
#
 +
#
 +
# HP4200
 +
#usb 0x03f0 0x0105
 +
usb 0x03f0 0x2504
 +
 
 +
===Epson Perfection 1270===
 +
 
 +
For Epson Perfection 1270, you also need a firmware named esfw3e.bin. It can be obtained by installing the Windows driver.
 +
 
 +
Modify configuration file of snapscan backend:
 +
 
 +
vi /etc/sane.d/snapscan.conf
 +
 
 +
Change the firmware path line with yours. :
 +
 
 +
<pre>
 +
  # Change to the fully qualified filename of your firmware file, if
 +
  # firmware upload is needed by the scanner
 +
  firmware /mnt/mydata/Backups/firmware/esfw3e.bin
 +
</pre>
 +
 
 +
And add the following line in the end or anywhere you like
 +
 
 +
<pre>
 +
  # Epson Perfection 1270
 +
  usb 0x04b8 0x0120
 +
</pre>
 +
 
 +
You can get such code information (''usb 0x04b8 0x0120'') by "sane-find-scanner" command.
 +
 
 +
Also add such information lines in your libsane.usermap file to setup your privilage, like:
 +
 
 +
vi /etc/hotplug/usb/libsane.usermap
 +
 
 +
  #Epson Perfection 1270
 +
  libusbscanner 0x0003 0x04b8 0x0120 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
 +
 
 +
Replug scanner, you have a working Epson Perfection 1270 now.
 +
 
 +
NOTE: I can scan image if I define the X and Y value, but without that error meassage occors like: "scanimage: sane_start: Error during device I/O", if anyone know why, please complete the section.
 +
".

Revision as of 13:03, 26 January 2013

Tango-preferences-desktop-locale.png本页面需要更新翻译,内容可能已经与英文脱节。要贡献翻译,请访问简体中文翻译组Tango-preferences-desktop-locale.png

附注: please use the first argument of the template to provide more detailed indications.
Summary help replacing me
Installing and configuring Sane
Related
Scan print and save Script

Sane provides a library and a command-line tool to use scanners under GNU/Linux. Here you can check if sane supports your scanner.

Installation

Install sane from the official repositories.

Configuration

Now you can try to see if sane recognizes your scanner

$ scanimage -L

If that fails, check that your scanner is plugged into the computer. You also might have to unplug/plug your scanner for /etc/udev/rules.d/sane.rules to recognize your scanner.

Now you can see if it actually works

$ scanimage --format=tiff > test.tiff

For HP hardware

For HP hardware you may also need to install hplip from the official repositories and/or hpojAUR from the AUR.

  • Uncomment or add hpaio and hpoj to a new line in /etc/sane.d/dll.conf.
  • Running hp-setup as root may help you add your device.
  • hp-plugin is the 'HPLIP Plugin Download and Install Utility'.
  • hp-scan is the 'HPLIP Scan Utility'.

For Hewlett-Packard OfficeJet, PSC, LaserJet, and PhotoSmart printer multi-function peripherals, run ptal-init setup as root and follow instructions:

# ptal-init setup

Then start the ptal-init daemon.

For Brother hardware

In order to install a Brother Scanner or Printer/Scanner Combo you need the right driver (which can be found in the AUR). There are only four drivers to choose from (brscan1-4). In order to find the right one you should search for your model at the brother linux scanner page.

After you installed the driver you need to run

# /usr/local/Brother/sane/setupSaneScan1 -i

so the drivers/scanner are recognized by sane.

For network scanners, Brother provides a configuration tool:

$ brsaneconfig2 -a name=<ScannerName> model=<ScannerModel> ip=<ScannerIP>

Example:

$ brsaneconfig2 -a name=SCANNER_DCP770CW model=DCP-770CW ip=192.168.0.110

For Epson hardware

For Wi-Fi and/or network scanners, you can use "Image Scan! for Linux".

Install iscanAUR and iscan-plugin-networkAUR from the AUR, then update /etc/sane.d/epkowa.conf and add the line:

net {IP_OF_SCANNER}

For Samsung hardware

For some Samsung MFP printers you may need to edit /etc/sane.d/xerox_mfp.conf.

example entry:

#Samsung SCX-3200
usb 0x04e8 0x3441

Change the printer model as needed. You can get the ipVendor and idProduct code with lsusb. See this thread.

For plustek scanners

Some plustek scanners (noticeably Canoscan ones), require a lock directory. Make sure that /var/lock/sane directory exists, that its permissions are 660, and that it is owned by <user>:scanner. If the directory permissions are wrong, only root will be able to use the scanner. Seems (at least on x86-64) that some programs using libusb (noticeably xsane and kooka) need scanner group rw permissions also for accessing /proc/bus/usb to work for a normal user.

Firmware

Note: This section is only needed if you need to upload firmware to your scanner.

Firmwares usually have the .bin extension.

Firstly you need to put the firmware someplace safe, it is recommended to put it in a subdirectory of /usr/share/sane.

Then you need to tell sane where the firmware is:

  • Find the name of the backend for your scanner from the sane supported devices list.
  • Open the file /etc/sane.d/<backend-name>.conf.
  • Make sure the firmware entry is uncommented and let the file-path point to where you put the firmware file for your scanner. Be sure that members of the group scanner can access the /etc/sane.d/<backend-name>.conf file.

If the backend of your scanner is not part of the sane package (such as hpaio.conf which is part of hplip), you need to uncomment the relevant entry in /etc/sane.d/dll.d/hplip.

Install a frontend

XSane provides a GTK-based frontend to Sane. It is available in the extra repository.

# pacman -S xsane
Note: Scanning directly to pdf using Xsane in 16bit color depth mode is known to produces corrupted files. 8bit mode should work.

Other frontends exist, to find them you can:

  • use pacman -Ss to search for keywords such as "sane" or "scanner"
  • see the list of frontends on the sane-project website

Network scanning

Sharing Your Scanner Over a Network

You can share your scanner with other hosts on your network who use sane, xsane or xsane-enabled Gimp. To set up the server, first indicate which hosts on your network are allowed access.

Change the /etc/sane.d/saned.conf file to your liking, for example:

# required
localhost
# allow local subnet
192.168.0.0/24

Ensure xinetd is installed:

# pacman -S xinetd

Next, make sure the a file called /etc/xinetd.d/sane exists and disabled is set to no:

service sane-port
{
   port        = 6566
   socket_type = stream
   wait        = no
   user        = root
   group       = scanner
   server      = /usr/sbin/saned
   disable     = no
}

Add the following line to /etc/services:

sane-port 6566/tcp

Start the xinetd daemon.

Your scanner can now be used by other workstations, across your local area network.

Accessing Your Scanner from a Remote Workstation

You can access your network-enabled scanner from a remote Arch Linux workstation.

To set up your workstation, begin by installing xsane:

# pacman -S xsane

Next, specify the server's host name or IP address in the /etc/sane.d/net.conf file:

# static IP address
192.168.0.1
# or host name
stratus

Now test your workstation's connection, from a non-root login prompt:

$ xsane

or

$ scanimage -L

After a short while, xsane should find your remote scanner and present you with the usual windows, ready for network scanning delight!

For HP All in one network printer/scanner/fax you need to configure it via:

$ hp-setup <printer ip>

Troubleshooting

Invalid argument

If you get an "Invalid argument" error with xsane or another sane front-end, this could be caused by one of the following reasons:

Missing firmware file

No firmware file was provided for the used scanner (see above for details).

Wrong firmware file permissions

The permissions for the used firmware file are wrong. Correct them using

# chown root:scanner /usr/share/sane/SCANNER_MODEL/FIRMWARE_FILE
# chmod ug+r /usr/share/sane/SCANNER_MODEL/FIRMWARE_FILE

Multiple backends claim scanner

It may happen, that multiple backends support (or pretend to support) your scanner, and sane chooses one that doesn't do after all (the scanner won't be displayed by scanimage -L then). This has happend with older Epson scanners and the epson2 resp. epson backends. In this case, the solution is to comment out the unwanted backend in /etc/sane.d/dll.conf. In the Epson case, that would be to change

 epson2
 #epson

to

 #epson2
 epson

Slow startup

If you encounter slow startup issue (e.g. xsane or scanimage -L take a lot to find scanner) it may be that more than one driver supporting it is available.

Have a look at /etc/sane.d/dll.conf and try commenting out one (e.g. you may have epson, epson2 and epkowa enabled at the same time, try leaving only epson or epkowa uncommented)

Permission problem

If you see your scanner only when running lsusb (as root), you might get it working by adding your user to scanner and/or lp group.

# gpasswd -a username scanner
# gpasswd -a username lp

This is reported to work on HP all-in-one models (e.g., PSC 1315 and PSC 2355).

You can also try to change permissions of usb device but this is not recommended, a better solution is to fix the Udev rules so that your scanner is recognized.

Example:

First, as root, check connected usb devices with lsusb:

#Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
#Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
#Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
#Bus 003 Device 003: ID 04d9:1603 Holtek Semiconductor, Inc. 
#Bus 003 Device 002: ID 04fc:0538 Sunplus Technology Co., Ltd 
#Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
#Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
#Bus 001 Device 006: ID 03f0:2504 Hewlett-Packard 
#Bus 001 Device 002: ID 046d:0802 Logitech, Inc. Webcam C200
#Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

In our example we see scanner - 'Bus 001 Device 006: ID 03f0:2504 Hewlett-Packard'

Now edit /lib/udev/rules.d/53-sane.rules and look for the first part of the ID number found previously and check if there is a line that also reports the second part of the number (model numer), in this example 2504. If not found change or copy a line and enter the idVendor and idProduct of your scanner, in this example it would be:

# Hewlett-Packard ScanJet 4100C
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="2504", MODE="0664", GROUP="scanner",
  ENV{libsane_matched}="yes"

Save the file, plug out and back in your scanner and the file permissions should be now correct.

Another tip, is that you can add your device (scanner) in backend file:

Add 'usb 0x03f0 0x2504' to /etc/sane.d/hp4200.conf so it looks like this:

#
# Configuration file for the hp4200 backend
#
#
# HP4200
#usb 0x03f0 0x0105
usb 0x03f0 0x2504

Epson Perfection 1270

For Epson Perfection 1270, you also need a firmware named esfw3e.bin. It can be obtained by installing the Windows driver.

Modify configuration file of snapscan backend:

vi /etc/sane.d/snapscan.conf 

Change the firmware path line with yours. :

   # Change to the fully qualified filename of your firmware file, if
   # firmware upload is needed by the scanner
   firmware /mnt/mydata/Backups/firmware/esfw3e.bin

And add the following line in the end or anywhere you like

  # Epson Perfection 1270
  usb 0x04b8 0x0120

You can get such code information (usb 0x04b8 0x0120) by "sane-find-scanner" command.

Also add such information lines in your libsane.usermap file to setup your privilage, like:

vi /etc/hotplug/usb/libsane.usermap
 
 #Epson Perfection 1270
 libusbscanner 0x0003 0x04b8 0x0120 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000

Replug scanner, you have a working Epson Perfection 1270 now.

NOTE: I can scan image if I define the X and Y value, but without that error meassage occors like: "scanimage: sane_start: Error during device I/O", if anyone know why, please complete the section. ".