diff --git a/README.md b/README.md index 3a6a8be..bbb4ac2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,12 @@ # sane-backends +SANE stands for "Scanner Access Now Easy" and is an application programming interface (API) that provides standardized access to any raster image scanner hardware (flatbed scanner, hand-held scanner, video- and still-cameras, frame-grabbers, etc.). +The SANE API is public domain and its discussion and development is open to everybody. +The current source code is written for UNIX (including GNU/Linux) and is available under the GNU General Public License (the SANE API is available to proprietary applications and backends as well, however). +SANE is a universal scanner interface. +The value of such a universal interface is that it allows writing just one driver per image acquisition device rather than one driver for each device and application. +So, if you have three applications and four devices, traditionally you'd have had to write 12 different programs. +With SANE, this number is reduced to seven: the three applications plus the four drivers. +Of course, the savings get even bigger as more and more drivers and/or applications are added. +This is the libraries package. + diff --git a/libsane-backends-1.0.22-deconflict_v4l_headers.patch b/libsane-backends-1.0.22-deconflict_v4l_headers.patch new file mode 100644 index 0000000..76d4ba5 --- /dev/null +++ b/libsane-backends-1.0.22-deconflict_v4l_headers.patch @@ -0,0 +1,49 @@ +--- sane-backends-1.0.22/backend/v4l.h.deconflict-v4l 2010-12-01 15:49:58.000000000 -0800 ++++ sane-backends-1.0.22/backend/v4l.h 2011-04-01 21:44:18.797102300 -0700 +@@ -29,6 +29,8 @@ + #ifndef v4l_h + #define v4l_h + ++#include ++ + /* Kernel interface */ + /* Only the stuff we need. For more features, more defines are needed */ + +@@ -46,7 +48,7 @@ + #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ + #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ + #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ +- ++#if 0 + struct video_capability + { + char name[32]; +@@ -58,7 +60,6 @@ + int minwidth; /* Supported width */ + int minheight; /* And height */ + }; +- + struct video_picture + { + __u16 brightness; +@@ -102,9 +103,10 @@ + /* bitmap is 1024x625, a '1' bit represents a clipped pixel */ + #define VIDEO_CLIPMAP_SIZE (128 * 625) + }; +- ++#endif + #define VIDEO_MAX_FRAME 32 + ++#if 0 + struct video_mbuf + { + int size; /* Total memory to map */ +@@ -132,7 +134,7 @@ + #define VIDEO_TYPE_CAMERA 2 + __u16 norm; /* Norm set by channel */ + }; +- ++#endif + #define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */ + #define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */ + #define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */ diff --git a/libsane-backends-1.0.23-disable_resmgr.patch b/libsane-backends-1.0.23-disable_resmgr.patch new file mode 100644 index 0000000..ea87aca --- /dev/null +++ b/libsane-backends-1.0.23-disable_resmgr.patch @@ -0,0 +1,19 @@ +diff -Nru sane-backends-1.0.23.orig/configure.in sane-backends-1.0.23/configure.in +--- sane-backends-1.0.23.orig/configure.in 2012-08-19 22:31:34.000000000 +0200 ++++ sane-backends-1.0.23/configure.in 2012-09-29 12:07:23.264203400 +0200 +@@ -206,15 +206,6 @@ + + AC_CHECK_HEADERS(winsock2.h, SOCKET_LIB="-lws2_32") + +-AC_CHECK_HEADER(resmgr.h,[ +- AC_CHECK_LIB( +- resmgr, +- rsm_open_device,[ +- AC_DEFINE(HAVE_RESMGR,1,[define if you have the resmgr library]) +- RESMGR_LIBS="-lresmgr" +- ] +- ) +-]) + AC_SUBST(RESMGR_LIBS) + + dnl *********************************************************************** diff --git a/libsane-backends-1.0.24-autoconf-2.70.patch b/libsane-backends-1.0.24-autoconf-2.70.patch new file mode 100644 index 0000000..0a1adc1 --- /dev/null +++ b/libsane-backends-1.0.24-autoconf-2.70.patch @@ -0,0 +1,12 @@ +--- backends-1.0.31/acinclude.m4.orig 2020-12-13 12:54:11.199330339 +0100 ++++ backends-1.0.31/acinclude.m4 2020-12-13 12:54:16.499425763 +0100 +@@ -73,9 +73,6 @@ + if test "${ac_cv_header_unistd_h}" != "yes" ; then + MISSING_HEADERS="${MISSING_HEADERS}\"unistd.h\" " + fi +- if test "${ac_cv_header_stdc}" != "yes" ; then +- MISSING_HEADERS="${MISSING_HEADERS}\"ANSI C headers\" " +- fi + if test "${MISSING_HEADERS}" != "" ; then + echo "*** The following essential header files couldn't be found:" + echo "*** ${MISSING_HEADERS}" diff --git a/sane-backends-1.0.23-use_lp_group.patch b/sane-backends-1.0.23-use_lp_group.patch new file mode 100644 index 0000000..c7d79c4 --- /dev/null +++ b/sane-backends-1.0.23-use_lp_group.patch @@ -0,0 +1,21 @@ +diff -Nru sane-backends-1.0.23.orig/tools/sane-desc.c sane-backends-1.0.23/tools/sane-desc.c +--- sane-backends-1.0.23.orig/tools/sane-desc.c 2012-07-01 04:00:44.000000000 +0200 ++++ sane-backends-1.0.23/tools/sane-desc.c 2012-09-29 11:56:37.506880380 +0200 +@@ -58,7 +58,7 @@ + + #define DEVMODE "0664" + #define DEVOWNER "root" +-#define DEVGROUP "scanner" ++#define DEVGROUP "lp" + + #ifndef PATH_MAX + # define PATH_MAX 1024 +@@ -3622,7 +3622,7 @@ + if (mode == output_mode_udevacl) + printf("\nENV{libsane_matched}==\"yes\", RUN+=\"/bin/setfacl -m g:%s:rw $env{DEVNAME}\"\n", DEVGROUP); + else +- printf ("\nENV{libsane_matched}==\"yes\", MODE=\"664\", GROUP=\"scanner\"\n"); ++ printf ("\nENV{libsane_matched}==\"yes\", MODE=\"664\", GROUP=\"lp\"\n"); + + printf ("\nLABEL=\"libsane_rules_end\"\n"); + } diff --git a/sane-backends.spec b/sane-backends.spec new file mode 100644 index 0000000..45f51b8 --- /dev/null +++ b/sane-backends.spec @@ -0,0 +1,402 @@ +%define primaxscan_ver 1.1.beta1 +%define gitver %(echo %version | tr . _) +%define saned_uid 65442 +%define saned_gid 65442 + +Name: sane-backends +Version: 1.0.32 +Release: 1mamba +Summary: SANE provides standardized access to any raster image scanner hardware +Group: System/Kernel and Hardware +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://www.sane-project.org +Source: https://gitlab.com/sane-project/backends.git/%{version}/backends-%{version}.tar.bz2 +#Source: https://alioth.debian.org/frs/download.php/file/4146/sane-backends-%{version}.tar.gz +#Source: http://alioth.debian.org/frs/download.php/3752/sane-backends-%{version}.tar.gz.1 +#Source1: http://alioth.debian.org/frs/download.php/3752/sane-backends-%{version}.tar.gz.2 +#Source2: http://alioth.debian.org/frs/download.php/3752/sane-backends-%{version}.tar.gz.3 +#download the 3 sources above and then do a cat sane-backends-%{version}.tar.gz.[1-3] > sane-backends-%{version}.tar.gz +#Source: sane-backends-%{version}.tar.gz +Source3: sane-libusbscanner +Source4: saned.socket +Source5: saned@.service +Patch1: libsane-backends-1.0.23-disable_resmgr.patch +Patch2: libsane-backends-1.0.22-deconflict_v4l_headers.patch +Patch3: sane-backends-1.0.23-use_lp_group.patch +Patch4: libsane-backends-1.0.24-autoconf-2.70.patch +License: GPL +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libatomic-devel +BuildRequires: libavahi-devel +BuildRequires: libbrotli-devel +BuildRequires: libcairo-devel +BuildRequires: libcares-devel +BuildRequires: libcurl-devel +BuildRequires: libdbus-devel +BuildRequires: libexif-devel +BuildRequires: libgcc +BuildRequires: libglib-devel +BuildRequires: libgphoto2-devel +BuildRequires: libgsasl-devel +BuildRequires: libgss-devel +BuildRequires: libidn-devel +BuildRequires: libidn2-devel +BuildRequires: libieee1284-devel +BuildRequires: libjbig-devel +BuildRequires: libjpeg-devel +BuildRequires: libltdl-devel +BuildRequires: liblzma-devel +BuildRequires: libnetsnmp-devel +BuildRequires: libnghttp2-devel +BuildRequires: libntlm-devel +BuildRequires: libopenldap-devel +BuildRequires: libopenssl-devel +BuildRequires: libpng-devel +BuildRequires: libpoppler-glib-devel +BuildRequires: libpsl-devel +BuildRequires: librtmp-devel +BuildRequires: libsasl2-devel +BuildRequires: libssh2-devel +BuildRequires: libssp-devel +BuildRequires: libstdc++6-devel +BuildRequires: libsystemd-devel +BuildRequires: libtiff-devel +BuildRequires: libudev-devel +BuildRequires: libunistring-devel +BuildRequires: libusb-devel +BuildRequires: libv4l-devel +BuildRequires: libwebp-devel +BuildRequires: libxml2-devel +BuildRequires: libz-devel +BuildRequires: libzstd-devel +## AUTOBUILDREQ-END +BuildRequires: libnetsnmp-devel >= 5.9-1mamba +BuildRequires: libgphoto2-devel >= 1:2.5.19-1mamba +BuildRequires: pkgconfig >= 0.15.0 +Requires(pre): uucp +Requires: sane = %{?epoch:%epoch:}%{version}-%{release} +Provides: libsane-backends +Obsoletes: libsane-backends <= 1.0.31 +%systemd_requires + +# FIXME : +# *** disabling PINT backend (sys/scanio.h not found) +# *** disabling pnm backend (not selected manually) + +%description +SANE stands for "Scanner Access Now Easy" and is an application programming interface (API) that provides standardized access to any raster image scanner hardware (flatbed scanner, hand-held scanner, video- and still-cameras, frame-grabbers, etc.). +The SANE API is public domain and its discussion and development is open to everybody. +The current source code is written for UNIX (including GNU/Linux) and is available under the GNU General Public License (the SANE API is available to proprietary applications and backends as well, however). +SANE is a universal scanner interface. +The value of such a universal interface is that it allows writing just one driver per image acquisition device rather than one driver for each device and application. +So, if you have three applications and four devices, traditionally you'd have had to write 12 different programs. +With SANE, this number is reduced to seven: the three applications plus the four drivers. +Of course, the savings get even bigger as more and more drivers and/or applications are added. +This is the libraries package. + +%package devel +Summary: Devel files for sane-backends +Group: Development/Libraries +Requires: libsane-backends = %{version}-%{release} +Provides: libsane-backends-devel +Obsoletes: libsane-backends-devel <= 1.0.31 + +%description devel +SANE stands for "Scanner Access Now Easy" and is an application programming interface (API) that provides standardized access to any raster image scanner hardware (flatbed scanner, hand-held scanner, video- and still-cameras, frame-grabbers, etc.). +The SANE API is public domain and its discussion and development is open to everybody. +The current source code is written for UNIX (including GNU/Linux) and is available under the GNU General Public License (the SANE API is available to proprietary applications and backends as well, however). +SANE is a universal scanner interface. +The value of such a universal interface is that it allows writing just one driver per image acquisition device rather than one driver for each device and application. +So, if you have three applications and four devices, traditionally you'd have had to write 12 different programs. +With SANE, this number is reduced to seven: the three applications plus the four drivers. +Of course, the savings get even bigger as more and more drivers and/or applications are added. +This is the development package. + +%package -n sane +Summary: SANE provides standardized access to any raster image scanner hardware +Group: System/Kernel and Hardware +Requires: sane-backends = %{?epoch:%epoch:}%{version}-%{release} + +%description -n sane +SANE stands for "Scanner Access Now Easy" and is an application programming interface (API) that provides standardized access to any raster image scanner hardware (flatbed scanner, hand-held scanner, video- and still-cameras, frame-grabbers, etc.). +The SANE API is public domain and its discussion and development is open to everybody. +The current source code is written for UNIX (including GNU/Linux) and is available under the GNU General Public License (the SANE API is available to proprietary applications and backends as well, however). +SANE is a universal scanner interface. +The value of such a universal interface is that it allows writing just one driver per image acquisition device rather than one driver for each device and application. +So, if you have three applications and four devices, traditionally you'd have had to write 12 different programs. +With SANE, this number is reduced to seven: the three applications plus the four drivers. +Of course, the savings get even bigger as more and more drivers and/or applications are added. + +%debug_package + +%prep +%setup -q -n backends-%{version} +#-D -T +#:<< _EOF +%patch3 -p1 +#%patch4 -p1 +sed -i "s|m4_esyscmd_s.*|[%{version}],|" configure.ac +#sed -i "/AC_HEADER_STDC/d" configure.ac +#autoreconf -f -i +./autogen.sh + +%build +#:<< _EOF +%configure \ + --with-gphoto2 \ + --enable-avahi \ + --with-group=saned + +# USB_LIBS="-lusb -lresmgr" +# FIXME: workaround to fix missing link library resmgr as of 1.0.21 + +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall DESTDIR=%{buildroot} + +#install -d %{buildroot}%{_datadir} +#mv %{buildroot}%{_prefix}/doc %{buildroot}%{_datadir} + +# add drivers to sane configuration +echo "\ +hpaio +#primax" >> %{buildroot}%{_sysconfdir}/sane.d/dll.conf + +install -d %{buildroot}%{_datadir}/sane + +(cd tools/udev +#sh ../udev/convert-usermap.sh libsane.usermap +install -d %{buildroot}%{_sysconfdir}/udev/rules.d +install -m0644 libsane.rules %{buildroot}%{_sysconfdir}/udev/rules.d/55-libsane.rules +) +sed -i "s|\(^SYSFS{idVendor}.*\)|\1 RUN+=\"%{_sysconfdir}/udev/scripts/libusbscanner\"|" %{buildroot}%{_sysconfdir}/udev/rules.d/55-libsane.rules +install -D -m0755 %{SOURCE3} %{buildroot}%{_sysconfdir}/udev/scripts/libusbscanner + +install -D -m0644 %{SOURCE4} %{buildroot}%{_unitdir}/saned.socket +install -D -m0644 %{SOURCE5} %{buildroot}%{_unitdir}/saned@.service + +install -d %{buildroot}%{_sysconfdir}/default +cat > %{buildroot}%{_sysconfdir}/default/saned << _EOF +RUN=no +_EOF + +install -d %{buildroot}%{_localstatedir}/lib/sane + +%find_lang sane-backends + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%pre -n sane +if [ $1 -ge 1 ]; then + /usr/sbin/groupadd saned -g %{saned_gid} &>/dev/null + /usr/sbin/useradd -u %{saned_uid} -c 'saned user' -d /dev/null \ + -s /bin/false saned -g %{saned_gid} &>/dev/null + usermod -a -G lp saned &>/dev/null + systemctl -q daemon-reload +fi +: + +%post -n sane +[ "`grep hpaio /etc/sane.d/dll.conf`" ] || echo "hpaio" >> /etc/sane.d/dll.conf +%systemd_post saned.socket +: + +%preun -n sane +%systemd_preun saned.socket +# erase +if [ $1 -eq 0 ]; then + userdel saned || true + groupdel saned || true +fi +: + +%postun -n sane +%systemd_postun_with_restart saned.socket +: + +%post +/sbin/ldconfig +exit 0 + +%postun +/sbin/ldconfig +exit 0 + +%files -n sane +%defattr(-,root,root) +%dir %{_sysconfdir}/sane.d +%config %{_sysconfdir}/sane.d/* +%config(noreplace) %{_sysconfdir}/sane.d/saned.conf +%config(noreplace) %{_sysconfdir}/sane.d/net.conf +%config(noreplace) %{_sysconfdir}/default/saned +%config %{_sysconfdir}/udev/rules.d/55-libsane.rules +%{_sysconfdir}/udev/scripts/libusbscanner +%{_bindir}/gamma4scanimage +%{_bindir}/sane-find-scanner +%{_bindir}/scanimage +%{_bindir}/umax_pp +%{_sbindir}/saned +%{_unitdir}/saned.socket +%{_unitdir}/saned@.service +%{_datadir}/sane/* +%dir %attr(0755,saned,saned) %{_localstatedir}/lib/sane +%{_mandir}/man1/* +%{_mandir}/man5/* +%{_mandir}/man7/* +%{_mandir}/man8/* + +%files -f sane-backends.lang +%defattr(-,root,root) +%{_libdir}/libsane.so.* +%dir %{_libdir}/sane +%{_libdir}/sane/libsane-*.la +%{_libdir}/sane/libsane-*.so* +%dir %{_datadir}/sane +#%dir %attr(0775,root,uucp) %{_localstatedir}/lock/sane +%doc AUTHORS COPYING LICENSE + +%files devel +%defattr(-,root,root) +%{_bindir}/sane-config +%dir %{_includedir}/sane +%{_includedir}/sane/* +%{_libdir}/*.la +%{_libdir}/*.so +%{_libdir}/pkgconfig/sane-backends.pc +%dir %{_docdir}/sane-* +%{_docdir}/sane-*/* +%doc ChangeLog NEWS PROBLEMS PROJECTS README.linux + +%changelog +* Thu Jun 23 2022 Silvan Calarco 1.0.32-1mamba +- update to 1.0.32 + +* Tue Dec 08 2020 Silvan Calarco 1.0.31-2mamba +- rebuilt by autoport with build requirements: libnetsnmp-devel>=5.9-1mamba + +* Tue Aug 25 2020 Automatic Build System 1.0.31-1mamba +- automatic version update by autodist + +* Tue Jul 28 2020 Silvan Calarco 1.0.30-2mamba +- set saned.conf and net.conf as config(noreplace) + +* Mon Jun 15 2020 Silvan Calarco 1.0.30-1mamba +- update to 1.0.30 + +* Tue Oct 09 2018 Silvan Calarco 1.0.27-3mamba +- rebuilt by autoport with build requirements: libgphoto2-devel>=2.5.19-1mamba + +* Sat Aug 04 2018 Silvan Calarco 1.0.27-2mamba +- libsane-backends: require sane + +* Wed Aug 01 2018 Silvan Calarco 1.0.27-1mamba +- update to 1.0.27 + +* Thu Mar 29 2018 Silvan Calarco 1.0.25-5mamba +- fix typo in saned@.service + +* Sat Nov 25 2017 Silvan Calarco 1.0.25-4mamba +- add saned used to lp group for backends to work; own and set permissions to /var/lib/sane + +* Mon Aug 21 2017 Silvan Calarco 1.0.25-3mamba +- added saned user and group and systemd socket and service + +* Wed Apr 06 2016 Silvan Calarco 1.0.25-2mamba +- created sane package to split out libraries + +* Fri Oct 09 2015 Automatic Build System 1.0.25-1mamba +- automatic version update by autodist + +* Sat Dec 20 2014 Silvan Calarco 1.0.24-2mamba +- rebuilt with libgphoto2 2.5.5.1 + +* Sat Oct 12 2013 Automatic Build System 1.0.24-1mamba +- update to 1.0.24 + +* Wed Oct 31 2012 Silvan Calarco 1.0.23.20121031git-1mamba +- update to 1.0.23.20121031git + +* Sat Sep 29 2012 Silvan Calarco 1.0.23-2mamba +- patch to set lp group instead of scanner for usb devices. fixes a conflict with cups for mfp (e.g. Canon) + +* Thu Aug 30 2012 Automatic Build System 1.0.23-1mamba +- update to 1.0.23 + +* Mon Aug 20 2012 Silvan Calarco 1.0.22-4mamba +- fixed autotools reconfiguration +- remove primaxscan; will make a separate package +- don't require libsane-backends-extras + +* Wed Nov 02 2011 Silvan Calarco 1.0.22-3mamba +- added patch to build with current libv4l headers +- fixed disable_resmgr patch to remove RESMGR reference in sane-config --libs + +* Tue Mar 29 2011 Silvan Calarco 1.0.22-2mamba +- added disable_resmgr patch + +* Mon Mar 28 2011 Silvan Calarco 1.0.22-1mamba +- update to 1.0.22 +- removed version requirement (>= 6b) for libjpeg-devel +- enabled avahi support + +* Wed Jul 14 2010 Automatic Build System 1.0.21-1mamba +- automatic update to 1.0.21 by autodist + +* Wed May 06 2009 Automatic Build System 1.0.20-1mamba +- automatic update to 1.0.20 by autodist + +* Mon Jun 23 2008 Silvan Calarco 1.0.19-4mamba +- rebuild after libresmgr fix to relink against it + +* Sun Jun 22 2008 Silvan Calarco 1.0.19-3mamba +- added uucp build requirement to add lock support +- removed build requirement for libsane-backends-extras +- libsane-backends-devel: added strict release requirement for libsane-backends + +* Sun Jun 22 2008 Fabio Giani 1.0.19-2mamba +- update buildrequirements and rebuild + +* Mon Apr 28 2008 Silvan Calarco 1.0.19-1mamba +- update to 1.0.19 + +* Mon Mar 20 2006 Silvan Calarco 1.0.17-5qilnx +- enable hpaio driver on default configuration + +* Mon Mar 13 2006 Silvan Calarco 1.0.17-4qilnx +- execute libusbscanner to set proper permission on usbfs + +* Wed Feb 22 2006 Silvan Calarco 1.0.17-3qilnx +- fixed udev rules generation + +* Wed Feb 08 2006 Silvan Calarco 1.0.17-2qilnx +- comment out primax scanner + +* Fri Feb 03 2006 Silvan Calarco 1.0.17-1qilnx +- update to version 1.0.17 by autospec +- added support for udev + +* Wed Dec 07 2005 Silvan Calarco 1.0.16-3qilnx +- added hotplug support scripts + +* Tue Dec 06 2005 Silvan Calarco 1.0.16-2qilnx +- added hpoj driver + +* Wed Aug 10 2005 Davide Madrisan 1.0.16-1qilnx +- update to version 1.0.16 by autospec +- added missing %%post, %%postun scriptlets + +* Thu Jan 22 2004 Silvan Calarco 1.0.13-2qilnx +- primax driver added + +* Thu Jan 08 2004 Silvan Calarco 1.0.13-1qilnx +- new version rebuild + +* Fri Aug 01 2003 Silvan Calarco 1.0.12-1qilnx +- creation of sane package + diff --git a/sane-libusbscanner b/sane-libusbscanner new file mode 100644 index 0000000..6da04e6 --- /dev/null +++ b/sane-libusbscanner @@ -0,0 +1,45 @@ +#!/bin/sh + +# This file is part of sane-backends. +# +# This script changes the permissions and ownership of a USB device under +# /proc/bus/usb to grant access to this device to users in the scanner group. +# +# Ownership is set to root:scanner, permissions are set to 0660. +# +# Arguments : +# ----------- +# ACTION=[add|remove] +# DEVICE=/proc/bus/usb/BBB/DDD +# TYPE=usb + +# latest hotplug doesn't set DEVICE on 2.6.x kernels +echo "inizio device:$DEVICE" >> /root/scanner +echo "inizio devpath: $DEVPATH" >> /root/scanner + +if [ -z "$DEVICE" ] ; then + IF=`echo $DEVPATH | sed 's/\(\/class\/usb_device\/usbdev\)\(.*\)\.\(.*\)/\2/'` + DEV=$(cat /sys/${DEVPATH}/device/devnum) + DEVICE=`printf '/proc/bus/usb/%.03d/%.03d' $IF $DEV` +fi +echo "if:$IF" +echo "DEV:$DEV" +echo "device:$DEVICE" >> /root/scanner +echo "devpath: $DEVPATH" >> /root/scanner + +echo "action: $ACTION" >> /root/scanner +echo "type: $TYPE" >> /root/scanner + +if [ "$ACTION" = "add" ]; then + chown root:scanner "$DEVICE" + chmod 0660 "$DEVICE" +fi + + +# That's an insecure but simple alternative +# Everyone has access to the scanner + +# if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then +# chmod 0666 "$DEVICE" +# fi + diff --git a/saned.socket b/saned.socket new file mode 100644 index 0000000..1aa19e7 --- /dev/null +++ b/saned.socket @@ -0,0 +1,10 @@ +[Unit] +Description=saned incoming socket + +[Socket] +ListenStream=6566 +Accept=yes +MaxConnections=1 + +[Install] +WantedBy=sockets.target diff --git a/saned@.service b/saned@.service new file mode 100644 index 0000000..9387033 --- /dev/null +++ b/saned@.service @@ -0,0 +1,16 @@ +[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=/etc/sane.d + +[Install] +Also=saned.socket