Getting XSane to work with a networked HP Printer

Issues related to applications and software problems and general support
Post Reply
DaveHighland
Posts: 18
Joined: 2016/04/06 20:08:05

Getting XSane to work with a networked HP Printer

Post by DaveHighland » 2020/09/09 16:12:26

THE PROBLEM:

I had been running Centos 7 until recently, and I performed a new install of Centos 8. As with Centos 7, when I launched Xsane, the program terminated with a dialog box saying "no devices available", and I had to perform an arcane sequence of adjustments before it would work with HP 4620 All-In-One (AIO) printer. So I thought I'd update this post in case anyone else is having this problem. I have NOT verified that this solution works with other HP AIO printers, but I suspect it will, so I'm passing it along.

My system:
* CentOS Linux release 8.2.2004
* Gnome 3.32.2, running in "classic" mode
* HP Officejet 4620 All-In-One (AIO) printer connected to LAN via WiFi

THE SOLUTION:

Step 1. If you haven't done so already, use Applications/System Tools/Devices/Printers to add your HP printer. Use an application to verify that you can print.

Step 2. In a terminal window, execute the following command to verify that the required packages are installed. This command does not require admin privileges. If any of these packages are not installed, use the "sudo dnf install" command to install them:

dnf list installed cups dbus hplip sane-backends

Step 3. Find and make a note of your host computer's local IP address. If you are connected via ethernet, use Applications/System Tools/Network and click on the gear (settings) icon for your connection. The Details tab of the pop-up dialog box will show your IPv4 address. If you connect via WiFi, the same information should be available via Applications/System Tools/WiFi. In step 4, I show my own host's address (192.168.1.42) as an example, but you should substitute your own computer's address.

Step 4. Make a backup of the /etc/sane.d/saned.conf text file. Then edit the original /etc/sane.d/saned.conf text file with admin privileges (for example, by using the terminal command "sudo gedit /etc/sane.d/saned.conf"). Insert the following lines below the "Access list" section, but substitute your computer's local IP address from Step 3, and modify the comment as appropriate. Adding your computer's IP address to the access list section of the saned.conf file gives your computer permission to access your printer's scanner via XSane. Save the file and close it.

# Added the following line 2020-09-08:
192.168.1.42

Step 5. Make a backup of the /etc/sane.d/dll.conf text file. Then edit the original /etc/sane.d/dll.conf text file with admin privileges. At or near the top of the file, locate the "net" line. If this line is commented out (as in "#net"), then delete the hash mark. The "net" line must be enabled in order to allow a scanner to be accessed through the network rather than through a USB or SCSI connection. Then insert the following lines immediately below the "net" line, modifying the comment as appropriate. The "hpaio" line enables the hpaio sane backend. Although another backend listed in this file may be a closer match to your printer (e.g., "hp4200"), that backend is usually not sufficient to allow sane to access the scanner in your HP All-In-One printer. Save the file and close it.

# Added the following line 2020-09-08:
hpaio

Step 6. Restart your computer to allow the above changes to take effect.

Step 7. Using your HP printer's front panel, verify that it is connected to your WiFi network and navigate through its menus to determine the IP address assigned to it. Write down this address. In the steps below, I show my HP 4620 IP address (192.168.1.108) as an example, but you should substitute your printer's address.

Step 8. Execute the following command to determine the Uniform Resource Identifier (URI) of your HP printer, substituting your printer's IP address. A URI unambiguously names a resource, in this case your printer. If the following command succeeds, then you will have a resource name that tells Xsane exactly how to access your printer.

hp-makeuri 192.168.1.108

On my system, the above command produces the output shown below. Write down the URI appearing after the label "SANE URI: ".

CUPS URI: hp:/net/Officejet_4620_series?ip=192.168.1.108
SANE URI: hpaio:/net/Officejet_4620_series?ip=192.168.1.108
HP Fax URI: hpfax:/net/Officejet_4620_series?ip=192.168.1.108

Step 9. In a terminal window, execute the following command to launch Xsane, substituting the URI that you wrote down in Step 8.

xsane hpaio:/net/Officejet_4620_series?ip=192.168.1.108


If everything worked, Xsane should launch and find your printer, and you should be able to scan documents from both the flat-bed and the automatic document feeder.

One quirk: On my system, when Xsane launches, the window title displays "...unknown Officejet...". I don't know why; I'm just happy that it works.

If you want to launch Xsane from the Gnome Classic Applications menu, you'll have to modify the properties of the Xsane menu item. I recommend that you install the MenuLibre menu editor for this purpose. (Browse to https://centos.pkgs.org/8/epel-testing- ... h.rpm.html and follow the instructions under "Install Howto".) This will be a command line installation using dnf; for some reason, the Applications/System Tools/Software GUI application does not find MenuLibre even when the "Extra Packages for Enterprise Linux - Testing - x86-64" repository is enabled.

I hope this post helps at least one other person get Xsane running with their HP printer. Good Luck!

Post Reply

Return to “CentOS 8 - General Support”