[avahi] Advertising multiple printer queues using Avahi

Miguel Lopes Santos Ramos miguel at anjos.strangled.net
Sun May 11 07:45:28 PDT 2008


> From: Lennart Poettering <lennart at poettering.net>
>
> On Sun, 11.05.08 13:42, Miguel Lopes Santos Ramos (miguel at anjos.strangled.net) wrote:
> > How can I achieve having more than one TXT record for the same
> > service?
>
> You cannot do this with static service definition files. It's very
> very uncommon to do so, Sorry. You can do this only when talking
> to Avahi as a normal D-Bus client.
>
> > - If I have several service elements inside service-group, the file seems to be
> > ignored by avahi-daemon (seems to be not allowed).
>
> Having multiple services in the same group should work fine, but
> requires different service names/types for each service you define.
> It's not what you want to do here anyway.

So, the reason why the service file I'm attaching bellow doesn't work is because
the service type is the same, right?
Would it work in different service files with different names, that is, two
services with different names but equal types?

>
> > - Do I need multiple files? Isn't there any sort of collision
> > problem?
>
> You basically need to hack your own client. No way around it.
>
> BTW, you know that CUPS links fine against Avahi these days (via our
> Bonjour compat)? CUPS can register printers properly by itself, no
> need for manual intervention.
>
> Lennart

Yeah, thanks, I'll probably have to start using CUPS here. Up to now I have
stuck with LPD (and Samba) because it's part of FreeBSD, small and simple
(if you can do shell scripts).

I have gotten the Mac to find out about the printer and select the appropriate
driver but it seems to have trouble communicating with LPD, maybe an
authentication issue; if I can't fix it, I'll switch to CUPS. In the meanwhile,
I'll read a bit about gutenprint.

I'm posting my configuration files here as they may still be of use to others.

Miguel

-- /usr/local/etc/avahi/services/printer.service
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name replace-wildcards="yes">Epson em %h</name>
  <service>
    <type>_printer._tcp</type>
    <port>515</port>
    <txt-record>txtvers=1</txt-record>
    <txt-record>qtotal=2</txt-record>
    <txt-record>rp=stcolor</txt-record>
    <txt-record>ty=Epson Stylus Color 740</txt-record>
    <txt-record>priority=50</txt-record>
    <txt-record>pdl=application/postscript</txt-record>
    <txt-record>Transparent=T</txt-record>
    <txt-record>Binary=T</txt-record>
    <txt-record>Color=T</txt-record>
  </service>
  <service>
    <type>_printer._tcp</type>
    <port>515</port>
    <txt-record>txtvers=1</txt-record>
    <txt-record>qtotal=2</txt-record>
    <txt-record>rp=stcolor.raw</txt-record>
    <txt-record>ty=Epson Stylus Color 740</txt-record>
    <txt-record>priority=40</txt-record>
    <txt-record>pdl=text/plain</txt-record>
    <txt-record>usb_MFG=Epson</txt-record>
    <txt-record>usb_MDL=Stylus Color 740</txt-record>
    <txt-record>Transparent=T</txt-record>
    <txt-record>Binary=T</txt-record>
    <txt-record>Color=T</txt-record>
  </service>
</service-group>

-- /etc/printcap
stcolor.raw|Epson Stylus COLOR 740:\
	#:rm=lpr.anjos.strangled.net:rp=stcolor.raw:\
	:lp=/dev/lpt0:\
	:sd=/var/spool/lpd/stcolor.raw:\
	:lf=/var/log/lpd-errs:\
	:sh:
lp|ps|stcolor|Epson Stylus COLOR 740 via GhostScript:\
	#:rm=lpr.anjos.strangled.net:rp=stcolor:\
	:lp=/dev/null:\
	:sd=/var/spool/lpd/stcolor:\
	:lf=/var/log/lpd-errs:\
	:if=/usr/local/libexec/lpr/filt/indirect/stcolor/gsif:\
	:df=/usr/local/libexec/lpr/filt/indirect/stcolor/gsdf:\
	:pl=66:pw=80:sh:



More information about the avahi mailing list