diff --git a/sane-backends.changes b/sane-backends.changes index fc9126f..fff593c 100644 --- a/sane-backends.changes +++ b/sane-backends.changes @@ -1,13 +1,3 @@ -------------------------------------------------------------------- -Wed Apr 28 11:27:50 CEST 2010 - jsmeix@suse.de - -- HAL is deprecated and does no longer support to grant read/write - device access permissions for scanners to the currently logged - in "desktop" user. Therefore all HAL related stuff was removed - (see Novell/Suse Bugzilla bnc#593946). -- Removed /usr/lib[64]/libsane.la - (see Novell/Suse Bugzilla bnc#592143). - ------------------------------------------------------------------- Mon Feb 1 12:29:15 UTC 2010 - jengelh@medozas.de diff --git a/sane-backends.spec b/sane-backends.spec index 6a2aa77..ec3896e 100644 --- a/sane-backends.spec +++ b/sane-backends.spec @@ -396,17 +396,11 @@ make install DESTDIR=%{buildroot} # The dll meta-backend needs neither libsane-.so nor libsane-.la. # RPMLINT complains about libsane-.so with "devel-file-in-non-devel-package". # Therefore the libsane-.so and libsane-.la files are simply removed. +# Note that those files for the dll meta-backend /usr/lib/libsane.so and /usr/lib/libsane.la +# are not removed because it is unknown how whatever third-party scanning frontend +# may like to link with SANE (i.e. with the dll meta-backend). rm %{buildroot}%{_libdir}/sane/libsane-*.so rm %{buildroot}%{_libdir}/sane/libsane-*.la -# Because of https://bugzilla.novell.com/show_bug.cgi?id=592143 for openSUSE 11.3 -# even the /usr/lib/libsane.la file for the dll meta-backend is removed -# regardless that it is unknown how whatever third-party scanning frontend -# may like to link with SANE (i.e. with the dll meta-backend). -# The frontends which are provided by openSUSE /usr/bin/scanimage, -# /usr/bin/xsane, and /usr/bin/skanlite do not need it. -# The /usr/lib/libsane.so link for the dll meta-backend is kept because it is needed -# during build-time by other packages which need sane-backends to build. -rm %{buildroot}%{_libdir}/libsane.la # Disable all backends in /etc/sane.d/dll.conf to avoid problems when backends are active by default: perl -pi -e 's/^([^#].*)$/#$1/' %{buildroot}%{_sysconfdir}/sane.d/dll.conf # Allow all users to write into /var/lock/sane/ so that the backends work for normal users @@ -471,7 +465,7 @@ sed -i -e '/:model "SnapScan 1236u"/,/:firmware "required"/s/required//' %{build # to have a usable "scanner autoconfiguration" for the user. # What is also needed are appropriate USB device file permissions # so that the user's scanning software can access the device. -# But this is already in place via the the udev libsane.rules file +# But this is already in place via the HAL 70-scanner.fdi file # which contains a superset of USB scanner IDs (all known USB scanner IDs) # compared to the USB scanner IDs in 56-sane-backends-autoconfig.rules, # see create_sane-backends-autoconfig.rules for which USB scanners @@ -482,7 +476,8 @@ sed -i -e '/:model "SnapScan 1236u"/,/:firmware "required"/s/required//' %{build # (the usual delimiter '/' cannot be used because buildroot contains it too): sed -i -e 's|/usr/share/sane/descriptions|%{buildroot}/usr/share/sane/descriptions|' create_scanner_database # Create the scanner database and store it because it is also needed later -# to disable "unsupported" model entries in the udev libsane.rules file. +# to disable "unsupported" model entries both in the udev rules file libsane.rules +# and in the HAL fdi file 70-scanner.fdi. # The file name "scanner.database" is used hardcoded in create_sane-backends-autoconfig.rules. ./create_scanner_database >scanner.database # Run create_sane-backends-autoconfig.rules which reads scanner.database @@ -533,7 +528,9 @@ sed -i -e 's/^ENV{DEVTYPE}/# ENV{DEVTYPE}/' tools/udev/libsane.rules # supported by SANE which would even cause conflicts if such a # device is supported by whatever other software, # see https://bugzilla.novell.com/show_bug.cgi?id=439193 -# Extract a list of USB IDs for "unsupported" scanners and store them in unsupportedUSBIDs. +# Extract a list of USB IDs for "unsupported" scanners +# and store it because it is also needed later to +# disable "unsupported" model entries in the HAL fdi file 70-scanner.fdi # It can happen that there is a status "unsupported" entry for a backend # for a model which is actually supported by another backend, for example # the "Epson Perfection 1670" is "unsupported" by the "epkowa" backend @@ -548,11 +545,68 @@ done for m in $( sed -e 's/0x/./ig' -e 's/:/.,.ATTR.idProduct.==/' unsupportedUSBIDs ) do sed -i -e "/^ATTR.idVendor.==$m/Is/^ATTR/# ATTR/" tools/udev/libsane.rules done -# Newer udev versions complain about NAME="%k" usage with warning messages like -# 'udevd[1234]: NAME="%k" is superfluous and breaks kernel supplied names...' +# newer udev versions complain about NAME="%k" usage, saying it's superfluous sed -i -e 's/NAME="%k", //' tools/udev/libsane.rules # Install the udev rules file: install -m644 tools/udev/libsane.rules %{buildroot}%{_sysconfdir}/udev/rules.d/55-libsane.rules +# Regarding HAL: +# Modify the generated tools/hal/libsane.fdi file as follows: +# Remove 'key="scanner.access_method"' lines. +sed -i -e '/key="scanner.access_method"/d' tools/hal/libsane.fdi +# There is a small number of USB scanners which are not talked to via libusb. +# They talk an unusual protocol which is a derivative of usb storage. +# User space should treat them as SCSI scanners. +# Furthermore, granting access via libusb here could oops the kernel. +# Therefore USB user access for those scanners must be disabled. +# See the Novell/Suse Bugzilla bug +# https://bugzilla.novell.com/show_bug.cgi?id=341565 +# This is done by replacing the append of "scanner" to info.capabilities by "SCSIviaUSBscanner". +# This way the YaST scanner module can inspect 70-scanner.fdi to learn which models +# it must not add to 80-scanner.fdi (i.e. the explicitely marked as "SCSIviaUSBscanner" models). +# Currently there are no hexadecimal numbers in libsane.fdi with uppercase letters +# nevertheless to be safe the GNU sed extension to ignore case for pattern matching is used: +sed -i -e '/usb.vendor_id.*0x04ce/I,/append key/{/usb.product_id.*0x0300/I,/append key/s/scanner/SCSIviaUSBscanner/g}' tools/hal/libsane.fdi +for ID in 0094 0099 009a 00a0 00a3 80a3 80ac 00b6 +do sed -i -e "/usb.vendor_id.*0x05da/I,/append key/{/usb.product_id.*0x$ID/I,/append key/s/scanner/SCSIviaUSBscanner/g}" tools/hal/libsane.fdi +done +# Disable entries for USB scanners which are "unsupported" +# but keep the entries for models for which the support status +# is "complete", "good", "basic", "minimal", "untested" +# because the HAL fdi file is used to grant normal user access +# for scanner devices which is needed for any scanner +# (regardless to what extent it is actually supported). +# The only exception are unsupported models +# because it seems to be wrong to have "known but unsupported" devices +# listed in the HAL fdi file because it seems not to make sense +# to grant normal user access for devices which are not +# supported by SANE which would even cause conflicts if such a +# device is supported by whatever other software, +# see https://bugzilla.novell.com/show_bug.cgi?id=444158 +# Currently there are no hexadecimal numbers in libsane.fdi with uppercase letters +# nevertheless to be safe the GNU sed extension to ignore case for pattern matching is used: +for ID in $( cat unsupportedUSBIDs ) +do V="$( echo $ID | cut -d : -s -f 1 )" + P="$( echo $ID | cut -d : -s -f 2 )" + sed -i -e "/usb.vendor_id.*$V/I,/info.capabilities/{/usb.product_id.*$P/I,/info.capabilities/{s//append> -->/}}" tools/hal/libsane.fdi +done +%if 0%{?suse_version} < 1110 +# for hal-resmgr +# Replace 'key="info.bus" string="usb"' by 'key="info.subsystem" string="usb_device"', +# and replace 'key="usb.vendor_id"' by 'key="usb_device.vendor_id"', +# and replace 'key="usb.product_id"' by 'key="usb_device.product_id"', +# see the Novell/Suse Bugzilla bug +# https://bugzilla.novell.com/show_bug.cgi?id=250659 +sed -i -e 's/key="info.bus" string="usb"/key="info.subsystem" string="usb_device"/' tools/hal/libsane.fdi +sed -i -e 's/key="usb.vendor_id"/key="usb_device.vendor_id"/' tools/hal/libsane.fdi +sed -i -e 's/key="usb.product_id"/key="usb_device.product_id"/' tools/hal/libsane.fdi +%else +# for hal-acl-tool +# https://bugzilla.novell.com/show_bug.cgi?id=438867 +sed -i -e 's/key="info.bus" string="usb"/key="info.subsystem" string="usb"/' tools/hal/libsane.fdi +%endif +# Install the HAL fdi file: +install -d %{buildroot}%{_datadir}/hal/fdi/information/20thirdparty +install -m644 tools/hal/libsane.fdi %{buildroot}%{_datadir}/hal/fdi/information/20thirdparty/70-scanner.fdi # xinetd stuff: install -d -m755 %{buildroot}%{_sysconfdir}/xinetd.d/ install -m644 %{SOURCE101} %{buildroot}%{_sysconfdir}/xinetd.d/ @@ -563,7 +617,7 @@ install -m644 %{SOURCE102} %{buildroot}%{_sysconfdir}/slp.reg.d %post -p /sbin/ldconfig -%postun -p /sbin/ldconfig +%postun -p /sbin/ldconfig %files -f sane-backends.lang %defattr(-,root,root) @@ -574,6 +628,11 @@ install -m644 %{SOURCE102} %{buildroot}%{_sysconfdir}/slp.reg.d %dir %{_sysconfdir}/udev %dir %{_sysconfdir}/udev/rules.d %{_sysconfdir}/udev/rules.d/55-libsane.rules +%dir %{_datadir}/hal +%dir %{_datadir}/hal/fdi +%dir %{_datadir}/hal/fdi/information +%dir %{_datadir}/hal/fdi/information/20thirdparty +%{_datadir}/hal/fdi/information/20thirdparty/70-scanner.fdi %{_sbindir}/saned %{_bindir}/scanimage %{_bindir}/sane-config