Bug 245540 - [NEW PORT] graphics/sane-airscan: AirScan backend for SANE
Summary: [NEW PORT] graphics/sane-airscan: AirScan backend for SANE
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Daniel Engberg
URL:
Keywords: feature, needs-qa
Depends on:
Blocks:
 
Reported: 2020-04-11 18:16 UTC by Henry Hu
Modified: 2021-09-20 08:08 UTC (History)
7 users (show)

See Also:
henry.hu.sh: maintainer-feedback+


Attachments
shar for the new port (6.37 KB, text/plain)
2020-04-11 18:16 UTC, Henry Hu
no flags Details
poudriere log for 11.3/i386 (28.86 KB, text/plain)
2020-04-11 18:19 UTC, Henry Hu
no flags Details
poudriere log for 12.1/amd64 (28.43 KB, text/plain)
2020-04-11 18:20 UTC, Henry Hu
no flags Details
shar for the new port (4.78 KB, text/plain)
2021-01-19 04:44 UTC, Henry Hu
no flags Details
updated to 0.99.24 (3.65 KB, patch)
2021-02-10 03:52 UTC, Henry Hu
no flags Details | Diff
fixed patch for new version (3.73 KB, text/plain)
2021-02-10 03:59 UTC, Henry Hu
no flags Details
Poudriere log for 12.2-RELEASE-p2/amd64 (54.93 KB, text/plain)
2021-02-10 04:03 UTC, Henry Hu
no flags Details
Poudriere log for 12.2-RELEASE-p2/i386 (55.30 KB, text/plain)
2021-02-10 04:25 UTC, Henry Hu
no flags Details
updated shar (4.19 KB, text/plain)
2021-02-11 03:59 UTC, Henry Hu
no flags Details
Patch for sane-airscan - 0.99.26 (4.41 KB, patch)
2021-09-06 04:05 UTC, Daniel Engberg
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Henry Hu 2020-04-11 18:16:36 UTC
Created attachment 213294 [details]
shar for the new port

This is an Apple AirScan (eSCL) driver for Scanner Access Now Easy (SANE). It automatically discovers AirScan-compatible scanners in the local network, and makes them available to the SANE framework.

Personally, I used it successfully with my Canon TS9020 printer.
Comment 1 Henry Hu 2020-04-11 18:19:53 UTC
Created attachment 213295 [details]
poudriere log for 11.3/i386
Comment 2 Henry Hu 2020-04-11 18:20:14 UTC
Created attachment 213296 [details]
poudriere log for 12.1/amd64
Comment 3 Tobias Kortkamp freebsd_committer freebsd_triage 2020-04-11 18:23:04 UTC
The latest version of sane-backends already comes with an escl driver
when built with AVAHI=on.  How is this different and do we really need
another driver?
Comment 4 Henry Hu 2020-04-11 23:11:04 UTC
Strictly speaking, we don't: they provide mostly the same functionality (driver for eSCL scanners). However, we don't restrict port collection to "only 1 port for a feature", right?

I tried to enable escl backend and it didnt' work, then I moved to this backend. However I noticed later that it's not installed by default. After rebuilding with AVAHI=on, it worked, although the airscan backend still have some advantage over it:
* It shows the device name, instead of IP, in device selection.
* It defaults to 300dpi which makes more sense.
* It shows geometry in a more reasonable unit (mm).
These are minor points, so they aren't different fundamentally.

So, if you say "we only want one backend, and that's the escl backend", then fine, please enable AVAHI by default, which may help other people as well, as they don't need to research on why their scanners don't "just work". Otherwise, people may at least find this port and find it useful.
Comment 5 Alexander Pevzner 2020-05-19 12:27:06 UTC
I want to notify everybody who may be interested, that I've recently released a new version of sane-airscan with added WSD protocol support.

The detailed announce can be found in the sane-devel mail list.

This version may be more difficult to port to FreeBSD, because it uses some Linux-specific stuff like rtnetlink (WS-Discovery code needs notifications when network interfaces are enabled or disabled).

Don't hesitate to contact me if you need some help
Comment 6 probono 2021-01-02 11:59:22 UTC
I can confirm that this allows one to use scanners that are announced on the local network with Microsoft WSD ("Web Services for Devices"), also known as  WS-Scan. This is very useful for devices that support WSD but do not support eSCL.

Using this, I was successfully able to scan from a HP LaserJet 200 colorMFP M276n using Xsane and skanlite on FreeBSD, which was otherwise not possible.

This is very useful, it would be great to see a port and a package for this.

Thank you very much Alexander Pevzner for making this driver and for working with me to get it to compile on FreeBSD.

Relevant FreeBSD specific build topic:
https://github.com/alexpevzner/sane-airscan/issues/111
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2021-01-03 01:22:26 UTC
^Triage: To progress this issue:

- Provide an updated patch if a "new version" (per comment 5) is appropriate, that is QA'd (with portlint, poudriere at least), in particular given "may be more difficult to port to FreeBSD" (has it been ported?), OR ...

- Confirmation, or not, from reporter/author whether or not the existing patch is (still) appropriate in its existing form without further changes for inclusion in ports, per question in comment 3 and response in comment 4
Comment 8 Alexander Pevzner 2021-01-03 21:02:45 UTC
The most recent (git) version of sane-airscan supports FreeBSD "natively", just a matter of gmake; make ginstall (assuming that you have all required libraries installed). 

