# [solved] cups + hplip, no mDNS: can't access network printer

## miket

This started out as a request for a solution to a problem, but I finally found the answer.  I'm posting this in the hopes it will be helpful--and that someone can shed light on the remaining issue.

Things used to work so nicely--but Apple and HP had to mess around and make things "easier".  It can be a big PITA.

I've got a network with an HP Officejet 7000 printer plugged directly into the network (I love network printers for that).  Yes it works, yes it works with other machines on my network, and yes I can reach its setup pages with a web browser from the new computer.  For what it's worth, I've got Bind running on this network and the host name ("officejet") resolves properly.

This is the information on the two big packages that ought to work:

net-print/cups-1.5.2-r4 is built with X acl dbus filters gnutls jpeg ldap pam perl png python slp ssl threads tiff usb.  Notably absent: avahi.  I desperately don't want that or its cousin Zeroconf.  If I could get rid of all the *kits, I'd get rid of them too.

net-print/hplip-3.12.4 is built with X acl doc hpcups hpijs kde libnotify (policykit) qt4 snmp.  I added snmp in order to make the ebuild add the configuration option network-build.

So now hp-setup finds my printer.  Life wass good--until I wanted to print a test page.

In /var/log/messages, I saw a bunch of lines that look like this:

```
Jun  6 12:08:09 idea hp-info: io/hpmud/jd.c 800: mdns lookup officejet.local retry 1...

Jun  6 12:08:09 idea hp-info: io/hpmud/jd.c 800: mdns lookup officejet.local retry 2...

Jun  6 12:08:10 idea hp-info: io/hpmud/jd.c 800: mdns lookup officejet.local retry 3...

Jun  6 12:08:10 idea hp-info: io/hpmud/jd.c 800: mdns lookup officejet.local retry 4...

Jun  6 12:08:11 idea hp-info: io/hpmud/jd.c 800: mdns lookup officejet.local retry 5...

Jun  6 12:08:11 idea hp-info: io/hpmud/jd.c 800: mdns lookup officejet.local retry 6...

```

Why oh why are these mDNS lookups here?  I've got SLP set up--why doesn't CUPS use that?  I've got a perfectly good regular DNS it could use, but no.

A suggestion I saw was to change the client.conf file, but that didn't work.  Another suggestion was to change the DeviceURI for the printer in /etc/cups/printers.conf so that it referred to the IP address rather than the hostname, which was

```
hp:/net/Officejet_7000_E809a?z=officejet
```

Since I didn't have any documentation for the hp: URI scheme, I guessed.  None of my guesses worked.

I tried an old standby:  the socket: scheme that CUPS supports and documents.  Alas, while I could make CUPS print with that, hplip didn't recognize the printer.

Finally, as I perused the HPLIP site, I stumbled upon a reference to the hp-makeuri tool.  I tried it out with my printer's IP address and, voila, there was the IP address in the URI and lo it worked.

```
hp:/net/Officejet_7000_E809a?ip=192.168.0.40
```

Works great.  No mDNS, no Avahi, no Zeroconf.  Also au revoir to Bonjour.

So here's the only issue:  I don't know how to make this work with a DNS hostname rather than a literal IP address.  (I'm talking about real, honest-to-God port-53 DNS!)

While I'm here, I have a final hint.  If you have KDE, as I do, you may have tried going into the printer setup in the KDE system settings.  If you did so, you probably experienced a hang and noticed that KDE's usual task killer won't touch it.  It does respond to sigkill, though.  This'll do the trick:

```
killall -s KILL systemsettings
```

To restore normal behavior, you have to rename a library.  Log in as root and do this rename in the /usr/lib64/kde directory:

```
mv kpython2.7pluginfactory.so kpythonpluginfactory.so
```

This worked for me in both for KDE 4.7 and 4.8.  It's a Gentoo-specific bug (I found it in the forums) and the bug is already reported.

----------

## albright

that's good, but it does not seem to work for my new hp_photosmart_5510

I had to rebuild cups with avahi to print over network and hplip *still*

does not recognize the network printer (works fine if I plug it in).

----------

## javeree

About a year ago I had a look at the code to find the answer. It is too long ago to remember exactly, but there was one of two conclusion:

1. hp-setup does not use dns at all, or 

2. It can do dns (or maybe I hacjked it in), but translates it into an IP address and hardcodes that IP address once and for all in the url. 

So even if setup could work with dns, the resulting setup would still have an IP address hardcoded, which means that if your dhcp server changes the address ....

I tried to hack around it (thinking it would be easy), but it soon began to be to have impact all over the code, and I could at that time not be bothered enough (I submitted a feature request at HP though, including some suggestions ffrom what I already found)

----------

