Bug 309815

Summary: HAL triggers only sometimes resmgr to set the ACL for a USB scanner
Product: [openSUSE] openSUSE 10.3 Reporter: Miquel A. Noguera <ibz>
Component: HotplugAssignee: Danny Al-Gaaf <dalgaaf>
Status: RESOLVED DUPLICATE QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: jsmeix, lnussel
Version: Beta 3   
Target Milestone: ---   
Hardware: i686   
OS: openSUSE 10.3   
Whiteboard:
Found By: Beta-Customer Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: screnshoot 1 (after reboot)
screnshoot 1 (after powering off/on scanner)
My /var/log/messages
lsusb
ls -l /dev/bus/usb/*/*
getfacl /dev/bus/usb/*/*
lshal

Description Miquel A. Noguera 2007-09-12 11:30:22 UTC
My (EPSON perfection 2400) scanner is properly configured and working fine.

Sometimes nevertheless it is impossible to accede it from kooka or xsane (no device available).

When it happens the error, lsusb and hwinfo can see the device.

Normally this failure only happens after booting, and disappears when I reset (power off, then power on) the scanner.
Comment 1 Miquel A. Noguera 2007-09-12 11:33:53 UTC
Created attachment 163516 [details]
screnshoot 1 (after reboot)

This screnshoot shows window error and the output of lsusb and hwinfo --scan when problem occurs.
Comment 2 Miquel A. Noguera 2007-09-12 11:44:25 UTC
Created attachment 163518 [details]
screnshoot 1 (after powering off/on scanner)

In this other screenshot nothing has changed, except I've powered off, then powered on my scanner.
Comment 3 Miquel A. Noguera 2007-09-12 11:55:46 UTC
Created attachment 163519 [details]
My /var/log/messages
Comment 4 Johannes Meixner 2007-09-13 07:13:31 UTC
Because it "disappears when I reset (power off, then power on)
the scanner" it is
either
a problem in the scanner e.g. that it may fall into a (comatose)
sleep mode where only a power-off/on awakes it
or
it is a problem in the udev/HAL/resmgr machinery.

Did you use openSUSE 10.2 or Suse Linux 10.1 before and
there it doesn't happen?
If yes, it is no problem in the scanner.

Does the problem happen only for a normal user
but as root it works always?
If yes it is a problem with the permission setting for normal usres
which is done via the udev/HAL/resmgr machinery.
Do "scanimage -L" as normal user and as root to find out
if the scanner is accessible.

Regarding "no device available":
This messge may be misleading because when "lsusb" lists it,
it doesn't mean that the actual device file /dev/bus/usb/*/*
which is used for I/O by the SANE software is correctly created.

Therefore provide the output of the three commands (as root)
when the problem happens:

lsusb

ls -l /dev/bus/usb/*/*

getfacl /dev/bus/usb/*/*

(Preferably as text/plain attachment and not as a screenhot image.)

Comment 5 Miquel A. Noguera 2007-09-13 07:40:24 UTC
This scanner works actually without problems in openSUSE 10.2 / Ubuntu 7.10

I will try to reproduce the problem after/before syncing with today's Factory changes and provide you with requested information if it persists.
Comment 6 Johannes Meixner 2007-09-13 08:03:02 UTC
Please provide the output of the commands in comment #0
when the problem is present and after you did a power-off/on.
Alternatively a USB cable unplug/replug should also help
because this also triggers the udev->HAL->resmgr machinery.
Comment 7 Miquel A. Noguera 2007-09-13 09:13:20 UTC
You're right, this is an udev->HAL->resmgr permissions problem, and unpluging/replugin USB cable helps too.

Comment 8 Miquel A. Noguera 2007-09-13 09:15:45 UTC
Created attachment 163789 [details]
lsusb
Comment 9 Miquel A. Noguera 2007-09-13 09:16:44 UTC
Created attachment 163790 [details]
ls -l /dev/bus/usb/*/*
Comment 10 Miquel A. Noguera 2007-09-13 09:17:16 UTC
Created attachment 163792 [details]
getfacl /dev/bus/usb/*/*
Comment 11 Johannes Meixner 2007-09-13 09:34:58 UTC
Attachment #163790 [details] shows that the udev rules
in /etc/udev/rules.d/55-libsane.rules have been applied
because the group is set to "lp".

Attachment #163792 [details] shows that the HAL/resmgr stuff was not done
because no ACL was set.

Because it works after re-plug, it shows that the HAL policy
files are correctly set up.
In particular your /etc/hal/fdi/policy/10osvendor/70-scanner.fdi
should contain this entry for your model:
-------------------------------------------------------------------
<match key="info.bus" string="usb_device">
 <match key="usb_device.vendor_id" int="0x04b8">
  <match key="usb_device.product_id" int="0x011b">
   <append key="info.capabilities" type="strlist">scanner</append>
  </match>
 </match>
</match>
-------------------------------------------------------------------

If the HAL/resmgr stuff works, getfacl would show something like
-------------------------------------------------------------------
# file: dev/bus/usb/003/003
# owner: root
# group: lp
user::rw-
user:<normal-user>:rw-
group::rw-
mask::rw-
other::r--
-------------------------------------------------------------------
to allow the <normal-user> read/write access.

As a workaround add the normal users which should be allowed
to access the scanner to the "lp" group.

I am no HAL/resmgr expert so that I cannot debug it further
and therefore I reassign it to the HAL maintainer.
Comment 12 Danny Al-Gaaf 2007-09-13 10:03:53 UTC
Could you please attach the complete output of lshal?
Comment 13 Ludwig Nussel 2007-09-13 10:10:46 UTC
sounds like a duplicate of bug 309171
Is autologin enabled?
Comment 14 Miquel A. Noguera 2007-09-13 10:27:25 UTC
Created attachment 163820 [details]
lshal
Comment 15 Miquel A. Noguera 2007-09-13 11:01:16 UTC
Yes, autologin was enabled.

Disabling it solves the problem and is as an acceptable workaround for me.
Comment 16 Danny Al-Gaaf 2007-09-13 11:07:33 UTC

*** This bug has been marked as a duplicate of bug 309171 ***