I'm currently waiting for confirmation that FreeBSD-specific changes didn't break something on OpenBSD. As soon as I will get this confirmation, I'll create the next, 0.99.23 release.

So patch is probably not required.
Comment 9 Henry Hu 2021-01-19 04:44:41 UTC
Created attachment 221725 [details]
shar for the new port

Updated port.
* Updated to 0.99.23
Almost all patches are not needed. The only remaining patch is for fixing build on i386 (reported upstream: https://github.com/alexpevzner/sane-airscan/issues/117).
* Now it depends on gnutls and libpng.
* The manpage is now installed to /usr/local/share/man. I noticed some ports install there (like ncurses), while others install to /usr/local/man. Both seem to work. Is this the correct place?
Comment 10 Henry Hu 2021-02-10 03:52:27 UTC
Created attachment 222316 [details]
updated to 0.99.24

Updated to 0.99.24. The new version includes the patch for i386, so it can be removed.
Comment 11 Henry Hu 2021-02-10 03:59:45 UTC
Created attachment 222317 [details]
fixed patch for new version

Didn't notice that it added some new files. Fixed.
Comment 12 Henry Hu 2021-02-10 04:03:03 UTC
Created attachment 222318 [details]
Poudriere log for 12.2-RELEASE-p2/amd64
Comment 13 Henry Hu 2021-02-10 04:25:23 UTC
Created attachment 222320 [details]
Poudriere log for 12.2-RELEASE-p2/i386
Comment 14 Henry Hu 2021-02-10 04:26:05 UTC
Updated the port, and now it builds without patch.
Comment 15 Daniel Engberg freebsd_committer freebsd_triage 2021-02-10 07:14:58 UTC
Hi,

A few things that can be improved

Please sort USES= in alphabetical order

Make use of USES= instead of LIB_DEPENDS

jpeg-turbo --> https://svnweb.freebsd.org/ports/head/Mk/Uses/jpeg.mk?revision=556784&view=markup
libxml2 --> https://svnweb.freebsd.org/ports/head/Mk/Uses/gnome.mk?revision=564196&view=markup

Framework CFLAGS gets overridden by ones set by the port (needs fixing)

Does it pass portlint?

Best regards,
Daniel
Comment 16 Henry Hu 2021-02-11 03:59:29 UTC
Created attachment 222357 [details]
updated shar

Updated according to comments:
* moved libxml2 to USE_GNOME
* moved jpeg to USE
* sorted USE
* patched Makefile to use external CFLAGS. Kept -pthread and $(CPPFLAGS)
Comment 17 ben 2021-07-15 20:13:12 UTC
Tested Henry's latest port with a bump to version 0.99.26.  It works great with a Brother DCP-8110DN while the eSCL backend from sane-backends does not.  Please consider committing.
Comment 18 Daniel Engberg freebsd_committer freebsd_triage 2021-09-06 04:05:51 UTC
Created attachment 227699 [details]
Patch for sane-airscan - 0.99.26

sane-airscan update to latest release 0.99.26
Usage of "# $FreeBSD$" is deprecated (removed)
Removed incorrect dependencies: libepoll-shim, libsoup and gettext-runtime
Use non version specific shared lib when declaring libpng as dependency
Properly define libxml2 dependency
Make sure libsane-airscan.so is available
Disable usage of ctags during build
Convert pkg-message to UCL format
Comment 19 Daniel Engberg freebsd_committer freebsd_triage 2021-09-06 04:09:03 UTC
Hi Henry,

I update sane-airscan to latest release and made a few changes to make the port conform with guidelines, please review and runtime test these changes.

Thanks for your contribution!

Best regards,
Daniel
Comment 20 Daniel Engberg freebsd_committer freebsd_triage 2021-09-06 04:12:30 UTC
...and I forgot to add, it's cosmetical but you don't need to add multiple dependency definitions to the same lib/port (avahi-app in this case).

Best regards,
Daniel
Comment 21 Henry Hu 2021-09-11 23:37:03 UTC
Tested the new port with poudriere on 13.0-RELEASE, no problem.
Comment 22 commit-hook freebsd_committer freebsd_triage 2021-09-20 08:05:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f951db5cb274ddd5b73f59fc1f76393324105213

commit f951db5cb274ddd5b73f59fc1f76393324105213
Author:     Henry Hu <henry.hu.sh@gmail.com>
AuthorDate: 2021-09-20 07:48:59 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2021-09-20 08:04:09 +0000

    graphics/sane-airscan: New port: AirScan backend for SANE

    PR:             245540
    Approved by:    tcberner (mentor)
    Differential Revision:  https://reviews.freebsd.org/D31918

 graphics/Makefile                                |  1 +
 graphics/sane-airscan/Makefile (new)             | 31 ++++++++++++++++++++++++
 graphics/sane-airscan/distinfo (new)             |  3 +++
 graphics/sane-airscan/files/patch-Makefile (new) | 21 ++++++++++++++++
 graphics/sane-airscan/pkg-descr (new)            | 17 +++++++++++++
 graphics/sane-airscan/pkg-message (new)          | 20 +++++++++++++++
 graphics/sane-airscan/pkg-plist (new)            |  8 ++++++
 7 files changed, 101 insertions(+)
Comment 23 Daniel Engberg freebsd_committer freebsd_triage 2021-09-20 08:08:30 UTC
Committed, thanks for your contribution!