AndroidCupsPrint icon indicating copy to clipboard operation
AndroidCupsPrint copied to clipboard

Automatic discovery of printers not working

Open gerroon opened this issue 9 years ago • 18 comments

Hi

Thanks for this app. And sorry for the vague title.

I have a wireless printer that has its own server and also this printer shared over a Debian Pc via the Cups server. This app finds the wireless server but no printing happens(tried with firefox page->printing). When I select the printer I see no "print" icon however I have the brothers own print plugin that seem to work.

Also it cant find any Cups printers on the network like the one I mentioned above. I have a Pdf printer that is shared over the network via Cups, that does not show up either. I also tried putting the ip addresses and the printers as I would do over with other pcs, that does not work either.

Lastly The search button does not work when I enter the add printer option. It is not clickable at all. I tried putting custom ip of the server without any suiccess.

thanks

gerroon avatar Nov 18 '16 18:11 gerroon

Do you use avahi/mDNS?

BenoitDuffez avatar Nov 21 '16 18:11 BenoitDuffez

Hi

I am not sure. Do you mean on Android or Linux? I did not anythign special myself, all the server printer stuff is as is.

gerroon avatar Nov 21 '16 20:11 gerroon

I mean on the (Linux) server. This enables auto-discovery of printers.

For the search button for manual "discovery", I haven't tested this lately so it may not work. I'll definitely test this.

BenoitDuffez avatar Nov 21 '16 20:11 BenoitDuffez

