How to Use an HP ENVY Printer / Scanner with Linux
HP ENVY Multifunction Devices
The HP ENVY series of multi-function devices
is supported under Linux,
but there are two potential gotchas.
The shortest possible explanation is:
1:
Add your account to the scanner
group.
# usermod -a -G scanner youraccount
2:
Remove the ippusbxd
or equivalent package.
HP began manufacturing an series of products in 2009.
It focused on high-end laptop and desktop computers.
That was followed by a series of all-in-one printer/scanner
models.
By 2020 there were over 50 ENVY
brand models.
These are expensive!
US$ 400–500,
and I don't want to think about the ink cost.
It's for, among other things, printing photos.
It plugs directly into mains power,
and has a small color touch screen control panel.
I picked up an ENVY 5530 at a second-hand store.
US$ 15 is more in my price range.
I just want a scanner that's better than the older, cheaper,
more battered, worse performing scanner I had picked up
at the same place.
Amazon
ASIN: B00GYR791Q
Let's see how it shows up.
First with lsusb
and then with sane-find-scanner
.
Then finally with scanimage -L
.
$ lsusb | grep HP Bus 002 Device 007: ID 03f0:c311 HP, Inc ENVY 5530 series $ sane-find-scanner # sane-find-scanner will now attempt to detect your scanner. If the # result is different from what you expected, first make sure your # scanner is powered up and properly connected to your computer. # No SCSI scanners found. If you expected something different, make sure that # you have loaded a kernel SCSI driver for your SCSI adapter. # Also you need support for SCSI Generic (sg) in your operating system. # If using Linux, try "modprobe sg". found USB scanner (vendor=0x03f0 [HP], product=0xc311 [ENVY 5530 series]) at libusb:002:007 could not fetch string descriptor: Pipe error # Your USB scanner was (probably) detected. It may or may not be supported by # SANE. Try scanimage -L and read the backend's manpage. # Not checking for parallel port scanners. # Most Scanners connected to the parallel port or other proprietary ports # can't be detected by this program. $ scanimage -L device `hpaio:/usb/ENVY_5530_series?serial=CN4B73110805XT' is a Hewlett-Packard ENVY_5530_series all-in-one
Failed to start scanner
I started experimenting with my new scanner.
It would be detected, but when I started a Preview scan
with xsane
it would stop and pop up an
error window reading:
Failed to start scanner
I tried simple-scan
and it did the same.
Management
The trick is:
Remove the ippusbxd
package.
That package allows USB-connected printers to be seen
as regular network printers running IPP.
But I don't want to do that — I want to use the ENVY device as a USB-connected scanner. I do all my printing on a sturdy HP LaserJet printer I bought cheaply at Purdue University Surplus.
User Access to USB-Connected Printers and Multi-Function Devices
Get a listing of the USB devices with the
lsusb
command.
Add the -t
option to see the hierarchy as a tree.
Here is what I see right now on my system, with the
HP ENVY highlighted.
Much of this is the USB infrastructure itself,
the USB root hubs.
$ lsusb Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 011 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 010 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 009 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 008 Device 002: ID 062a:727a MosArt Semiconductor Corp. Full-Speed Mouse Bus 008 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 007: ID 03f0:c311 HP, Inc ENVY 5530 series Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 005 Device 013: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub $ lsusb -t /: Bus 11.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M /: Bus 10.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M /: Bus 09.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M /: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M |__ Port 2: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M /: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/4p, 12M /: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/2p, 12M /: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/5p, 12M |__ Port 4: Dev 13, If 0, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 4: Dev 13, If 1, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 4: Dev 13, If 2, Class=Human Interface Device, Driver=usbhid, 12M /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/5p, 12M /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/4p, 480M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/5p, 480M |__ Port 5: Dev 7, If 0, Class=Vendor Specific Class, Driver=, 480M |__ Port 5: Dev 7, If 1, Class=Printer, Driver=, 480M |__ Port 5: Dev 7, If 2, Class=Mass Storage, Driver=usb-storage, 480M |__ Port 5: Dev 7, If 3, Class=Vendor Specific Class, Driver=, 480M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/5p, 480M |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
The HP multifunction device is currently device 007 on bus 002. If I unplugged its cable and then reconnected it to the same port, or if I simply powered the device off and then back on again, it will of course still be on bus 002 but it will get a new device number. It's currently #7 because I have turned it off and back on several times while fixing this problem.
The kernel creates device nodes under /dev
as it detects devices.
USB devices appear under
/dev/bus/usb/bus_number/*
.
Since the multi-function scanner device is
currently device 007 on bus 002,
it appears as /dev/bus/usb/002/007
.
Notice that members of the scanner
group
have read/write access to it:
$ ls -l /dev/bus/usb/002/ total 0 crw-rw-r-- 1 root root 189, 128 Dec 3 12:47 001 crw-rw-r--+ 1 root lp 189, 134 Dec 3 12:55 007
Notice the trailing "+" on that entry, indicating that an extended access-control list (or ACL) has been created. Let's see what that is:
$ getfacl /dev/bus/usb/002/007 getfacl: Removing leading '/' from absolute path names # file: dev/bus/usb/002/007 # owner: root # group: lp user::rw- user:cromwell:rw- group::rw- mask::rw- other::r--
As the user logged in on the console, I have been
granted rw-
permission: read and write
(but not execute).
SysFS
You could go much deeper by
exploring /sys
and the SysFS hierarchy
but we don't need to go down that rabbit hole
to solve this problem!
You may also want to make sure that your user account is a
member of the scanner
group,
for using non-printing scanner models.
$ id cromwell uid=1000(cromwell) gid=1000(cromwell) groups=1000(cromwell),...,12(lp)
,...,120(scanner)
,... $ grep scanner /etc/group scanner:x:120:saned,cromwell
If your account is not yet a member of the
scanner
group, fix that problem first.
Become root
and either do something
complicated with usermod
or simply edit the file /etc/group
.
Then log out of your user session and log back in,
verifying with the id
command that
you are now a member of the scanner
group.
Going Deeper on USB Devices
The hierarchy
/dev/bus/usb/busnum/devnum
is maintained by the kernel.
But the names are 3-digit numbers, and devices are
renumbered when disconnected and rediscovered.
Meaningful names may be provided if the appropriate
kernel module is allowed to load and detect them.
The file devices.txt
in the kernel documentation
(in either /usr/src/linux/Documentation
or /usr/share/doc/kernel-doc
)
lists the device names.
Printers on the parallel ports are
/dev/lp0
, lp1
, and so on.
USB-connected devices may show up under /dev/usb
.
For example, USB-connected printers may appear as
/dev/usb/lp0
through lp15
,
scanners as /dev/usb/scanner0
through scanner15
,
and Human Interface Devices (keyboards, mice, etc) as
/dev/usb/hiddev0
through hiddev15
.
However, my keyboard and mouse appear under
/dev/input/*
.
We don't need the /dev/usb
devices.
If you're still curious, look at the source code in
/usr/src/linux/drivers/usb/class/usblp.c
.
Success!
Now I have a functioning HP ENVY printer / scanner!