package init

This commit is contained in:
small_leek 2020-02-14 03:33:01 -05:00
parent 2479ac56bb
commit 095129bf40
8 changed files with 279 additions and 0 deletions

View File

@ -0,0 +1,13 @@
diff -up sane-backends-1.0.28/backend/genesys_gl841.cc.genesys-regression sane-backends-1.0.28/backend/genesys_gl841.cc
--- sane-backends-1.0.28/backend/genesys_gl841.cc.genesys-regression 2019-10-14 13:11:10.772763713 +0200
+++ sane-backends-1.0.28/backend/genesys_gl841.cc 2019-10-14 13:11:57.602389188 +0200
@@ -5042,6 +5042,9 @@ gl841_init (Genesys_Device * dev)
/* Set analog frontend */
RIE (gl841_set_fe(dev, sensor, AFE_INIT));
+ // FIXME: slow_back_home modifies dev->calib_reg and requires it to be filled
+ dev->calib_reg = dev->reg;
+
/* Move home */
RIE (gl841_slow_back_home (dev, SANE_TRUE));

2
66-saned.rules Normal file
View File

@ -0,0 +1,2 @@
# udev rule for saned (SANE scanning daemon) to be able to write on usb port
ENV{libsane_matched}=="yes", ENV{DEVNAME}!="", RUN+="/usr/bin/setfacl -m g:saned:rw $env{DEVNAME}"

BIN
sane-backends-1.0.28.tar.gz Normal file

Binary file not shown.

207
sane-backends.spec Normal file
View File

