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).
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.