Bug 142859

Summary: scanner access and resmgr
Product: [openSUSE] SUSE Linux 10.1 Reporter: Ludwig Nussel <lnussel>
Component: YaST2Assignee: Johannes Meixner <jsmeix>
Status: RESOLVED FIXED QA Contact: Klaus Kämpf <kkaempf>
Severity: Major    
Priority: P5 - None CC: dkukawka
Version: Alpha 4   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: patch to write fdi file
updated patch
/etc/hal/fdi/policy/10osvendor/80-scanner.fdi
/etc/hal/fdi/policy/10osvendor/80-scanner.fdi

Description Ludwig Nussel 2006-01-12 16:06:56 UTC
In 10.0 we used resmgr config files to grant access to scanners (#100695) as libusb used to use resmgr to talk to usb devices. This does no longer work as libusb now directly accesses /dev/bus/usb and therefore no longer depends on resmgr. resmgr in turn does no longer need special handling of usb either, it can just install ACLs on /dev/bus/usb/*/*. Hal now parses files in /etc/hal/fdi/policy so YaST can write an fdi file there instead of a resmgr file.

I'd suggest a file like /etc/hal/fdi/policy/10osvendor/70-resmgr-scanner.fdi with content e.g.

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
    <device>
        <match key="linux.subsystem" string="usb">
            <match key="usb.vendor_id" int="0x152e">
                <match key="usb.product_id" int="0xe003">
                    <merge key="resmgr.class" type="string">scanner</merge>
                </match>
            </match>
        </match>
    </device>
</deviceinfo>
Comment 1 Ludwig Nussel 2006-01-13 13:01:13 UTC
Created attachment 63261 [details]
patch to write fdi file
Comment 2 Ludwig Nussel 2006-01-13 15:31:07 UTC
To eliminate the race when plugging in a scanner and resmgr trying to set the ACL before udev creates the device node Kay offered to implement a new device type we can match instead.

It would be
 <match key="info.category" string="usbdev">
instead of
 <match key="linux.subsystem" string="usb">
in the fdi file.
Comment 3 Ludwig Nussel 2006-01-13 15:40:14 UTC
Created attachment 63291 [details]
updated patch

Also assumes that vendor and product id are in the parent node. Can't test atm, needs an updated hal from Kay.
Comment 4 Kay Sievers 2006-01-13 15:41:53 UTC
Change comitted to HAL CVS, the device is called "usbraw":

udi = '/org/freedesktop/Hal/devices/usb_device_0_0_0000_00_1d_0_usbraw'
  info.udi = '/org/freedesktop/Hal/devices/usb_device_0_0_0000_00_1d_0_usbraw'  (string)
  linux.device_file = '/dev/bus/usb/002/001'  (string)
  linux.subsystem = 'usb_device'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  usbraw.device = '/dev/bus/usb/002/001'  (string)
  info.product = 'USB Raw Device Access'  (string)
  info.capabilities = {'usbraw'} (string list)
  info.category = 'usbraw'  (string)
  info.parent = '/org/freedesktop/Hal/devices/usb_device_0_0_0000_00_1d_0'  (string)
  linux.sysfs_path = '/sys/class/usb_device/usbdev2.1'  (string)
Comment 5 Johannes Meixner 2006-01-13 15:45:39 UTC
Many thanks!
I already applied the first patch.
I will change it accordingly.
In patricular I will use:
<match key="info.category" string="usbraw">
Comment 6 Ludwig Nussel 2006-01-13 15:50:00 UTC
Ok, you also need add the @info.parent: stuff when matching for vendor and product ie.

<match key="@info.parent:usb.vendor_id" int="0x152e">
instead of
<match key="usb.vendor_id" int="0x152e">

I'll also need to update hal-resmgr to make this work.
Comment 7 Johannes Meixner 2006-01-16 11:36:04 UTC
Created attachment 63420 [details]
/etc/hal/fdi/policy/10osvendor/80-scanner.fdi

Submitted new yast2-scanner to STABLE.

See this attachment what it writes in case of more than one scanner.

Kay,
is this correct now?
Comment 8 Ludwig Nussel 2006-01-16 14:23:26 UTC
That should work.

I just tried out hal cvs, the parent is usb_device so instead of usb.vendor_id we need to match usb_device.vendor_id...
Comment 9 Johannes Meixner 2006-01-16 14:53:46 UTC
Submitted changed (according to comment #8) package to STABLE.
Comment 10 Johannes Meixner 2006-01-16 14:55:58 UTC
Created attachment 63460 [details]
/etc/hal/fdi/policy/10osvendor/80-scanner.fdi

What the newest package version in STABLE would write.
Comment 11 Johannes Meixner 2006-01-16 16:19:10 UTC
If you need a scanner for testing:
Go to my office and take the topmost scanner from the "scanner-stack".
It is a Canon CanoScan Lide 30.
It doesn't have a seperate power supply.
It uses only USB power (i.e. your USB must provide sufficient power).
Comment 12 Ludwig Nussel 2006-01-16 17:19:50 UTC
we need a new hal snapshot package to finally verify it.
Comment 13 Johannes Meixner 2006-01-30 15:40:42 UTC
10.1 beta1 works for me on caps.suse.de
=> I set it to FIXED.
Comment 14 Johannes Meixner 2006-01-31 14:50:45 UTC
For your information:
With 10.1 beta2 it didn't work directly after a new installation.
But it worked after one reboot and then it worked even for
additionally set up scanners in the running system.
Comment 15 Ludwig Nussel 2006-01-31 14:54:29 UTC
first boot was broken #145934