@ -0,0 +1,207 @@
%global __provides_exclude_from ^%{_libdir}/sane/.*\.so.*$
%global __requires_exclude ^libsane-.*\.so\.[0-9]*(\(\).*)?+$
Name: sane-backends
Version: 1.0.28
Release: 6
Summary: Scanner access software
License: GPLv2+ and GPLv2+ with exceptions and Public Domain and IJG and LGPLv2+ and MIT
URL: http://www.sane-project.org
Source0: https://gitlab.com/sane-project/backends/uploads/9e718daff347826f4cfe21126c8d5091/%{name}-%{version}.tar.gz
Source2: saned.socket
Source3: saned@.service.in
Source4: 66-saned.rules
BuildRequires: gcc-c++ texlive-latex libusbx-devel libieee1284-devel libjpeg-devel libpng-devel
BuildRequires: libtiff-devel libv4l-devel gettext systemd-devel gphoto2-devel systemd
Requires: libpng systemd >= 196 systemd-udev >= 196
Requires: sane-backends-libs = %{version}-%{release}
Patch0000: 0001-genesys-Make-sure-calib_reg-are-available-before-wri.patch
Patch0001: sane-xerox-mfp-blacklist-C460-for-JPEG.patch
Patch0002: sane-genesys-vector-glibcxxassert.patch
%description
SANE (Scanner Access Now Easy) is a sane and simple interface to both local and networked scanners
and other image acquisition devices like digital still and video cameras.
%package help
Summary: Help documents for sane-backends
BuildArch: noarch
Provides: sane-backends-doc = %{version}-%{release}
Obsoletes: sane-backends < 1.0.23-10 sane-backends-doc < %{version}-%{release}
Conflicts: sane-backends < 1.0.23-10
%description help
The sane-backends-help package conatins manual pages and documents for sane-backends.
%package libs
Summary: SANE libraries
Recommends: sane-backends-drivers-cameras = %{version}-%{release}
Recommends: sane-backends-drivers-scanners = %{version}-%{release}
%description libs
This package contains the SANE libraries which are needed by applications that want to access scanners.
%package devel
Summary: SANE development toolkit
Requires: sane-backends = %{version}-%{release} sane-backends-libs = %{version}-%{release}
Requires: sane-backends-drivers-scanners = %{version}-%{release} sane-backends-drivers-cameras = %{version}-%{release}
Requires: libusbx-devel libieee1284-devel libjpeg-devel libtiff-devel pkgconfig
%description devel
This package contains libraries and header files for writing Scanner Access Now Easy (SANE) modules.
%package drivers-scanners
Summary: SANE backend drivers for scanners
Requires: sane-backends = %{version}-%{release} sane-backends-libs = %{version}-%{release}
%description drivers-scanners
This package contains backend drivers to access scanner hardware through SANE.
%package drivers-cameras
Summary: Scanner backend drivers for digital cameras
Requires: sane-backends = %{version}-%{release} sane-backends-libs = %{version}-%{release}
%description drivers-cameras
This package contains backend drivers to access digital cameras through SANE.
%package daemon
Summary: Scanner network daemon
Requires: sane-backends = %{version}-%{release} sane-backends-libs = %{version}-%{release}
Requires(pre): shadow-utils
%{?systemd_requires}
%description daemon
This package contains saned which is the daemon that allows remote clients to access image acquisition devices available on the local host.
%prep
%autosetup -p1
%build
CFLAGS="%optflags -fno-strict-aliasing"
%configure --with-gphoto2=%{_prefix} --with-docdir=%{_docdir}/sane-backends --with-systemd \
--disable-locking --disable-rpath --with-usb --enable-pthread
%make_build
_topdir="$PWD"
cd tools
./sane-desc -m udev+hwdb -s "${_topdir}/doc/descriptions:${_topdir}/doc/descriptions-external" -d0 > udev/sane-backends.rules
./sane-desc -m hwdb -s "${_topdir}/doc/descriptions:${_topdir}/doc/descriptions-external" -d0 > udev/sane-backends.hwdb
cd ../
%install
%make_install
install -d %{buildroot}%{_datadir}/pixmaps
rm -f %{buildroot}%{_bindir}/gamma4scanimage
%delete_la_and_a
install -d %{buildroot}%{_prefix}/lib/udev/rules.d
install -d %{buildroot}%{_prefix}/lib/udev/hwdb.d
install -m 0644 tools/udev/sane-backends.rules %{buildroot}%{_prefix}/lib/udev/rules.d/65-sane-backends.rules
install -m 0644 tools/udev/sane-backends.hwdb %{buildroot}%{_prefix}/lib/udev/hwdb.d/20-sane-backends.hwdb
install -m 0644 %{SOURCE4} %{buildroot}%{_prefix}/lib/udev/rules.d/66-saned.rules
install -d %{buildroot}%{_libdir}/pkgconfig
install -m 0644 tools/sane-backends.pc %{buildroot}%{_libdir}/pkgconfig/
install -d %{buildroot}%{_docdir}/sane-backends-help
cd %{buildroot}%{_docdir}/sane-backends
for f in *; do
if [ -d "$f" ]; then
mv "$f" "%{buildroot}%{_docdir}/sane-backends-help/${f}"
else
case "$f" in
AUTHORS|ChangeLog|COPYING|LICENSE|NEWS|PROBLEMS|README|README.linux)
;;
backend-writing.txt|PROJECTS|sane-*.html)
mv "$f" "%{buildroot}%{_docdir}/sane-backends-help/${f}"
;;
*)
rm -rf "$f"
;;
esac
fi
done
cd -
install -m 755 -d %{buildroot}%{_unitdir}
install -m 644 %{SOURCE2} %{buildroot}%{_unitdir}
sed 's|@CONFIGDIR@|%{_sysconfdir}/sane.d|g' < %{SOURCE3} > saned@.service
install -m 644 saned@.service %{buildroot}%{_unitdir}
%find_lang sane-backends
%post
udevadm hwdb --update >/dev/null 2>&1 || :
%postun
udevadm hwdb --update >/dev/null 2>&1 || :
%post libs
/sbin/ldconfig
%postun libs
/sbin/ldconfig
%pre daemon
getent group saned >/dev/null || groupadd -r saned
getent passwd saned >/dev/null || \
useradd -r -g saned -d %{_datadir}/sane -s /sbin/nologin \
-c "SANE scanner daemon user" saned
exit 0
%post daemon
%systemd_post saned.socket
%preun daemon
%systemd_preun saned.socket
%postun daemon
%systemd_postun saned.socket
%files -f sane-backends.lang
%dir %{_docdir}/sane-backends
%dir %{_libdir}/sane
%dir %{_datadir}/sane
%dir /etc/sane.d
%dir /etc/sane.d/dll.d
%doc %{_docdir}/sane-backends/*
%license %{_docdir}/sane-backends/LICENSE
%config(noreplace) /etc/sane.d/*.conf
%{_prefix}/lib/udev/*
%{_bindir}/*
%exclude %{_prefix}/lib/udev/rules.d/66-saned.rules
%exclude %{_bindir}/sane-config
%files help
%doc %{_docdir}/sane-backends-help
%{_mandir}/*/*
%exclude %{_mandir}/man1/gamma4scanimage.1*
%files libs
%{_libdir}/libsane.so.*
%files devel
%{_bindir}/sane-config
%{_includedir}/sane
%{_libdir}/libsane.so
%{_libdir}/pkgconfig/sane-backends.pc
%files drivers-scanners
%{_libdir}/sane/*
%exclude %{_libdir}/sane/libsane-gphoto2.*
%files drivers-cameras
%{_libdir}/sane/libsane-gphoto2.*
%files daemon
%{_sbindir}/saned
%{_prefix}/lib/udev/rules.d/66-saned.rules
%{_unitdir}/*
%changelog
* Fri Feb 14 2020 Senlin Xia <xiasenlin1@huawei.com> - 1.0.28-6
- Package init

View File

@ -0,0 +1,17 @@
diff --git a/backend/genesys.cc b/backend/genesys.cc
index 0368e21..5ec37bc 100644
--- a/backend/genesys.cc
+++ b/backend/genesys.cc
@@ -778,6 +778,12 @@ void sanei_genesys_create_default_gamma_table(Genesys_Device* dev,
size = 4096;
}
max = size - 1;
+ } else if (dev->model->asic_type == GENESYS_GL846
+ || dev->model->asic_type == GENESYS_GL847
+ || dev->model->asic_type == GENESYS_GL848
+ || dev->model->asic_type == GENESYS_GL124) {
+ size = 257;
+ max = 65535;
} else {
size = 256;
max = 65535;

View File

@ -0,0 +1,12 @@
diff --git a/backend/xerox_mfp.c b/backend/xerox_mfp.c
index b7fcbee..2cb73ee 100644
--- a/backend/xerox_mfp.c
+++ b/backend/xerox_mfp.c
@@ -209,6 +209,7 @@ static int isSupportedDevice(struct device __sane_unused__ *dev)
if (dev->compressionTypes & (1 << 6)) {
/* blacklist malfunctioning device(s) */
if (!strncmp(dev->sane.model, "SCX-4500W", 9) ||
+ !strncmp(dev->sane.model, "C460", 4) ||
!strncmp(dev->sane.model, "M288x", 5))
return 0;
return 1;

10
saned.socket Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=saned incoming socket
[Socket]
ListenStream=6566
Accept=yes
MaxConnections=1
[Install]
WantedBy=sockets.target

18
saned@.service.in Normal file
View File

@ -0,0 +1,18 @@
[Unit]
Description=Scanner Service
Requires=saned.socket
[Service]
ExecStart=/usr/sbin/saned
User=saned
Group=saned
StandardInput=null
StandardOutput=syslog
StandardError=syslog
Environment=SANE_CONFIG_DIR=@CONFIGDIR@
# If you need to debug your configuration uncomment the next line and
# change it as appropriate to set the desired debug options
# Environment=SANE_DEBUG_DLL=255 SANE_DEBUG_NET=255
[Install]
Also=saned.socket