Bug 438867 - no scanner access permissions via HAL
Summary: no scanner access permissions via HAL
Status: VERIFIED FIXED
: 444316 447411 450351 450726 462817 (view as bug list)
Alias: None
Product: openSUSE 11.1
Classification: openSUSE
Component: Hotplug (show other bugs)
Version: RC 1
Hardware: PC SUSE Other
: P1 - Urgent : Critical (vote)
Target Milestone: ---
Assignee: Johannes Meixner
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-24 18:38 UTC by Miquel A. Noguera
Modified: 2009-01-13 10:53 UTC (History)
9 users (show)

See Also:
Found By: Beta-Customer
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---
coolo: SHIP_STOPPER+


Attachments
YaST logs (1.11 MB, application/x-compressed-tar)
2008-10-27 17:20 UTC, Miquel A. Noguera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miquel A. Noguera 2008-10-24 18:38:50 UTC
Although the scanner is correctly setup (with yast), only can be used by root.

This is the output of some commands:

scanimage -L
device `epson:libusb:001:002' is a Epson GT-9300 flatbed scanner

ls -lha /dev/bus/usb/001/002
crw-rw-r-- 1 root lp     189, 1 oct 24 20:33 /dev/bus/usb/001/002

('chown miquel.users /dev/bus/usb/001/002' workarounds this problem)
Comment 1 Alexander Orlovskyy 2008-10-27 12:53:12 UTC
Please provide y2logs.

More info on http://en.opensuse.org/Bugs/YaST 
Comment 2 Miquel A. Noguera 2008-10-27 17:20:31 UTC
Created attachment 248160 [details]
YaST logs

IMHO this is not a yast bug, but a udev/hal rules bug.
Comment 3 Johannes Meixner 2008-10-31 08:20:59 UTC
I do not find anything in attachment #248160 [details]
about the YaST scanner module
so that it cannot be a bug there.

Perhaps your scanner was set up full automated
as described in bug #347943 so that in your case
you might got the problem described in
https://bugzilla.novell.com/show_bug.cgi?id=340173#c5

But this cannot be true either because
according to /etc/udev/rules.d/55-libsane.rules
the Epson GT-9300(UF) has the USB IDs 0x04b8:0x011b
and this are also listed in
/etc/udev/rules.d/56-sane-backends-autoconfig.rules
but here with "sane_backend_epkowa"
(i.e. using the "epkowa" driver) which does not match
to "epson:libusb:001:002" in comment #0
(i.e. using the "epson" driver).

It would have been nice if you described how you did
set up your scanner and not let us do blind guessing via
inspecting whatever files what there might have happened
on your particular system.


Background information:

Since a longer time normal-user access for scanners is granted
via the udev/HAL/hal-resmgr machinery which sets an ACL
for the scanner's device file.
Run lsusb to determine the current USB bus and device number
and the run e.g.
getfacl /dev/bus/usb/001/002
(replace bus and device number 001/002 by what is currently
shown by the lsusb command for your scanner)
to see if an ACL is set and if yes, which one and for which user.
By default only users which are logged in directly at the computer
(i.e. via console "login" or via KDM/XDM but not via remote login)
get access granted via the udev/HAL/hal-resmgr machinery.

It is a well known problem since this machinery is used
that it does not work reliably. I am neither a USB expert
nor an expert regarding udev and/or HAL and/or hal-resmgr
but as far as I see, the whole machinery seems to be
somewhat overcomplicated: hal-resmgr depends on HAL (and PAM)
and HAL depends on udev which depends on the USB system.
Therefore any issue somewhere in this stack can result
whatever failure for normal users (e.g. compare bug #434540).

The only thing in the YaST scanner module which makes
settings for HAL is
/usr/lib/YaST2/bin/test_and_set_scanner_access_permissions

It writes
/etc/hal/fdi/policy/10osvendor/80-scanner.fdi
if the device is not already listed in
/etc/hal/fdi/policy/10osvendor/70-scanner.fdi
(the latter belongs to the sane-backends RPM).

The YaST scanner module runs it when it set up a
scanner and also via the "Other"->"Test" functionality.

It does also a test whether or not it looks o.k.
that the udev/HAL/hal-resmgr magic works so that
normal users would get access permissions, see bug #340173.

You can have a look at
/usr/lib/YaST2/bin/test_and_set_scanner_access_permissions
---------------------------------------------------------------------
To access the scanner as normal user,
udev, HAL, and hal-resmgr are needed to grant
appropriate access permissions automatically.
Therefore the scanner model must be known to HAL.
If the scanner is not known to HAL, a re-plug
of a USB scanner should help.
Otherwise a reboot should be done to restart
the whole udev/HAL/hal-resmgr machinery.
Check if the scanner is listed in the 'lshal' output.
..
If even a reboot does not help, you could access
the scanner via the 'saned' as a workaround.
For this workaround choose 'scanning via network'
and select the 'local host configuration'.
---------------------------------------------------------------------

Usually this workaround is the only feasible solution for
non-experts to get access permissions for normal users
if there is an issue in the udev/HAL/hal-resmgr magic.

Additionally see
http://en.opensuse.org/SDB:Configuring_Scanners_from_SUSE_LINUX_9.2
---------------------------------------------------------------------
libusb + resmgr + PAM
Note that the details change from version to version.
Additionally there will be further enhancements
(e.g. "udev", "HAL", "hal-resmgr",...).
An article regarding scanner setup cannot describe
all the details about USB, hotplug, udev, HAL, resmgr/hal-resmgr,
PAM, and so on. Refer to the appropriate specific documentation
if there are problems in one of these areas.
---------------------------------------------------------------------

By the way:
According to /etc/udev/rules.d/55-libsane.rules
the scanner device node/dev/bus/usb/xxx/yyy
should be in the "lp" group so that it should work
to add the normal users which should use the scanner
to the group "lp".
An "automated add of normal users to the lp group"
cannot be done, see bug #349084 in particular see
https://bugzilla.novell.com/show_bug.cgi?id=349084#c9
Comment 4 Cyril Hrubis 2008-10-31 17:46:32 UTC
Waiting for answering questions in comment #3.
Comment 5 Miquel A. Noguera 2008-11-07 19:47:26 UTC
Sorry for delay.

After 06-Oct update, scanner works fine for users.

Let me know if you're still interesed in requested info (I can reinstall Beta4 to investigate more about this bug).

> It would have been nice if you described how you did
> set up your scanner and not let us do blind guessing via
> inspecting whatever files what there might have happened
> on your particular system.

Of course, I just used yast2 to configure it, ("epson" driver selected, I don't like interface provided by epowka driver).

This is exactly the same process I've followed to configure this scanner since 8.0 with no problems in final versions.

Comment 6 Andreas Jaeger 2008-11-10 17:53:26 UTC
Thanks, let's consider this as fixed.

But if you install Beta4 or newer, please test again and reopen if it still fails.
Comment 7 Johannes Meixner 2008-11-14 08:22:52 UTC
*** Bug 444316 has been marked as a duplicate of this bug. ***
Comment 8 Alexander Orlovskyy 2008-11-21 07:34:44 UTC
Closing bug.
Comment 9 Johannes Meixner 2008-11-21 10:52:05 UTC
*** Bug 447411 has been marked as a duplicate of this bug. ***
Comment 10 Andrey Karepin 2008-11-29 19:29:33 UTC
i reproduce in 11.1 RC 1
Comment 11 Andrey Karepin 2008-12-01 13:33:27 UTC
i new install openSuSE 11.1 RC1 and reproduce this bug
Comment 12 Cyril Hrubis 2008-12-01 14:53:36 UTC
Please read Comment #3 and provide more information.
Comment 13 Andrey Karepin 2008-12-01 15:57:57 UTC
> lsusb
Bus 008 Device 009: ID 04b8:012d Seiko Epson Corp. Perfection V10/V100 (GT-S600/F650)

> getfacl /dev/bus/usb/008/009
getfacl: Removing leading '/' from absolute path names
# file: dev/bus/usb/008/009
# owner: root
# group: lp
user::rw-
group::rw-
other::r--


> /usr/lib/YaST2/bin/test_and_set_scanner_access_permissions
/usr/lib/YaST2/bin/test_and_set_scanner_access_permissions: line 91: /etc/hal/fdi/policy/10osvendor/80-scanner.fdi: Permission denied

>The YaST scanner module runs it when it set up a
>scanner and also via the "Other"->"Test" functionality.

not work. ended with an error

>According to /etc/udev/rules.d/55-libsane.rules
>the scanner device node/dev/bus/usb/xxx/yyy
>should be in the "lp" group so that it should work
>to add the normal users which should use the scanner
>to the group "lp".

this works. CAST is it possible to automate this process (if one user on the system than the system) or vydovat window with an explanation about the group lp when you add a scanner?
Comment 14 Johannes Meixner 2008-12-02 06:41:05 UTC
You must run
/usr/lib/YaST2/bin/test_and_set_scanner_access_permissions
as root (like YaST does it), otherwise line 91 in it
"cat /dev/null >$HAL_LOCAL_FILE || exit 0"
must of course correctly fail.

Regarding "automate this process", see
what I already explained in comment #3 regarding
"automated add of normal users to the lp group".
Comment 15 Johannes Meixner 2008-12-02 06:41:09 UTC
*** Bug 450351 has been marked as a duplicate of this bug. ***
Comment 16 Johannes Meixner 2008-12-02 09:57:33 UTC
*** Bug 450726 has been marked as a duplicate of this bug. ***
Comment 17 Johannes Meixner 2008-12-02 11:00:22 UTC
According to comment #5 it seems it has worked
at some time it has also worked for openSUSE 11.1
but now it seems to fail again because
bug #450351 is for SLED 11 beta 6 and
bug #450726 is for openSUSE 11.1 RC1.

Therefore I reopen this report so that an expert
regarding udev and/or HAL and/or hal-resmgr
could have a look what goes wrong here.
Comment 18 Johannes Meixner 2008-12-02 11:25:59 UTC
For all who are in Cc of this bug:

To check whether or not the udev/HAL system knows
about your particular model as a "scanner", run

lshal | egrep 'info\.product|scanner'

and check if your particular model is shown like
-----------------------------------------------------------
  info.capabilities = {'scanner'} (string list)
  info.product = 'ACME FunScanner 1000 series'  (string)
  resmgr.class = 'scanner'  (string)
-----------------------------------------------------------

If not, reboot your system and do the same check again.

Comment 19 Johannes Meixner 2008-12-02 11:32:50 UTC
On a openSUSE 11.1 beta4 system I get only
------------------------------------------------------------
  info.capabilities = {'scanner'} (string list)
  info.product = 'CanoScan N1240U/LiDE 30'  (string)
------------------------------------------------------------
i.e. the "resmgr.class = 'scanner'" line is missing.

I think this could be the reason why hal-resmgr does
not recognize the device as a scanner so that it also
does not grant normal user access permissions for it.

I set NEEDINFO from the hal-resmgr maintainer to have a look
if the root cause might perhaps be in hal-resmgr?
Comment 20 Ludwig Nussel 2008-12-02 12:45:20 UTC
hal-resmgr does not exist anymore. The new tool works quite similar though. It uses access_control.type now.

if everything is right the output of the following two commands should be the same.
$ hal-find-by-property --key access_control.type --string scanner
$ hal-find-by-capability --capability scanner
Comment 21 Ludwig Nussel 2008-12-02 12:54:57 UTC
well, let me guess.

mv /usr/share/hal/fdi/policy/10osvendor/20-acl-management.fdi /etc/hal/fdi/policy/10osvendor/90-acl-management.fdi

fixes the issue?
Comment 22 Danny Al-Gaaf 2008-12-02 13:58:27 UTC
The scanner fdi file shouldn't be in /etc/hal/fdi/policy/10osvendor/ it should go into /etc/hal/fdi/information/20thirdparty/ since it contains no policy but pure device information.
Comment 23 Johannes Meixner 2008-12-03 08:13:45 UTC
All my HAL fdi file were always in
/etc/hal/fdi/policy/10osvendor/ where it worked in the past
and I got never ever a note that this is the wrong place.

Why the hell is this HAL stuff always all the time changing
arbitrarily so that there are regression bugs so that
this HAL stuff always all the time fails arbitrarily
and then the HAL failures are always all the time
re-assigned back to me so that I must work around
all this ever-changing HAL mess?

Why can this HALL mess not just work stable and reliably?
Comment 24 Johannes Meixner 2008-12-03 09:06:02 UTC
I would have to change the packages
sane-backends
hplip
yast2-scanner

But at the current state there is almost no chance
to test if my changes really work well.

Coolo,
please decide if I should now switch all my HAL fdi files 
from /etc/hal/fdi/policy/10osvendor/
to /etc/hal/fdi/information/20thirdparty/
or if HAL should be changed to be backward compatible
to avoid regression bugs like this one.

Danny,
I wonder if /etc/hal/fdi/information/20thirdparty/
is really the right place because my HAL fdi files
are no third-party software for openSUSE because
the above packages sane-backends, hplip, and
yast2-scanner belong to the openSUSE distribution.
Comment 25 Johannes Meixner 2008-12-03 09:24:52 UTC
No directory /etc/hal/fdi/information/20thirdparty/
is provided by HAL.
Should or can I create arbitrary directories
in /etc/hal/fdi/information/ like
/etc/hal/fdi/information/20scanner/
where the name would fit better for my case?
Comment 26 Stephan Kulow 2008-12-03 09:26:07 UTC
Taking your rather highlevel packages today is not that big problem, taking new hal unfortunately is. And I'm not sure this can be fixed with an update either. So I guess I would prefer taking these.

But I'm not sure what this directory mess is all about either. there is policy vs. information and /usr/share vs. etc and 10osvendor vs. 20thirdparty. And if I understand Ludwig correctly, it's just about the order of the fdi files.

What do you need to test your changes? Should be put these 3 packages in the update channel?
Comment 27 Danny Al-Gaaf 2008-12-03 09:40:46 UTC
(In reply to comment #24 from Johannes Meixner)
> Danny,
> I wonder if /etc/hal/fdi/information/20thirdparty/
> is really the right place because my HAL fdi files
> are no third-party software for openSUSE because
> the above packages sane-backends, hplip, and
> yast2-scanner belong to the openSUSE distribution.

The definition of information/20thirdparty/ in the hal SPEC is:
"20thirdparty - from a 3rd party, not included in hal package"
Comment 28 Danny Al-Gaaf 2008-12-03 09:42:40 UTC
(In reply to comment #25 from Johannes Meixner)
> No directory /etc/hal/fdi/information/20thirdparty/
> is provided by HAL.
> Should or can I create arbitrary directories
> in /etc/hal/fdi/information/ like
> /etc/hal/fdi/information/20scanner/
> where the name would fit better for my case?

No, you can't create /etc/hal/fdi/information/20scanner/, you have to create /usr/share/hal/fdi/information/20thirdparty as AFAICS libgphoto2 and other already do.

Comment 29 Danny Al-Gaaf 2008-12-03 09:48:36 UTC
(In reply to comment #26 from Stephan Kulow) 
> But I'm not sure what this directory mess is all about either. there is policy
> vs. information and /usr/share vs. etc and 10osvendor vs. 20thirdparty. And if
> I understand Ludwig correctly, it's just about the order of the fdi files.

The problem is that the scanner file is a file with device information. Those files should be in the /usr/share/hal/fdi/information/20thirdparty or /etc/hal/fdi/information/20thirdparty (which one doesn't matter). The files in the information directory get merged into the HAL device tree before the file in the policy directory. The policy directory contains also the ACL related fdi file. To be able to set the ACLs for scanners, the info that a device is a scanner, need to be merged before the ACL-rules file. This is why the scanner file should be in one of the two 'information' directories.

Btw. I wonder why this wasn't reported earlier, since there was no change in HAL recently about this. It worked this way since  we removed resmgr support and replaced it with ACL HAL support.

Comment 30 Danny Al-Gaaf 2008-12-03 09:50:30 UTC
(In reply to comment #28 from Danny Kukawka)
> No, you can't create /etc/hal/fdi/information/20scanner/, you have to create
> /usr/share/hal/fdi/information/20thirdparty as AFAICS libgphoto2 and other
> already do.

either /usr/share/hal/fdi/information/20thirdparty or /etc/hal/fdi/information/20thirdparty (while I would prefer /usr/share/... since also all other packages install to this place).

Comment 31 Johannes Meixner 2008-12-03 09:57:34 UTC
In comment #22 you wrote that I should use
/etc/hal/fdi/information/20thirdparty/

In comment #28 you write that I should use
/usr/share/hal/fdi/information/20thirdparty/

A good example how the HAL stuff always all the time
changes arbitrarily.

Danny,
Which exact directoty should I cerate and use
for my HAL fdi files?

Currently my HAL fdi files are
hplip: /etc/hal/fdi/policy/10osvendor/70-hpmud.fdi
sane-backends: /etc/hal/fdi/policy/10osvendor/70-scanner.fdi
yast2-scanner: /etc/hal/fdi/policy/10osvendor/80-scanner.fdi
where the entries in all three fdi files are of the form

    <match key="info.subsystem" string="usb_device">
      <match key="usb_device.vendor_id" int="0x1a2b">
        <match key="usb_device.product_id" int="0x3c4d">
          <append key="info.capabilities" type="strlist">scanner</append>
        </match>
      </match>
    </match>
Comment 32 Johannes Meixner 2008-12-03 09:59:26 UTC
O.k. comment #30 provides the info.

I will change the packages
sane-backends
hplip
yast2-scanner
to create and use
/usr/share/hal/fdi/information/20thirdparty/
for their HAL fdi files.
Comment 33 Ludwig Nussel 2008-12-03 10:10:54 UTC
wasn't the original reason to choose /etc because at least some of those files are generated (by yast?) at runtime?
Comment 34 Johannes Meixner 2008-12-03 10:57:45 UTC
Up to now /etc/hal/fdi/policy/10osvendor/80-scanner.fdi
was created by the YaST scanner module at runtime.

Now the YaST scanner module will create at runtime
/usr/share/hal/fdi/information/20thirdparty/80-scanner.fdi
which cannot work if /usr/ is mounted read-only.

Should therefore the YaST scanner module create the directory 
/etc/hal/fdi/information/20thirdparty
with whatever default permissions and write
/etc/hal/fdi/information/20thirdparty/80-scanner.fdi
or
should it simply write
/etc/hal/fdi/information/80-scanner.fdi
because the /etc/hal/fdi/information/ directory
is already provided by the hal package?
Comment 35 Johannes Meixner 2008-12-03 11:22:18 UTC
Right now I submitted hplip and sane-backends to STABLE/FACTORY.

hplip.changes
- Moved /etc/hal/fdi/policy/10osvendor/70-hpmud.fdi
  to /usr/share/hal/fdi/information/20thirdparty/70-hpmud.fdi

sane-backends.changes
- Moved /etc/hal/fdi/policy/10osvendor/70-scanner.fdi
  to /usr/share/hal/fdi/information/20thirdparty/70-scanner.fdi
Comment 36 Danny Al-Gaaf 2008-12-03 11:55:18 UTC
(In reply to comment #34 from Johannes Meixner)
> Up to now /etc/hal/fdi/policy/10osvendor/80-scanner.fdi
> was created by the YaST scanner module at runtime.

Wasn't aware of this.

> Should therefore the YaST scanner module create the directory 
> /etc/hal/fdi/information/20thirdparty
> with whatever default permissions and write
> /etc/hal/fdi/information/20thirdparty/80-scanner.fdi

Correct, write it to this directory. I guess with the same permissions as the parent directory.
Comment 37 Johannes Meixner 2008-12-03 13:39:55 UTC
Right now I submitted yast2-scanner to STABLE/FACTORY.

yast2-scanner.changes
- Using /usr/share/hal/fdi/information/20thirdparty/70-scanner.fdi
  instead of /etc/hal/fdi/policy/10osvendor/70-scanner.fdi
  and /etc/hal/fdi/information/20thirdparty/80-scanner.fdi
  instead of /etc/hal/fdi/policy/10osvendor/80-scanner.fdi
  (see Novell/Suse Bugzilla bnc#438867).

/etc/hal/fdi/information/20thirdparty/ is created with
the same usual default permissions "drwxr-xr-x  root root"
as the other directories in /etc/hal/fdi/ which are already
provided by the hal RPM.
Comment 38 Johannes Meixner 2008-12-03 14:40:52 UTC
The new packages work on my openSUSE 11.0 workstation
but not on a openSUSE 11.1 RC2 test system:

udi = '/org/freedesktop/Hal/devices/usb_device_4a9_220e_noserial'
  info.capabilities = {'scanner'} (string list)
  info.linux.driver = 'usb'  (string)
  info.parent = 
    '/org/freedesktop/Hal/devices/usb_device_1d6b_1_0000_00_1d_0' (string)
  info.product = 'CanoScan N1240U/LiDE 30'  (string)
  info.subsystem = 'usb_device'  (string)
  info.udi = 
    '/org/freedesktop/Hal/devices/usb_device_4a9_220e_noserial' (string)
  info.vendor = 'Canon, Inc.'  (string)
  linux.device_file = '/dev/bus/usb/001/005'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'usb'  (string)
  linux.sysfs_path = 
    '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-2' (string)
  usb_device.bus_number = 1  (0x1)  (int)
  usb_device.can_wake_up = true  (bool)
  usb_device.configuration_value = 1  (0x1)  (int)
  usb_device.device_class = 255  (0xff)  (int)
  usb_device.device_protocol = 255  (0xff)  (int)
  usb_device.device_revision_bcd = 256  (0x100)  (int)
  usb_device.device_subclass = 0  (0x0)  (int)
  usb_device.is_self_powered = false  (bool)
  usb_device.linux.device_number = 5  (0x5)  (int)
  usb_device.linux.sysfs_path =
    '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-2' (string)
  usb_device.max_power = 500  (0x1f4)  (int)
  usb_device.num_configurations = 1  (0x1)  (int)
  usb_device.num_interfaces = 1  (0x1)  (int)
  usb_device.num_ports = 0  (0x0)  (int)
  usb_device.product = 'CanoScan N1240U/LiDE 30'  (string)
  usb_device.product_id = 8718  (0x220e)  (int)
  usb_device.speed = 12.0 (12) (double)
  usb_device.vendor = 'Canon, Inc.'  (string)
  usb_device.vendor_id = 1193  (0x4a9)  (int)
  usb_device.version = 1.1 (1.1) (double)

blackbird:~ # hal-find-by-property --key access_control.type --string scanner
blackbird:~ # hal-find-by-capability --capability scanner
/org/freedesktop/Hal/devices/usb_device_4a9_220e_noserial

I.e. via the "--key access_control.type" it cannot find it
because there is no access_control.type for this UDI.

blackbird:~ # find /etc/hal/ | xargs grep 'access_control\.type' | grep scanner
blackbird:~ # find /usr/share/hal/ | xargs grep 'access_control\.type' | grep scanner
/usr/share/hal/fdi/policy/10osvendor/20-acl-management.fdi:     <merge key="access_control.type" type="string">scanner</merge>
/usr/share/hal/fdi/policy/10osvendor/20-acl-management.fdi:          <merge key="access_control.type" type="string">scanner</merge>

/usr/share/hal/fdi/policy/10osvendor/20-acl-management.fdi contains
---------------------------------------------------------------------------
<match key="info.capabilities" contains="usbraw">
  <match key="info.capabilities" sibling_contains="scanner">
    <append key="info.capabilities" type="strlist">access_control</append>
---------------------------------------------------------------------------

But as far as I see <match key="info.capabilities" contains="usbraw">
is not true for scanners because it is just
  info.capabilities = {'scanner'} (string list)

blackbird:~ # rpm -qf /usr/share/hal/fdi/policy/10osvendor/20-acl-management.fdi
hal-0.5.12-10.1

Comment 39 Johannes Meixner 2008-12-03 14:55:24 UTC
Even after I changed the entry for this scanner in
/usr/share/hal/fdi/information/20thirdparty/70-scanner.fdi to
--------------------------------------------------------------------------
      <match key="usb_device.vendor_id" int="0x04a9">
        <match key="usb_device.product_id" int="0x220e">
          <append key="info.capabilities" type="strlist">scanner</append>
          <append key="info.capabilities" type="strlist">usbraw</append>
        </match>
      </match>
--------------------------------------------------------------------------
and rebooted blackbird,
it seems to look better in lshal:

udi = '/org/freedesktop/Hal/devices/usb_device_4a9_220e_noserial'
  info.capabilities = {'scanner', 'usbraw'} (string list)
  ...

Nevertheless it does not work:

blackbird:~ # hal-find-by-property --key access_control.type --string scanner
blackbird:~ # hal-find-by-capability --capability scanner
/org/freedesktop/Hal/devices/usb_device_4a9_220e_noserial

Comment 40 Johannes Meixner 2008-12-03 15:32:23 UTC
We did various experiments on blackbird to find out
what the root cause could be (without success)
so that currently the HAL fdi files on blackbird
are not the original ones from the current RPMs.
Comment 41 Ludwig Nussel 2008-12-03 16:02:11 UTC
Fix:
sed -i s/usb_device/usb/ /usr/share/hal/fdi/information/20thirdparty/70-scanner.fdi

Explanation:
The problem is caused by the device hierarchy. A USB device may have
multiple interfaces. On current Linux kernels (it was different in
the past) this is represented by a USB parent device (type
usb_device) and several children (type usb) which represent the
interfaces. Only the parent actually has a Linux device file
(/dev/bus/usb/*/*). The current scanner fdi file adds the "scanner"
property to that parent node. The ACL fdi file however expects the
property in an interface node and also merges the access control
properties into the interface node. That's slightly confusing as the
interface doesn't actually have a device file. Since it's not
possible to merge properties into the parent and to make installing
an ACL possible nevertheless the ACL fdi file copies the device file
property from the parent node into the interface node.
Comment 42 Ludwig Nussel 2008-12-03 16:38:25 UTC
I've submitted a sane-backends package with the change. Verified with Canon Scanner.
Comment 43 Andreas Jaeger 2008-12-04 08:26:53 UTC
sane-backends was checked into 11.1.  Can this bug get resolved as fixed now?
Comment 44 Johannes Meixner 2008-12-04 08:50:52 UTC
Ludwig,
very many thanks for the analysis and the solution!

I like to state here very clearly that it was and is
only Ludwig who always informed me and helped me
to get this HAL mess somehow working for the
current Suse Linux and openSUSE product.

Again the HAL mess changed in an incompatible way
so that the fdi files need to be changed too
in a non-backward compatible way.

For your information some snippets about the
history of this nonsense of changes in HAL:

Initially we had
  <match key="linux.subsystem" string="usb">
see
https://bugzilla.novell.com/show_bug.cgi?id=142859#c0

which was changed to
  <match key="info.category" string="usbraw">
see
https://bugzilla.novell.com/show_bug.cgi?id=142859#c10

which was changed to
  <match key="info.bus" string="usb_device">
see
https://bugzilla.novell.com/show_bug.cgi?id=250659#c21

which was changed to
  <match key="info.subsystem" string="usb_device">
for openSUSE 10.3 if I remember correctly

which must now according to comment #41 be changed to
  <match key="info.subsystem" string="usb">
and accordingly
    <match key="usb.vendor_id" int="0x1a2b">
      <match key="usb.product_id" int="0x3c4d">


Does anybody of the readers of this bug report really expect
that this HAL mess can ever work stable and reliably?

At least for me it never did and I assume it will never ever
work stable and reliable in the near future.

The root cause of all this incredible HAL mess is
of course only the totally broken way how HAL is developed
(i.e. continuous incompatible changes all the time)
but nevertheless as all the time in the past I accept
this bug report and try again to work around the HAL mess.
Comment 45 Johannes Meixner 2008-12-04 08:53:28 UTC
Andreas,
it is of course not yet fixed (see comment #24) because
I must also adapt the packages hplip and yast2-scanner
Comment 46 Danny Al-Gaaf 2008-12-04 09:32:20 UTC
(In reply to comment #44 from Johannes Meixner)
> Ludwig,
> very many thanks for the analysis and the solution!
> 
> I like to state here very clearly that it was and is
> only Ludwig who always informed me and helped me
> to get this HAL mess somehow working for the
> current Suse Linux and openSUSE product.
> 
> Again the HAL mess changed in an incompatible way
> so that the fdi files need to be changed too
> in a non-backward compatible way.
[...]
> The root cause of all this incredible HAL mess is
> of course only the totally broken way how HAL is developed
> (i.e. continuous incompatible changes all the time)
> but nevertheless as all the time in the past I accept
> this bug report and try again to work around the HAL mess.

Please don't spread FUD. As Ludwig already pointed out in comment #41, the problems are caused by changes in the linux kernel and the device hierarchy in the sysfs. There was nothing changed in the HAL usb related code since a long time.

There are no "continuous incompatible changes all the time" in HAL. HAL and the SPEC is very stable and changes as e.g. from info.bus to info.subsystem where announced/known at least 6 months before the old keys where removed from HAL completely.
Comment 48 Johannes Meixner 2008-12-04 10:20:48 UTC
Thanks for the clarification in comment #46.

But as far as I understand it this even proves
that HAL is broken by design because its user interface
(e.g. the fdi files for me as a user of the HAL system)
depend on kernel-internal values which is in contradiction to
http://www.kroah.com/log/linux/stable_api_nonsense.html
where Greg K-H wrote
----------------------------------------------------------
Linux does not have a binary kernel interface,
nor does it have a stable kernel interface.
Please realize that this article describes
the _in kernel_ interfaces, not the kernel
to userspace interfaces. 
The kernel to userspace interface is the one that
application programs use, the syscall interface.
That interface is _very_ stable over time,
and will not break ...
This interface is the one that users and application
programmers can count on being stable. 
----------------------------------------------------------

When from the user's point of view HAL works on raw
kernel-internal values and when according to what
Greg K-H wrote kernel-internal values must be
intentionally unstable, it is obvious that also
the HAL user interface (e.g. the fdi files) must be
unstable which is a broken design because even the kernel
provides a stable interface for the user.

Here I am the user of HAL - or in other words:
From the HAL point of view I am HALs customer.

Probably I do not understand this all and I cannot
expect to have a piece of software which lets me do
hardware abstraction stuff in a stable and reliable way.
Comment 49 Johannes Meixner 2008-12-04 10:45:43 UTC
Ludwig also fixed it for hplip - very many thanks for it!

Therefore I have to fix now only yast2-scanner.
Comment 50 Johannes Meixner 2008-12-04 11:53:04 UTC
Right now I submitted yast2-scanner 2.17.5 to STABLE/FACTORY.

Hopefully it is fixed now - I still have to test it...
Comment 51 Juergen Weigert 2008-12-04 13:37:23 UTC
Johannes' complaint is: changes are shining through something that is supposed to be an abstraction layer.

Danny explains, it is not HAL that changes. Thanks Danny!

GregKH explains that kernel internal structures are not designed to be stable.

My assumption is that HAL exposes those changing kernel structures.

If that assumption is true, we 
need HAKAL, the Hardware And Kernel Abstraction Layer.

What is needed to do this? Isn't HAL designed to provide most of it already?
not able to also provide kernel abstraction?
Comment 52 Johannes Meixner 2008-12-04 13:49:48 UTC
It works for me with the newest packages
sane-backends, hplip, and yast2-scanner.

Before others can test it, make sure that
you have the right newest packages installed
where the RPM changelogs contain this:

sane-backends:
---------------------------------------------------------------------
* Wed Dec 03 2008 lnussel@suse.de
- use "usb" instead of "usb_device" (bnc#438867)
---------------------------------------------------------------------

hplip:
---------------------------------------------------------------------
* Wed Dec 03 2008 lnussel@suse.de
- use "usb" instead of "usb_device" (bnc#438867)
---------------------------------------------------------------------

yast2-scanner:
---------------------------------------------------------------------
* Thu Dec 04 2008 jsmeix@suse.de
- V 2.17.5
- Since openSUSE 11.1 'usb_device' must be replaced by 'usb' in
  HAL fdi files (see Novell/Suse Bugzilla bnc#438867).
  Adapted test_and_set_scanner_access_permissions so that it
  works for openSUSE 11.1 and is still to some extent
  backward compatible with openSUSE 11.0.
---------------------------------------------------------------------
Comment 53 Johannes Meixner 2008-12-04 13:52:51 UTC
Comment #51 is exactly what I mean.
Comment 54 Johannes Meixner 2008-12-04 14:03:48 UTC
All I like to do is to tell the underlying system
(I don't care what the underlying system actually is)
that a USB device with a particular USB vendor and product ID
is a "scanner" (because there is no USB device class for scanners
so that there cannot be a generic rule to match for scanners).

More precisely:
Actually I do not care if this USB device is a "scanner"
or whatever else kind of device (e.g. a all-in-one device).
Actaully all I like to do is to tell the underlying system
that a USB device with a particular USB vendor and product ID
should be accessible for "normal users" (and I don't care
what a "normal user" is according to whatever current policy
of whatever current underlying system).
Comment 55 Johannes Meixner 2008-12-04 14:40:32 UTC
If the assumption that HAL exposes unstable kernel structures
in its fdi files is true, it means that RPMs which provide
HAL fdi files (e.g. sane-backends, hplip, yast2-scanner)
must have a RPM requirement of a particular kernel version.
Should I add such a RPM requirement to my packages?

How should a open-source projects (e.g. SANE or HPLIP)
or a third-party software vendor make RPMs
which provide HAL fdi files?
Comment 56 Johannes Meixner 2009-01-07 08:25:11 UTC
*** Bug 462817 has been marked as a duplicate of this bug. ***
Comment 57 Alexander Orlovskyy 2009-01-07 08:29:59 UTC
Closing bug.
Comment 58 Forgotten User DHIkF8sU1p 2009-01-09 13:09:12 UTC
Is this Bugreport closed, while there are fixed packages?
I'm only a DAU, but i need my scanner working

sorry
Bernd

Comment 59 Alexander Orlovskyy 2009-01-09 13:49:01 UTC
Bernd, it`s closed because of duplicate.
For further development refer bug 462817
Comment 60 Forgotten User DHIkF8sU1p 2009-01-09 16:56:22 UTC
I knew, that the bug 462817 is a duplicate, but 
is marked as resolved, with a redirection to 438867.

Please reopen this one and ignore the other or help me out ;-)

I have found _here_ a possible solution, but it will not work,
i'm in the group 'lp'

bernd@eddie:~> getfacl /dev/bus/usb/001/005
getfacl: Removing leading '/' from absolute path names
# file: dev/bus/usb/001/005
# owner: root
# group: root
user::rw-
group::r--
other::r--

Bernd

Repository: @System
Name: sane-backends
Version: 1.0.19-99.1
Name: yast2-scanner
Version: 2.17.5-2.1
Comment 61 Juergen Helmers 2009-01-09 17:23:43 UTC
Hi!

Exact same here. THis is aloop of two closed bugs with no solution for the problem. I was waiting for new packages as well but that might take some time longer? As far as I am concerned there is no solution for this behaviour at this point. The scanner device on my system belongs to root.root as well. I have added my user to group lp but even if I chgrp the scanner usb device to "users" my user can't see or use the scanner:

as root:

#lsusb:
Bus 005 Device 002: ID 04b8:011f Seiko Epson Corp. Perfection 1670

#getfacl /dev/bus/usb/005/002
getfacl: Removing leading '/' from absolute path names
# file: dev/bus/usb/005/002
# owner: root
# group: root
user::rw-
group::r--
other::r--

#chgrp users /dev/bus/usb/005/002

#getfacl /dev/bus/usb/005/002
getfacl: Removing leading '/' from absolute path names
# file: dev/bus/usb/005/002
# owner: root
# group: users
user::rw-
group::r--
other::r--

as regular user:

#sane-find-scanner -q
found USB scanner (vendor=0x04b8, product=0x011f) at libusb:005:002

#scanimage -L

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).

Cheers Juergen

Comment 62 Forgotten User DHIkF8sU1p 2009-01-09 18:11:09 UTC
Bingo!


@Juergen
I have found the error, please enable line 858 in 
/etc/udev/rules.d/55-libsane.rules, then the scanner is correct identified
and work as user.



Comment 63 Forgotten User DHIkF8sU1p 2009-01-09 18:17:41 UTC
bernd@eddie:~> getfacl /dev/bus/usb/001/006
getfacl: Removing leading '/' from absolute path names
# file: dev/bus/usb/001/006
# owner: root
# group: lp
user::rw-
group::rw-
other::r--
Comment 64 Juergen Helmers 2009-01-09 21:28:12 UTC
Hi Bernd,

thanks a lot, that works. I had added myself to the "lp" group before. For the overall public though, this is not of that much help, since a regular user is not a membner of the group "lp" by default.

So in the bigger picture I would consider this a workaround (which I am very grateful for!!).

Wouldn't it make more sense to have the device belong to the "users" group? Then again, what do I know...

Thanks again!

Cheers Juergen

Comment 65 Ludwig Nussel 2009-01-12 15:38:14 UTC
(In reply to comment #61)
> Bus 005 Device 002: ID 04b8:011f Seiko Epson Corp. Perfection 1670

That scanner is commented out in
/usr/share/hal/fdi/information/20thirdparty/70-scanner.fdi
(line 2143)

To discuss why that is the case (I don't know) it's best to open a
new bug report (CC me) as this bug here is about the generic
permission handling problem whereas you face a problem with your
specific model only. Thanks!
Comment 66 Johannes Meixner 2009-01-13 07:09:07 UTC
There are lines commented out both in 55-libsane.rules
and in 70-scanner.fdi for models which are actually supported
because of an unexpeced side-effect of the solution of bug #439193.
I reopened bug #439193.

Nevertheless I wonder why the workaround which
is shown by YaST (see comment #3) is not simply used:
-----------------------------------------------------------
... you could access
the scanner via the 'saned' as a workaround.
For this workaround choose 'scanning via network'
and select the 'local host configuration'.
----------------------------------------------------------
In particular on a workstation in a trusted network
environment (e.g. when the Suse firewall protects it
from acceess from the external network zone / Internet)
this workaround should cause no security problems.
Comment 67 Juergen Helmers 2009-01-13 09:48:59 UTC
> Nevertheless I wonder why the workaround which
> is shown by YaST (see comment #3) is not simply used:
> -----------------------------------------------------------
> ... you could access
> the scanner via the 'saned' as a workaround.
> For this workaround choose 'scanning via network'
> and select the 'local host configuration'.
> ----------------------------------------------------------
> In particular on a workstation in a trusted network
> environment (e.g. when the Suse firewall protects it
> from acceess from the external network zone / Internet)
> this workaround should cause no security problems.

Hi!

Well, it does eat up resources to have another daemon running. Plus I personally use a scanning software that does not support network scanners (vuescan).

Cheers Juergen
Comment 68 Johannes Meixner 2009-01-13 10:53:16 UTC
I wonder how much resources an idle xinetd eats up
(saned is launced only when needed via the xinetd).
At least my xinedt needs basically no resources when it is idle ;-)