Not sure if this is the same issue, but if I enter the hostname manually in the "add printers" view, and click the search button (https://github.com/BenoitDuffez/AndroidCupsPrint/blob/master/app/src/main/res/layout/add_printers.xml#L20), nothing happens. I don't see anything relevant in the logcat either.

If I enter nothing in the field and click the button, I get 04-14 17:36:36.941 26470 26584 W System.err: java.net.UnknownHostException: http://:631/printers/ (which I expected).

Entering http://<host>:631/printers/ in my browser on my PC shows me the CUPS web page with the printers on this host. Sharing is enabled for the relevant printer.

On the other hand: In the "main view" (Settings -> Print -> Android CUPS print) I get a logcat message 04-14 17:42:28.967 26470 27018 V CUPS : No answer in mDNS response: java.net.DatagramPacket@66d1f9b

dueringa avatar Apr 14 '17 15:04 dueringa

You need to type an IP address / host name there. Then the app will try to scan that host for printers.

If you don't want to type anything you need to use mDNS.

BenoitDuffez avatar Apr 14 '17 17:04 BenoitDuffez

Regarding the automatic configuration, I activated the avahi service on my Raspberry Pi, where CUPS is running (and the printer is connected). The printer was found.

The search for printers on the entered host, however, didn't return any results. I guess I'll install Android Studio in the course of the next days and try to debug it to find out what goes wrong.

dueringa avatar Apr 16 '17 13:04 dueringa

Yeah that feature is flaky at best. I think that mDNS is so good that only it should be used. I didn't test the scan host feature to be honest. I'd be glad to accept your contributions though!

BenoitDuffez avatar Apr 16 '17 14:04 BenoitDuffez

Automatic discovery of printers not working still not working!

I have correct setup. Linux client successfully discovers cups server with no cups* packages, only avahi-daemon.

That time I switch "Android CUPS Print" service in "Printing" settings I got in logcat:

V CUPS : No answer in mDNS response: java.net.DatagramPacket@186e79d V CUPS : No answer in mDNS response: java.net.DatagramPacket@170a412 D CUPS : onPrintersDiscovered({})

but "tcpdump -vni br-lan udp and port 5353" show answers:

10.8.8.4 - phone 10.8.8.1 - cups server with avahi-daemon 10.8.8.6 - printer, accessible only from 10.8.8.1, 10.8.8.4 doesn't see it

IP 10.8.8.4.5353 > 224.0.0.251.5353: 0 PTR (QM)? _ipp._tcp.local. (33) IP 10.8.8.6.5353 > 224.0.0.251.5353: 0*- [0q] 1/0/5 PTR Samsung ML-2160 Series (SEC001599E1EEE9)._ipp._tcp.local. (654) IP 10.8.8.1.5353 > 224.0.0.251.5353: 0*- [0q] 5/0/0 PTR Samsung ML-2160 Series @ roo._ipp._tcp.local., (Cache flush) TXT "txtvers=1" "qtotal=1" "rp=printers/printer" "ty=Samsung ML-2165, 2.0.0" "adminurl=https://roo.local:631/printers/printer" "priority=0" "product=(ML-2165)" "pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/pwg-raster,image/urf" "URF=DM3" "UUID=3154c96e-9ce7-33ae-6523-7381f61a1601" "TLS=1.2" "Duplex=T" "Copies=T" "printer-state=3" "printer-type=0x3056", (Cache flush) SRV roo.local.:631 0 0, (Cache flush) AAAA fe80::20d:b9ff:fe4a:f806, (Cache flush) A 10.8.8.1 (520) IP 10.8.8.4.5353 > 224.0.0.251.5353: 0 PTR (QM)? _ipps._tcp.local. (34) IP 10.8.8.1.5353 > 224.0.0.251.5353: 0*- [0q] 5/0/0 PTR Samsung ML-2160 Series @ roo._ipps._tcp.local., (Cache flush) TXT "txtvers=1" "qtotal=1" "rp=printers/printer" "ty=Samsung ML-2165, 2.0.0" "adminurl=https://roo.local:631/printers/printer" "priority=0" "product=(ML-2165)" "pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/pwg-raster,image/urf" "URF=DM3" "UUID=3154c96e-9ce7-33ae-6523-7381f61a1601" "TLS=1.2" "Duplex=T" "Copies=T" "printer-state=3" "printer-type=0x3056", (Cache flush) SRV roo.local.:631 0 0, (Cache flush) AAAA fe80::20d:b9ff:fe4a:f806, (Cache flush) A 10.8.8.1 (521)

When I add printer manually by https://roo.local:631/printers/printer or http://roo.local:631/printers/printer all works fine.

532910 avatar Mar 09 '18 05:03 532910

Is this still active? I've been using mDNS for years and it's working like a charm, and I haven't got so many feedback about this issue. I'm tempted to close this.

BenoitDuffez avatar Sep 06 '18 22:09 BenoitDuffez

Yes, this is still active! I can make a qemu/virtualbox image with cups and avahi.

532910 avatar Sep 06 '18 23:09 532910

BTW, "Default Print Service" from the lineageos 15.1 sucessfully founds the printer.

532910 avatar Sep 06 '18 23:09 532910

Gah. Sorry but I don't like lineage. I've used it on a very old device to get a more recent version of Android, and it breaks a lot of internal APIs. I'm afraid I won't be providing support on non-stock versions.

BenoitDuffez avatar Sep 07 '18 00:09 BenoitDuffez

Have you reproduced this on recent beta builds? If you have the Play Store, please reproduce on the version that will be released tomorrow, and post logs here. If you don't have the Play Store, please compile an apk from the latest commit in develop and post logs. Thanks

BenoitDuffez avatar Sep 27 '18 19:09 BenoitDuffez

ok, I'll test it again within a week

532910 avatar Sep 28 '18 03:09 532910

Please let me know whether this can be closed.

BenoitDuffez avatar Dec 15 '18 22:12 BenoitDuffez

Sorry for late response. I still experience this issue. I'll do more tests for research.

532910 avatar Dec 15 '18 23:12 532910

I've done more tests for research and now I don't experience this issue more (: The main change was an upgrade from debian stretch to buster (cups 2.2.1-8+deb9u3 -> 2.2.10-6, avahi-daemon 0.6.32-2 -> 0.7-4+b1)

532910 avatar May 17 '19 22:05 532910

So it can be closed.

532910 avatar May 17 '19 22:05 532910