Skip to content

Subtype doesn't seem to work #1287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mmuszkow opened this issue Oct 25, 2023 · 1 comment
Open

Subtype doesn't seem to work #1287

mmuszkow opened this issue Oct 25, 2023 · 1 comment

Comments

@mmuszkow
Copy link

I am trying to announce an AirPrint printer with this library in my local network, so I can print from it on iOS. I managed to do it with dns-sd (macOS) using

dns-sd -R PRINTER0 _ipps._tcp.,_universal . 631 \
txtvers=1 \
qtotal=1 \
rp="printers/PRINTER0" \
ty="Generic model" \
note="building 1" \
product="(generic)" \
pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/pwg-raster,image/urf \
TLS=1.2 \
Copies=T \
printer-state=3 \
printer-type=0x8094C6 \
URF="none"

as well as avahi daemon (Linux) using same TXT records, but I fail with this library.

info = ServiceInfo(
        '_universal._sub._ipps._tcp.local.',
        'PRINTER0._ipps._tcp.local.',
        #server = 'mymac.local',
        port = 631,
        properties = properties # TXT records same as in dns-sd
)
zeroconf = Zeroconf(ip_version=IPVersion.V4Only)
zeroconf.register_service(info)
try:
    while True:
        sleep(0.1)
except KeyboardInterrupt:
    pass
finally:
    zeroconf.unregister_service(info)
    zeroconf.close()

The issue seems to be related to subtypes handling. With _universal._sub prefix I cannot even detect the service using avahi-browse (Linux) or Discovery.app (macOS). The issue is similar to #275, #304 and #109.

@lava
Copy link

lava commented May 11, 2024

I believe the issue is that the subtype is supposed to be a PTR record pointing to the SRV record of the parent type.

The PTR record for a ServiceInfo is generated from it's type and name, but the constructor of ServiceInfo checks that there are no two entries with the same name so I think to make this work one would have to add a new subtypes= parameter to the service info constructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants