Bugzilla – Bug 347943
full automated USB scanner setup via udev
Last modified: 2008-03-18 15:29:06 UTC
Just an idea how a full automated USB scanner setup via udev might be implemented: The original SANE *.desc description files contain for USB scanners which are known by the SANE project - USB vendor and product IDs - possible scanner driver(s) - support status ("complete", "good", ... "unsupported") and via our sane-backends RPM build I add info - if firmware upload is required In yast2-scanner there is /usr/lib/YaST2/bin/create_scanner_database which parses the *.desc files and generates a table with - RPM package - scanner driver - USB IDs - support status - if firmware upload is required Running a modified version of create_scanner_database during sane-backends RPM build could create/enhance /etc/udev/rules.d/55-libsane.rules so that it runs sed as in /usr/lib/YaST2/bin/activate_scanner_backend to activate the matching scanner driver in /etc/sane.d/dll.conf if and only if - support status is "complete" or "good" - no firmware upload is required Only drivers are listed in /etc/sane.d/dll.conf for which the matching RPM package is installed - in particular for so called external drivers (drivers which are not included in sane-backends) like hpaio (package hplip) or epkowa (various iscan* packages). Such drivers are added to /etc/sane.d/dll.conf via RPM postinstall.
Created attachment 200311 [details] 56-sane-autoconfig.rules (first try) The attached first try of an /etc/udev/rules.d/56-sane-autoconfig.rules works well on openSUSE 10.3 i386 for my Canon, Inc. CanoScan N1240U/LiDE 30 (USB ID 04a9:220e). Note that it enables a scanner driver but never disables it. I think this is perfectly o.k. because enabled drivers don't hurt so that automated disable would make it only overcomplicated because when more than one scanner uses the same driver, one would have to check carefully that it is not accidentally disabled when only one scanner was disconnected. I think I provide a generated 56-sane-autoconfig.rules file as sane-backends-autoconfig sub package of sane-backends. I think a sub-package is nice to have this special add-on well separated from the base scanner driver package so that users who don't like autoconfiguration-magic can simply remove the sane-backends-autoconfig package.
Created attachment 200316 [details] 56-sane-autoconfig.rules (second try) Better version: Avoids to run the sed command multiple times for the same driver if there is more than one scanner connected during system boot which uses the same driver.
Created attachment 201207 [details] 56-sane-backends-autoconfig.rules (final try) - name changed Right now I submitted sane-backends to STABLE. A new sane-backends-autoconfig sub-package provides scanner autoconfiguration support via /etc/udev/rules.d/56-sane-backends-autoconfig.rules
done
Added "Supplements: sane-backends" to the sane-backends-autoconfig sub-package to get it automatically installed (if vavailable) when sane-backends is installed. The possible drawback with "Recommends/Supplements" is that the installer may try to install it again and again even if the user had it intentionally uninstalled before.