Network Scanners and Fedora 20

Here is a quick fix that might help users experiencing the “no devices available” problem when using xsane, the Linux scanning tool.

In this case, the device was an HP 3070 B611, a combined printer and scanner. The OS (Fedora 20) was able to see the device as a printer and print okay, but the scanner part did not work. Xsane just popped a small window saying unable to find device.

The fix was a change in the CUPS configuration, and it may therefore work with other versions of Linux.

Note: (19th June 2016) This article receives an unexpectedly large number of hits.  If you have come here expecting something else, for example information about network scanners like nmap or Wireshark, please leave a comment to that affect and I will adjust the keyword settings.  This article is about document scanners, not software to snoop your LAN.

General Printing/Scanning Setup

I had already installed hplip, xsane and the sane backends. If you are missing those, they can be installed as follows:

# yum install hplip
# yum install hplip-gui
# yum install xsane
# yum sane-backends sane-backends-drivers-scanners

Make sure you have libsane-hpaio.x86_64 (or 32 bit equivalent). It should have installed automatically as part of hplip-gui.

Xsane Unable to See Scanner

Every time I started Xsane, there would be a pause then it would show a small dialogue saying “no devices available”. If you get the same, try this tip from the hplip web site. Invoke xsane on the command line, with your scanner URL as argument. In my case it was:

# xsane -V hpaio:/net/Deskjet_3070_B611_series?ip=192.168.1.66

… and it worked. Xsane opened up fine and I could scan. It seems that previously, when I clicked “xsane” in the menus (desktop was XFCE), or just typed “xsane” on the command line, xsane was running with the wrong URI by default, and failing to contact the scanner.

(NB: You would not normally run xsane as root, it is not recommended. But I have shown the invokation as root because that is how it happed in this case. Running as non-root might also have worked, as it did subsequently. Also, you don’t actually need the “-V”, that just tells the program to open in viewer mode).

Fix for Scanimage too

The command line tool scanimage can be fixed in a similar way. Specify the device url as in this example:

$ scanimage –device-name hpaio:/net/Deskjet_3070_B611_series?ip=192.168.1.66 –mode Color –resolution 200

Incidentally, on the subject of scanimage, I use the following command to scan an image directly into a pdf file:

$ scanimage –device-name hpaio:/net/Deskjet_3070_B611_series?ip=192.168.1.66 –mode Color –resolution 200 | gm convert pgm:- pdf:myimage.pdf

Requires the GraphicsMagick package to be installed (yum install GraphicsMagick).

Permanent Fix

After the above procedure, I found that just typing “xsane” with no arguments also worked, as if the above procedure has altered the system configuration. And choosing xsane from the XFCE menus worked too. Checking the config files, I found that /etc/cups/printers.conf had changed. (Usefuly, cups keeps a backup copy in the same directory).

# cd /etc/cups
# diff printers.conf printers.conf.O
...
 DeviceURI hp:/net/Deskjet_3070_B611_series?ip=192.168.1.66
---
 DeviceURI socket://192.168.1.66:9100

It seems that CUPS was sonfigured with an incorrect scanner URI (the socket: one) and updating it (to hp:/net…) fixed the problem. Just editing the file /etc/cups/printers.conf might also have provided a fix, but that is not recommended. If you choose to do it, restart the cupsd daemon afterwards.

NB notice the corrected URI is however not identical to the command line one, it is “hp:”, whereas the command line URI started with “hpaio:”. The CUPS configuration GUI (http://127.0.0.1:631) also shows the hp: version.

Doing the Same Fix in Other Ways

In this case (Fedora 20/XFCE), the change could also have been made by selecting from the XFCE menu -> Administration -> Print Settings -> right click on printer -> properties and then changing the “Device URI” field.

As stated it is also possible to just edit and correct the file /etc/cups/printers.conf, provided you restart cupsd afterwards.

6 thoughts on “Network Scanners and Fedora 20

  1. HPLIP configures an all-in-one with a URI for the printer device of the form

    hp:/net/?ip=

    hp is the printer backend. There is no direct configuration of the scanner device. xsane uses this URI to construct a URI for the scanner of the form

    hpaio:/net/?ip=

    hpaio is the scanner backend. Basically, it swaps hpaio for hp.That is why socket://… , ipp://… etc cannot be used if you want xsane to automatically find the scanner. But you can still use xsane .

    • Hi Brian, unfortunately I can’t make much sense of your comments above. It isn’t clear if you followed the article, what happened or if you found it helpful. If you have a specific question, please provide more detail.

      • Hello Jim.

        Sorry for the delay, I did didn’t see your reply. I had no trouble following the article; the trouble I had was formatting the URIs in my replies.

        Printing and scanning are two unrelated processes. They only look related because hplip derives a scanner URI from a printer URI. CUPS is not used to configure scanner URIs but printer URIs. There is nothing wrong with hplip’s approach, but it does lead to users seeing scanning as being connected to printing.

        hp-setup will set up a printer queue *only* with the hp backend. hpaio is substituted for hp for the scanner URI and used by xsane. This is done automatically and in the cause user-friendliness.

        socket, ipp etc can be used as the printer backend. But then there is no automatic URI for the scanner. The solution is not to alter CUPS but for a user to provide the hpaio URI directly to the SANE frontend. as you have done.I

        Newer HP devices have Bonjour broadcasting (AirPrint). A scanner URI can be obtained from these broadcasts. No print queue is needed, but one with a socket backend will not prevent scanner discovery. The HP 3070 B611 doesn’t appear to have Airprint support.

Leave a Reply to Brian Cancel reply

Your email address will not be published. Required fields are marked *