Specifying network scanner with scanimage

scanimage -L gives

device `v4l:/dev/video2' is a Noname HD Webcam: IR Camera virtual device
device `v4l:/dev/video0' is a Noname HD Webcam: HD Webcam virtual device
device `escl:http://[2a02:168:b9ec:0:da5d:e2ff:fe3e:921f]:8080' is a HP Color LaserJet MFP M277dw (gutenberg) platen,adf scanner

But, even though scainimage itself finds my local networked scanner (the last item in the above list) I miserably fail to find any variation on the information that scanimage gives me about the device, that is accepted as a value for scanimage --device-name.

In general, hp-scanning is the one thing that I have never managed to get to work on NixOS.

How can I make progress on this?

Adding pkgs.sane-airscan to hardware.sane.extraBackends results in one more line appearing in the output of scanimage -L:

device `v4l:/dev/video2' is a Noname HD Webcam: IR Camera virtual device
device `v4l:/dev/video0' is a Noname HD Webcam: HD Webcam virtual device
device `escl:http://[2a02:168:b9ec:0:da5d:e2ff:fe3e:921f]:8080' is a HP Color LaserJet MFP M277dw (gutenberg) platen,adf scanner
device `airscan:e0:HP Color LaserJet MFP M277dw (gutenberg)' is a eSCL HP Color LaserJet MFP M277dw (gutenberg) ip=2a02:168:b9ec:0:da5d:e2ff:fe3e:921f

and now

scanimage -d 'airscan:e0:HP Color LaserJet MFP M277dw (gutenberg)' -o scan.pdf

results in a scan of the document in the scanner appearing in scan.pdf.

This makes the scanner usable, though not conveniently (that long-winded name with space and parentheses in it is not user-friendly) and it’s puzzling that the equivalent does not work for the ecsl:... result.

if you only want to use the airscan scanner and never the escl scanner you can set
https://search.nixos.org/options?channel=23.11&show=hardware.sane.disabledDefaultBackends&from=0&size=50&sort=relevance&type=packages&query=sane+disable

hardware.sane.disabledDefaultBackends = [ "escl" ];

actually, you can probably also disable the v4l backend which detects webcams.

I was under the impression that airscan and escl were one and the same. The NixOS wiki scanners page seems to agree:

Apple AirScan or AirPrint scanning (official protocol name is eSCL)

so I’m confused as to why both airscan and ecsl appear in the output of scanimage -L, both referring to the same physical scanner.

On another machine which is on the same network to which I have copied the same configuration, scanimage -L doesn’t find the scanner at all!

I don’t really care whether I use ecsl or airscan as long as the scanner is usable. If it could be accessed using a more convenient specification than

-d 'airscan:e0:HP Color LaserJet MFP M277dw (gutenberg)'

that would be even better.

I still haven’t managed to get scanimage -d to understand the ecsl version, even though it is scanimage -L which tells me about its existence in the first place. All very confusing.

if you disable all backends but airscan, you only get one scanner, and you don’t have to specify -d anymore.

About the two backends: escl is builtin but less powerful than airscan, which is third party. Both can find the same scanner (but airscan can detect more).

Yes, that works on the first machine. Thanks!

The second one still doesn’t find the scanner :frowning:

maybe enabling avahi would fix that?

I already have

  services.avahi.enable  = true;
  services.avahi.nssmdns = true;
  services.avahi.publish.enable = true;
  services.avahi.publish.addresses = true;
  services.avahi.publish.userServices = true;