Bugzilla – Bug 340173
add a test to yast2-scanner if HAL knows about a configured scanner
Last modified: 2008-09-10 14:40:22 UTC
The general problem "can access as root but cannot as normal user" is one of the most often reported problems regarding scanning. Therefore I think about an automated step in the YaST setup which tests if there is access as non-root and if the test fails YaST could show an appropriate information to the user which could suggest re-plug for USB scanners and if this doesn't help it could suggest a reboot of the computer, see https://bugzilla.novell.com/show_bug.cgi?id=218393#c24 and if even a reboot doesn't help it could suggest the saned+net workaround. The first idea to run "scanimage -L" as an unprivilleged user (e.g. via something like "su nobody") cannot work because arbitrary unprivilleged users don't have access via the udev/HAL/hal-resmgr magic. Only "console users" get access via the udev/HAL/hal-resmgr magic. A "console user" is a user who is currently actually logged in via console or XDM/KDM (or whatever the current resmgr setup is). Ludwig told me the right way to implement such a test: Run "scanimage -L" as root and for each SANE device check if there is a matching HAL entry with the "scanner" capability (e.g. run "hal-find-by-capability --capability scanner"). If yes, we can assume that the dev/HAL/hal-resmgr magic works to grant access for "console users" for this scanner.
A first idea: for d in $( scanimage -L \ | grep -o 'libusb:[0-9][0-9][0-9]:[0-9][0-9][0-9]' \ | cut -s -d ':' -f2- | tr ':' '/' ) do lshal \ | egrep 'info.capabilities.*scanner|linux.device_file' \ | grep -q "linux.device_file.*/dev/bus/usb/$d" \ && echo $d ok \ || echo $d failed done
Created attachment 209590 [details] test_and_set_scanner_access_permissions Added tests to test_and_set_scanner_access_permissions if HAL knows about the scanner and show an explanatory error message if not. Because of the YaST 'text freeze' this message cannot be translated for openSUSE 11.0 so that currently it is only a simple stderr message.
Fixed as good as possible for openSUSE 11.0. Will make it an enhancement for openSUSE 11.1 to move the explanatory error message into the YCP source so that it will be translated.
Reopened as enhancement for openSUSE 11.1 to move the explanatory error message into the YCP source so that it will be translated.
There is an interesting side effect of bug #347943 (full automated USB scanner setup via udev): When the SANE driver was set up full automated via udev there is of course no access permission test as in test_and_set_scanner_access_permissions because such a test would be useless because as far as I know there is no method in udev to notify the user when something failed (in particular when udev runs during system boot when no user is logged in). I fear that most scanners which exist out there in the real world are listed in /etc/udev/rules.d/56-sane-backends-autoconfig.rules so that they would be set up full automated so that for most users out there in the real world there cannot be any notification when the access permissions are insufficient. In those cases scanning just does not work and a normal user has no information at all what is wrong. Welcome to the hell of full automated setup...
I think I found a solution for the problem in comment #5: I will add the access permission test also to /usr/lib/YaST2/bin/test_scanner_backend which is run when clicking [Test] in yast2-scanner. Then the workflow is as follows: 1) The full automated USB scanner setup via udev activates the matching scanner driver but it cannot do an access permissions test as described in comment #5 2) If access permissions are sufficient (the normal case) the user can use his scanner out-of-the-box. 3) If access permissions are not sufficient, the user cannot use the scanner and because of this he runs the YaST scanner setup module. 4) The YaST scanner setup module runs as root and therefore it can access the the scanner and reports it as "configured". Now the user hopefully finds the "Other" -> "Test" function. Because root can access the the scanner, the actual scanning test will be successful but the new additional access permissions test would notice insufficient permissions for normal users so that YaST can report an appropriate message to the user to inform him what is actually wrong.
Fix for next openSUSE version.
Fixed in yast2-scanner-2.17.1 (submited to FACTORY right now) which should appear in openSUSE 11.1 beta1