- Linux connect to network scanner
- Contents
- Installation
- Verification
- Installing a scanner driver
- Firmware
- Fujitsu fi series
- Install a frontend
- Network scanning
- Network attached scanners
- Scanning over the network with Canon PIXMA or imageCLASS all-in-one printer/scanners
- Scanning over the network with EPSON WorkForce printer/scanners
- Sharing your scanner over a network
- Accessing your scanner from a remote workstation
- Windows clients
- Troubleshooting
- Invalid argument
- Missing firmware file
- Wrong firmware file permissions
- Multiple backends claim scanner
- Communication via xHCI not working (older scanner models)
- Firewall
- Slow startup
- Device busy
- Permission problem
- Parallel port scanners
- avahi-daemon is not mandatory
- Ubuntu Documentation
- How can I find out if my scanner works with Ubuntu?
- Using your scanner
- «No device available» — what to do?
- Install a scanner manually
- Specific Scanner Models
- Permission Issues
- ACL permissions for saned
- Sharing a Scanner Over a Network
- Server-side setup
- Sane as a server
- Share with
- User setup
- Set (x)inetd
- Run at start-up
- Client-side Setup
- LAN-based scanners
- HP All-in-One devices
- Brother All-in-One
- Help Ubuntu to support more scanners
- External links
Linux connect to network scanner
SANE (Scanner Access Now Easy) provides a library and a command-line tool to use scanners under GNU/Linux.
Check if your scanner supports eSCL or WSD; chances are good if your device is on this Internet Printing Protocoll — IPP list of devices that support eSCL. If your device has eSCL/WSD support, modern «driverless» scanning is recommended.
Contents
Installation
Install the sane-airscan package if the scanner is known to work in driverless mode. If your scanner is using USB connection, make sure to also install the ipp-usb package and start/enable ipp-usb.service to allow using IPP protocol over USB connection.
If not, see [1] to check if SANE supports your scanner using a classic driver.
Install the sane package to use old driver-based scanning.
Verification
Now you can try to see if sane recognizes your scanner.
If that fails, run the command again as root to check for permission problems. If that fails as well, check that your scanner is plugged into the computer. You also might have to unplug/plug your scanner for /usr/lib/udev/rules.d/65-sane.rules to recognize your scanner.
Now you can see if it actually works
If the scanning fails with the message scanimage: sane_start: Invalid argument you may need to specify the device.
Then you would need to run
Sane provides many special backend options for numerous scanner types. To see what these are for your device:
Installing a scanner driver
Most scanners should work out of the box. If yours does not, see SANE/Scanner-specific problems for installation instructions.
Firmware
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 or in /etc/sane.d/dll.conf .
Fujitsu fi series
For some of the Fujitsu fi series document scanners, the pfufs AUR proprietary driver offers advanced functionality over the already mature SANE default driver, such as control of an optional imprinter for stamping scanned documents or requesting accurate status of the consumables from the host.
Install a frontend
Many frontends exist for SANE, a non-exhaustive list of which can be found on the sane-project website.
- Simple Scan — Simplified GUI that is intended to be easier to use and better integrated into the GNOME desktop than XSane. It was initially written for Ubuntu and is maintained by Robert Ancell of Canonical Ltd. for GNU/Linux.
https://gitlab.gnome.org/GNOME/simple-scan || simple-scan
- Skanlite — Simple image scanning application that does nothing more than scan and save images, based on the KSane backend.
https://www.kde.org/applications/graphics/skanlite || skanlite
- XSane — Full-featured GTK-based frontend looking a bit old but providing extended functionalities.
http://www.xsane.org/ || xsane
Some OCR software are able to scan images using SANE: gImageReader, gscan2pdf, Linux-Intelligent-Ocr-Solution, OCRFeeder, Paperwork.
The factual accuracy of this article or section is disputed.
- Using a frontend does not mean you do not have to apply some tricks. This is especially true with devices configured via mDNS. For example, skanlite needs to have additional info specified on the command line in order to detect a network scanner properly as it cannot handle mDNS. Here is an example with an HP Officejet Pro L7590: skanlite —device «hpaio:/net/Officejet_Pro_L7500?ip=192.168.0.17» .
Network scanning
Network attached scanners
Many modern scanners will immediately work over the network as long as you have sane-airscan installed.
Scanning over the network with Canon PIXMA or imageCLASS all-in-one printer/scanners
Find out your printer/scanner’s IP address, and add it on a new line to /etc/sane.d/pixma.conf in the format bjnp://10.0.0.20 . For imageCLASS printers you may need to use the format mfnp://10.0.0.20 instead.
Sane should now find your device. For more details refer to sane-pixma(5) .
Alternatively, scangearmp2 AUR can be used for some Canon PIXMA all-in-one printer/scanners which are not detected over the network.
Scanning over the network with EPSON WorkForce printer/scanners
Edit the configuration file /etc/utsushi/utsushi.conf . Find the [devices] section and edit the template for dev2 . Replace the IP address accordingly. You can find the IP address on your printer screen. For example,
Meanwhile, comment out epson2 in /etc/sane.d/dll.conf as it conflicts with ImageScan.
Once this is done you can use any SANE frontend to access this scanner.
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:
If you use iptables, insert the nf_conntrack_sane module to let the firewall track saned connections.
Conntrack helper seems to be disabled by default.[2] You can activate it with
To configure this permanently, set the nf_conntrack_helper=1 option for the nf_conntrack module, see Kernel module#Using files in /etc/modprobe.d/.
Now start/enable saned.socket . Your scanner is now available over the network. For more information, see saned(8) .
Accessing your scanner from a remote workstation
You can access your network-enabled scanner from a remote Arch Linux workstation.
First, specify the server’s host name or IP address in the /etc/sane.d/net.conf file:
Now test your workstation’s connection:
The network scanner should now also show up in any front-end.
Windows clients
Since the Windows port of SANE seems to be unsupported, outdated and difficult to get, you can try SANEWinDS or SaneTwain (old).
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 #Firmware for details).
Wrong firmware file permissions
The permissions for the used firmware file are wrong. Correct them using
Multiple backends claim scanner
It may happen, that multiple backends support (or pretend to support) your scanner, and sane chooses one that does not do after all (the scanner will not be displayed by scanimage -L then). This has happened 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
This article or section is out of date.
It may also be possible that the independent iscan [broken link: package not found] epkowa backend interferes with your snapscan backend (epson scanners). You may get this error right after using the scanimage -L command. Starting the scanner app (like xsane ) twice can also solve the problem. Otherwise check your /etc/sane.d/epkowa.conf for wrong configurations or remove the iscan [broken link: package not found] package.
Communication via xHCI not working (older scanner models)
Some older scanner models do not work when connected via an USB3 port. If you experience this issue, try setting the SANE_USB_WORKAROUND=1 environment variable before starting your frontend.[4][5]
If that does not work, try one of the following workarounds:
- Use an USB2 port instead of an USB3 port, if available.
- Disable xHCI via BIOS/EFI. eHCI will consequently be used and communication with the scanner will work. On the downside, USB3 speed can not be reached on any port.
- On (some) intel chipsets the setpci command can be used to route specific usb ports to either the xHCI or the eHCI controller. See here and here (scroll down to where it says «setpci») for further information. With this it is possible to toggle single USB ports with a simple shell script.
- Connect the scanner over the network instead if it is supported.
Firewall
When network scanning scanner hangs, then invalid argument error occured.
saned uses data port range, so you must enable connections to 6566/tcp and data_portrange from /etc/sane.d/saned.conf or use conntrack firewall module for sane to enable data ports as described above.
Slow startup
If you encounter slow startup issue (e.g. xsane or scanimage -L does not return results nearly instantly), one of the drivers you do not use may be the culprit.
You can resolve this by editing /etc/sane.d/dll.conf and commenting out the scanner drivers you do not use. You can use scanimage -L to determine which drivers you need:
The parts between the ` and the : in the output indicate the driver for the device. For example, if only want to use the Brother scanner and not the webcam or the generic scanner driver, you can comment out everything but the brother4 driver in /etc/sane.d/dll.conf .
Device busy
The factual accuracy of this article or section is disputed.
If your USB device is listed with scanimage -L but launching the test scanimage pixma:04A9173E_11DAD1 —format=tiff —output-file test.tiff always return the ‘Device busy’ error, you might try to add your username to the scanner group usermod -a -G scanner yourusername then blacklist the usblp kernel module by writing blacklist usblp in /etc/modprobe.d/no-usblp.conf (it prevents usblp from loading to support scanning, not needed by xsane and related tools, might also conflict with CUPS). Reboot to finish. [6]
In addition to this, some Cannon printers return «device busy» if the scan mode is set to «Computer». Setting this to the «Remote Scanner» mode should fix the issue.[7]
Permission problem
With systemd, the scanner and lp groups are deprecated. No need to add your user to those groups. See Users and groups#Pre-systemd groups for detail.
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.
First check connected usb devices with lsusb :
In our example we see the scanner: Bus 001 Device 006: ID 03f0:2504 Hewlett-Packard . Here 03f0 is the vendorID and 2504 is the productID.
Alternatively, running sane-find-scanner with root permission will also give you the same vendorID and productID.
Now open /usr/lib/udev/rules.d/49-sane.rules and see if there is there is a line with the vendorID and productID of your scanner. If there is not any, create the new file /etc/udev/rules.d/49-sane-missing-scanner.rules , with the following contents:
Save the file, plug out and back in your scanner and the file permissions should be now correct.
The factual accuracy of this article or section is disputed.
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:
Parallel port scanners
All devices attached to a parallel port are assumed to be printers, and are given a lp group. Either create a udev rule to mark the relevant parallel port as libsane_matched , or add your user to the lp user group. CUPS also uses the lp group for read-only access to configuration files, so there are potential security implications to adding users to the lp group — see CUPS#Connection interfaces for more information.
avahi-daemon is not mandatory
This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.
Some scanner applications may require you to start the avahi-daemon upon startup. This is actually the cause of SANE. If for some reason you do not want to enable the avahi-daemon service because you use a wired scanner or do not need it because your scanner’s driver supports networking already on setup, then comment out the net backend in the SANE configuration:
Источник
Ubuntu Documentation
Needs Expansion
This article is incomplete, and needs to be expanded. More info.
NOTE: this page mostly refers to older versions of sane. Also see the sane page for the version of sane that ships with Ubuntu 10.10 and above
Setting up a scanner in Ubuntu is normally straightforward. Here are some tips if you do get stuck.
How can I find out if my scanner works with Ubuntu?
- Simply plug it in and try! If it is a newer model USB scanner, it is likely that it will work immediately without any further driver or software installations.
Hardware Support Component Scanners — check which scanners are supported in your specific Ubuntu release.
SANE project listing of supported scanners — The SANE (Scanner Access Now Easy) project provides most of the backends to the scanning software on Ubuntu.
Using your scanner
- Turn on your scanner and place a document or photo face down on the scanner.
Go to Applications —>Graphics —>XSane Image Scanner or SimpleScan. Adjust some settings if required.
Press Scan. Alternatively you can also press the «Scan» button on the scanner to open the scanning dialog.
Once the scanning process is finished a thumbnail image is displayed. Save your file.
If you want to create a multi-page file exchange the documents on the scanner and repeat the scanning process until all pages are scanned. Don’t forget to Save when you are finished!
«No device available» — what to do?
There could be several reasons why you might get this message:
- This might be a permissions problem. Try to run the scanning software as root.
- Your scanner is not supported in Ubuntu. The most common type of unsupported scanners are old parallel port or Lexmark All-in-One printer/scanner/faxes.
- The required driver for your scanner has not been autoloaded
You need to install the appropriate firmware (probably a *.fw or *.usb) for your particular scanner. Try to find the firmware file on the documentation provided with your scanner or search online. Once you got the right firmware file copy it into /usr/share/sane/. Tip: In my case I got the firmware file from the CD that came with the scanner. If the CD only supports Windows, try installing the CD with WINE- don’t use the program instead search for the firmware file and coy this file «ccd548.fw» into /usr/share/sane/gt68xx/.
For a Mustek 1200 UB Plus scanner you will need this file sbfw.usb. Rename it to «PS1fw.usb» and then put it in the directory «/usr/share/sane/gt68xx» (remember to give read permission to all users).
Your scanner is parallel port and you are not a member of the scanner group. The device /dev/parport0 (or whichever parallel port your scanner is connected to) by default is only readable and writable by user lp and group scanner. You can become member of group scanner: go to Administrations —>Users and Groups —>Account Properties —>User Privileges.
Install a scanner manually
The SANE project does not always provide complete drivers for all scanners. These drivers can still be used, but not all features may work. Here is a list of scanners with incomplete drivers:
- HP 4200, HP 3300C, HP 4300C, Agfa Snapscan Touch, HP 4400C, HP 4470C
- Search Synaptic for «libsane-extras» or alternatively type the following command in the terminal:
Make sure the Universe repository is enabled. The easiest way to do this is probably through Synaptic.
Now you need to edit .conf file in /etc/sane.d/dll.conf. To enable the right driver for your scanner look for the following lines:
- Below are several commented lines. Uncomment (delete the #) the correct one for your scanner, e.g.:
HP 4200 — uncomment the hp4200 line.
HP 3300C, HP 3400C, HP 4300C, Afga Snapscan Touch — uncomment the niash line.
HP 4400C, HP 4470C — uncomment the hp_rts88xx line.
- Save changes to .conf file.
- Fire up Sane and scan away.
Note: the way Linux’ hotplugging stuff works, you may need to plug in the scanner after the computer has booted..
Specific Scanner Models
Some specific models have been documented here:
Permission Issues
Add saned to the group which owns your scanner device:
Note: I used sane-find-scanner to determine the device and ls -al /dev/bus/usb/XXX/XXX to identify the group. Since I have MFC printer/scanner/fax the device happened to be owned by group ‘lp’ so I added saned to that group (instead of scanner) to allow it access to the scanner.
ACL permissions for saned
Because of a change is the way access permissions are now applied to devices, saned may still not be able to access the scanner when it is launched by inetd or xinetd. This can happen even though other regular users on the server have access. The following bug-report contains a solution to this problem :
Sharing a Scanner Over a Network
Note: The following documentation was written mostly for Ubuntu 10.10 and earlier. For Ubuntu 11.10 and higher, please see the sane.d tutorial.
There are two common configurations for using a scanner over a network:
Server-side setup
In this configuration, one computer has a scanner connected by USB or parallel port and shares it with others on the network. The computer with the scanner connected is called the server and all other computers on the network wishing to share the scanner are called clients.
Note: Make sure your scanner is installed and working properly on the server computer (i.e. the computer to which the scanner is physically attached).Test first on that local machine before attempting to share the scanner over the network.
All computers need to have Sane installed:
As saned does not automatically detect a scanner that is shared by a remote computer you will need to set it up with both, the server and the client.
- Tell it to run sane as a server (daemon, service)
- Set the subnet where to share the scanner.
- On distributions older that 10.10, set inet (or xinet) to listen on the appropriate port (This is optional, saned can be setup to be running continuously)
- Make sane run at start up
Sane as a server
Set sane to run as a server, ie expect connections Edit /etc/default/saned to read:
You must be root to edit this file (hint, use sudo)
Share with
Set the subnet that will be able to see the scanner Edit /etc/sane.d/saned.conf to share the printer on your subnet:
Make sure it is in your range of IPs. It hit me badly when I mis-configured it for 192.168.0.0 when I meant 192.168.1.0 !
The /24 means to share with everybody in xxx.xxx.xxx.0 to 255.
User setup
In some cases, correct permissions needs to be set. E.g. for HP DesignJet 2050 All-in-one device, the saned user has to be inserted into lp group. To do that by typing
To verify the saned user has the correct permissions to access the scaner device, run the following commands:
As a result, you should see a device identified, e.g.
Set (x)inetd
Only needed for 10.04 and previous distributions. You don’t need this step if running 10.10, jump to step four.
Edit /etc/inetd.conf by adding the following line:
Note: that an inetd server need not be installed.
Or, if you are using xinetd, create a file called /etc/xinetd.d/saned and enter the following in the file:
Note: The saned value (last word on the inet configuration or in the user line in the xinetd configuration) is the name of the user running the server. You can get it form the RUN_AS_USER= line on the /etc/default/saned file
restart inetd or xinetd by
Run at start-up
Restart saned by (10.10)
or (10.04 and previous)
One user writes that a reboot is necessary. Not my experience (with 10.10) but YMMV.
To configure the Sane daemon to start automatically at boot up run:
Client-side Setup
From the client, all you need to do is add server name or IP address of the scanner server to /etc/sane.d/net.conf:
Now run xsane and it should pick up the new network scanner.
LAN-based scanners
The scanner is connected directly to the network without any intermediary computer.
HP All-in-One devices
- Ensure the device is connected to the network and can be pinged.
Ensure hplip is installed:
Run the hp-setup wizard which installs printer, scanner, and any other features.
- For Connection Type choose «Network/Ethernet. «
- If the device is not detected, click «Show advanced options», tick «Manual discovery» and supply the scanner’s IP address.
Check the scanner is now recognized:
For more details, see HpAllInOne.
Brother All-in-One
See this page for the brscan utility and instructions.
Help Ubuntu to support more scanners
There are several ways you can help Ubuntu to support more and more scanners over time.
Support the SANE Project! This project provides most of the scanning backend information for Ubuntu.
When purchasing a new scanner, always ask if it works in Linux
Contact the manufacturer about supporting your scanner under Linux. Make sure you tell them about the SANE project!
External links
SANE project (Scanner Access Now Easy)
ScanningHowTo (последним исправлял пользователь penalvch 2018-04-11 04:55:33)
The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details
Источник