ippusbxd
ippusbxd copied to clipboard
eSCL is not advertised, if system booted with network cable unplugged
One of my users reported an issue, that eSCL is not advertised, if at the system boot time network cable is not plugged in:
https://github.com/alexpevzner/sane-airscan/issues/27
What is interesting, IPP printer is advertised, while eSCL scanner is not.
I've tried to investigate the problem by myself, but unfortunately, I was not able to reproduce it locally.
Hi @alexpevzner I wonder if it has something to do with that. A tip didn't come through, so I'm jumping! https://github.com/OpenPrinting/ippusbxd/issues/32
I'm not sure these bugs are related. IPP printer still advertised. When process crashes, Ahavi removes all advertisings made by the process.
The sane-airscan bug I've mentioned before contains output of the avahi-browse -rt -a
command
I really think it's related, issue #32 was planting ippusbxd. All I did was consider the mistake. If the value is zero, I'm out, so I invalidate the record. I will try to test this weekend on Canon IR C3250i hoping that it is close enough to the camera in question.
Why it works differently when network cable is connected and when not connected?
Indeed the question is excellent. Maybe avahi is looking for a network and takes more time (hypothesis).
But IPP printer is advertised in both cases...
ippusbxd serves for using the device via USB, this is fully independent of whether there is also a network connection available between your computer and your printer. Generally, it should be easier and more reliable to use your multi-function device via network, especially via wired ethernet. Also a network connection allows easy sharing of the device. Advanatage of the USB connection is the possibility to use the device without any network available (but note that some devices use Wi-Fi Direct and so are their own access point, allowing for using them without (W)LAN available) or if confidential data is supposed to be printed or scanned, so that spying on the network will be impossible.
Hi @tillkamppeter,
in both cases, device connected to USB and accessed through localhost:60000. The difference is if the network cable connected to the computer at the boot time or not. If connected, eSCL service is advertised, if not connected, it is not advertised. IPP printer advertised in both cases.
First, if the network cable is not connected to the computer, does the computer have any network interface (like Wi-Fi for example) or does it have no internet connection at all, leaving "lo" as the only network interface?
Is there in this case any DNS-SD advertisement of the printer by Avahi? Is it only the printing part (-tcp._ipp
) and not the scanning part (_tcp._uscan
)? Is ipp-usb doing this correctly? @Ordissimo, you have added the advertising of the scanner part to ippusbxd, can you have a look? Thanks.
I believe, if cable is not connected, there is only loopback interface, though I didn't ask explicitly. Yes, _ipp._tcp is advertised, _uscan._tcp is not.
And BTW, I requested user to send me a full dump of whatever Avahi discovers. Even if network cable is connected, everything Avahi reports in on loopback anyway.
About ipp-usb, I've asked to try with it, but have no response yet.
@tillkamppeter, yeah, I'll take a look. Thank's @alexpevzner
@alexpevzner it's the scanner detection that's not working. nothing to do with avahi. either the http request failed or the returned xml is invalid. we need to debug ippusbxd. you think that's possible?
XML should be the same when network cable connected and when not.
I suggest to read source code very carefully and try to understand, what is the difference between _ipp._tcp and _uscan._tcp advertising. Actually, I've tried by myself and have not found anything seriously wrong, but you know this code better, plus functions/variables names are in French :-)
I tried to reproduce the problem, but without success. Please note, Avahi version there is 0.8, I tried with 0.7. Avahi behaviour may be slightly different, when there is no real network connections.
This is where it fails, an http request and an xml parsing. I'm leaning towards the http request, but no guarantee.
if (is_scanner_present(scanner, g_options.real_port) == 0 || scanner == NULL)
goto noscanner;
I've given it multiple tries. I never reproduce the bug I mentioned. We'll need more information to understand the problem. With and without cable, with and without Wi-Fi
Version du serveur : avahi 0.7 ; nom d'hôte : thierry-Inspiron-5480.local
Domaine E Ifce Prot Nom Type
+ lo IPv4 DCP-L2530DW series Web Site local
+ lo IPv4 DCP-L2530DW series _uscan._tcp local
+ lo IPv4 DCP-L2530DW series Internet Printer local
+ lo IPv4 DCP-L2530DW series UNIX Printer local
= lo IPv4 DCP-L2530DW series Web Site local
hostname = [thierry-Inspiron-5480.local]
address = [127.0.0.1]
port = [60000]
txt = []
= lo IPv4 DCP-L2530DW series _uscan._tcp local
hostname = [thierry-Inspiron-5480.local]
address = [127.0.0.1]
port = [60000]
txt = ["txtvers=1" "vers=2.63" "rs=eSCL" "ty=Brother DCP-L2530DW series" "pdl=application/pdf,image/jpeg" "cs=binary,grayscale,color" "duplex=F" "adminurl=http://127.0.0.1:60000/net/net/airprint.html" "UUID=e3248000-80ce-11db-8000-c0b5d7e62277" "note=" "representation=http://127.0.0.1:60000/icons/device-icons-128.png"]
= lo IPv4 DCP-L2530DW series Internet Printer local
hostname = [thierry-Inspiron-5480.local]
address = [127.0.0.1]
port = [60000]
txt = ["rfo=ipp/faxout" "Fax=T" "Duplex=T" "PaperMax=legal-A4" "URF=W8,CP1,IS4-1,MT1-3-4-5-8,OB10,PQ3-4-5,RS300-600-1200,V1.4,DM1" "pdl=application/octet-stream,image/urf,image/pwg-raster" "product=(Brother DCP-L2530DW series[en])" "ty=Brother DCP-L2530DW series[en]" "note=" "Color=F" "kind=document,envelope,label,postcard" "mopria-certified=1.3" "UUID=e3248000-80ce-11db-8000-c0b5d7e62277" "adminurl=http://127.0.0.1:60000/net/net/airprint.html" "qtotal=1" "txtvers=1" "priority=60" "usb_MDL=DCP-L2530DW series" "usb_MFG=Brother" "rp=ipp/print"]
My laptop has no Wi-Fi. May my scanner have some problem... Anyway, I will try another scanner and the ipp-usb next week.
Could you be more specific? Your distribution and its version. The version of ippusbxd.
Hi @Ordissimo,
I've already gathered all information here: https://github.com/alexpevzner/sane-airscan/issues/27 In short, this is Ubuntu 20.04 with ippusbxd_1.34-2.
There is also Debian 10 with the same ippusbxd version and Avahi 0.8, there _uscan._tcp is not advertised at all, regardless of network cable.
Please, follow the link above. There are also various logs, which I didn't duplicate here.
Thank's @alexpevzner I saw him after I asked. I need ippusbxd's log. I know where the code fails, I don't know if it's the http request or if the content returned is wrong to be xml.
@Ordissimo There are another infor that I didn’t mention in the alexpevzner/sane-airscan#27. Hope it’s helpful. (1) My scanner is always connected to the network. (2) On debian 10, the deamon process (Udev?) seems not to call the ippusbxd. So after OS startup, I invoke the ippusbxd manually (# ippusbxd —bus-device xx:xx —from-port 60000). And I still work out to find way to invoke ippusbxd by deamon process (Udev?)
At first, I think it’s only little issue for airscan-discover. Still now, I don’t know how to get ippusbxd log. So I may need more time ...
ippusbxd -d
It will print a lot of debug output to stdout
Do you have both Debian and Ubuntu on a same machine?
Yes, they are on the same machine. May my laotop have some problem...
@tangyanli Added debug to the ippusbxd service
sed -i 's/ippusbxd --bus-device/ippusbxd -d --bus-device/g' /lib/systemd/system/[email protected]
Retrieve logs
cat /var/log/syslog | grep -i ippusbxd
@Ordissimo Thanks a lot, I got it. The scanner is in my office. I will retrieve the log tomorrow morning. I am really sorry for not giving feedback as quick as possible on the weekend.
@Ordissimo After adding "-d", the phenomenon on Ubuntu20.04 made me confused. But on Debian10, it's clear.
ippusbxd1.log ippusbxd2.log ippusbxd3.log
Are these log useful? If not, I can summarize the phenomenon on Ubuntu20.04. It seems the "-d" influences the timeout.
@tangyanli Thanks for the logs : Fails :
- ippusbxd1.log => ligne 24131 => Capabilites[(null)]
- ippusbxd2.log => ligne 1184 => Capabilites[(null)]
- ippusbxd3.log => ligne 1185 => Capabilites[(null)]
Ok :
- ippusbxd4.log => ligne 2202 => Capabilites[<?xml ver...]
The HTTP request always fails at startup with error 405. The problem can have several causes: 1 - The HTTP device initialization is not yet available. The solution is to postpone the launch of ippusbxd. 2 - cups for HTTP request was not a judicious choice. The solution is to use libcurl. 3 - I can't find the xml correctly.
@tillkamppeter and @alexpevzner, I'd like your opinion!
I would start trying with (1), simply add some loop which repeats on failure and quites after a certain number of failed attempts.
HTTP 405 is "Method not allowed".
GET unlikely to be not allowed. I'd put on uninitialized variable.
Oh, now I see.
Failed attempt:
HEAD /eSCL/ScannerCapabilities HTTP/1.1
HTTP/1.1 405 Met hod Not Allowed
Successful attempt:
GET /eSCL/ScannerCapabilities HTTP/1.1
HTTP/1.1 200 OK
Somebody should understand, when libcups uses HEAD method instead of GET. Browsers use HEAD instead of GET to check if cache is still valid. But libcups is not browser...
@alexpevzner, Thanks for the analysis! I'm still doing a GET request, the error is in the HTTP header.
@tillkamppeter I'm trying this approach to make sure we solve the problem. I think the problem lives of libcups as @alexpevzner suggests 1.
@tangyanli You will find ippusbxd for ubuntu-20.04 and debian buster. Can you test it? 1.34