Bug 168933 - USB camera not accessible except by root
USB camera not accessible except by root
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: gphoto2 (Show other bugs)
rawhide
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Radek Vokal
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-09-21 09:42 EDT by John Ellson
Modified: 2007-11-30 17:11 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-11-14 02:18:39 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Ellson 2005-09-21 09:42:44 EDT
Description of problem:
USB camera can be accessed by gphoto running as root, but fails to
show up on regular user's desktop.  Suspect hotplug problem.
/var/log/messages gives this for the hotplug event:

Sep 21 09:36:43 ontap kernel: ohci_hcd 0000:00:02.0: wakeup
Sep 21 09:36:44 ontap kernel: usb 2-4: new full speed USB device using ohci_hcd
and address 5
Sep 21 09:36:44 ontap udevd[642]: get_udevd_msg: udevd event message received
Sep 21 09:36:44 ontap udevd[642]: main: skip uevent_helper message with SEQNUM,
netlink is active
Sep 21 09:36:44 ontap udevd[642]: msg_queue_insert: seq 635 queued, 'add'
'/devices/pci0000:00/0000:00:02.0/usb2/2-4'
Sep 21 09:36:44 ontap udevd[642]: udev_event_run: seq 635 forked, pid [5986],
'add' 'usb', 0 seconds old
Sep 21 09:36:44 ontap udevd[642]: msg_queue_insert: seq 636 queued, 'add'
'/devices/pci0000:00/0000:00:02.0/usb2/2-4/2-4:1.0'
Sep 21 09:36:44 ontap udevd[642]: get_udevd_msg: udevd event message received
Sep 21 09:36:44 ontap udevd[642]: main: skip uevent_helper message with SEQNUM,
netlink is active
Sep 21 09:36:44 ontap udevd[642]: msg_queue_insert: seq 637 queued, 'add'
'/class/usb_device/usbdev2.5'
Sep 21 09:36:44 ontap udevd[642]: get_udevd_msg: udevd event message received
Sep 21 09:36:44 ontap udevd[642]: main: skip uevent_helper message with SEQNUM,
netlink is active
Sep 21 09:36:44 ontap udev[5986]: run_program: '/sbin/udev_run_hotplugd' 'usb'
Sep 21 09:36:44 ontap udev[5986]: run_program: '/sbin/udev_run_hotplugd'
returned with status 0
Sep 21 09:36:44 ontap udev[5986]: run_program: '/sbin/udev_run_devd' 'usb'
Sep 21 09:36:44 ontap udev[5986]: run_program: '/sbin/udev_run_devd' returned
with status 0
Sep 21 09:36:44 ontap udevd[642]: udev_done: seq 635, pid [5986] exit, 0 seconds old
Sep 21 09:36:44 ontap udevd[642]: udev_event_run: seq 636 forked, pid [5992],
'add' 'usb', 0 seconds old
Sep 21 09:36:44 ontap udev[5992]: run_program: '/sbin/modprobe
usb:v04A9p309Dd0001dc00dsc00dp00ic06isc01ip01'
Sep 21 09:36:44 ontap udev[5992]: run_program: '/sbin/modprobe' (stderr) 'FATAL:
Module usb:v04A9p309Dd0001dc00dsc00dp00ic06isc01ip01 not found.'
Sep 21 09:36:44 ontap udev[5992]: run_program: '/sbin/modprobe' returned with
status 1
Sep 21 09:36:44 ontap udev[5992]: run_program: '/sbin/udev_run_hotplugd' 'usb'
Sep 21 09:36:44 ontap udev[5992]: run_program: '/sbin/udev_run_hotplugd'
returned with status 0
Sep 21 09:36:44 ontap udev[5992]: run_program: '/sbin/udev_run_devd' 'usb'
Sep 21 09:36:44 ontap udev[5992]: run_program: '/sbin/udev_run_devd' returned
with status 0
Sep 21 09:36:44 ontap udevd[642]: udev_done: seq 636, pid [5992] exit, 0 seconds old
Sep 21 09:36:44 ontap udevd[642]: udev_event_run: seq 637 forked, pid [5997],
'add' 'usb_device', 0 seconds old
Sep 21 09:36:44 ontap udev[5997]: udev_rules_get_name: no node name set, will
use kernel name 'usbdev2.5'
Sep 21 09:36:44 ontap udev[5997]: create_node: creating device node '/dev/usbdev2.5'
Sep 21 09:36:44 ontap udev[5997]: run_program: '/sbin/udev_run_hotplugd'
'usb_device'
Sep 21 09:36:44 ontap udev[5997]: run_program: '/sbin/udev_run_hotplugd'
returned with status 0
Sep 21 09:36:44 ontap udev[5997]: run_program: '/sbin/udev_run_devd' 'usb_device'
Sep 21 09:36:44 ontap udev[5997]: run_program: '/sbin/udev_run_devd' returned
with status 0
Sep 21 09:36:44 ontap udevd[642]: udev_done: seq 637, pid [5997] exit, 1 seconds old

Version-Release number of selected component (if applicable):
hotplug-2004_09_23-10
kernel-2.6.13-1.1565_FC5
gphoto2-2.1.6-2
nautilus-2.12.0-1
hal-0.5.4-3

How reproducible:
100%

Steps to Reproduce:
1.plug in camera
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Bill Nottingham 2005-09-21 14:02:56 EDT
What sort of camera, and what sort of interface does it support?
Comment 2 John Ellson 2005-09-21 15:01:30 EDT
Its a Canon PowerShot Pro1, 8M pixel.

I believe the interface protocol is PTP

USB ID 04a9:309d
Comment 3 John Ellson 2005-09-21 15:22:53 EDT
I tried regenerating /etc/hotplug/usb.usermap by reinstalling gphoto2
and no, it doesn't contain an entry for 04a9:309d, yet gphoto2 running as root
can read the camera just fine.
Comment 4 Bill Nottingham 2005-09-21 15:53:45 EDT
usermap isn't used any more. Which is possibly why this is happening; this needs
to be done via udev rules on usb device insertion.
Comment 5 John Ellson 2005-09-21 16:26:02 EDT
What udev rules?   I get no hits with "grep -i cam /etc/udev/rules.d/*"
Is there some documentation somewhere that is specific to udev+usbcam ?

Does this mean that all 457 usb camera models are not working now?
Comment 6 John Ellson 2005-09-21 16:44:03 EDT
"lsusb -v" output for my camera - but I think that putting back support for 
the other 457 is equally inportant.    Can something in /etc/udev/rules.d/
be populated by conversion of information from /etc/hotplu/usb.usermap ?

--------------------- lsusb -v -------------------------------
Bus 002 Device 002: ID 04a9:309d Canon, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        32
  idVendor           0x04a9 Canon, Inc.
  idProduct          0x309d
  bcdDevice            0.01
  iManufacturer           1 Canon Inc.
  iProduct                2 Canon Digital Camera
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass         6 Imaging
      bInterfaceSubClass      1 Still Image Capture
      bInterfaceProtocol      1 Picture Transfer Protocol (PIMA 15470)
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              96
Comment 7 David Zeuthen 2005-09-22 10:06:10 EDT
HAL should already know it's a camera since the gphoto2 RPM installs a device
information file (.fdi file) that is autogenerated from the drivers we ship with
gphoto2.

So I think we should just install a .fdi file that runs a script to modify the
ownership of the node in /proc/bus/usb/devices in case it's a camera.

I also think that the gphoto2 RPM should provide said .fdi file and script and
just install it into /usr/share/hal/fdi/policy/20thirdparty/ - that's what it is
therefore.

Thoughts?
Comment 8 John Ellson 2005-09-22 12:30:24 EDT
A parochial question.  The ghoto2 file:
/usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2.fdi
does not contain an entry for the Canon PowerShot Pro1 (ID 04a9:309d)
so how is it that ghoto2 recognizes my camara when run as root?

Is there some kind of wildcard mechanism for PTP cameras, perhaps?

If so, how will the permissions for these get set up?
Comment 9 Harald Hoyer 2005-10-06 03:29:05 EDT
err, why was this assigned to udev?
Comment 10 John Ellson 2005-10-06 08:27:59 EDT
Probably because of the suggestion in comment #4 that there are some rules
missing in  /etc/udev/rules.d  ?
Comment 11 Harald Hoyer 2005-10-06 10:21:43 EDT
well udev is not a HW DB... HAL is for that kind of things
Comment 12 John Ellson 2005-10-10 09:53:13 EDT
So Harald, if this is not your bug, can you please reassign it to the right
project/person?

This whole gphoto2-usb-hal-udev-hotplug-kernel  chain is way too complicated for
any mere mortal to understand.  All I know is that USB cameras basically haven't
worked for me on Fedora for over a year!
Comment 13 Harald Hoyer 2005-10-10 11:03:15 EDT
David Zeuthen commented:
So I think we should just install a .fdi file that runs a script to modify the
ownership of the node in /proc/bus/usb/devices in case it's a camera.

I also think that the gphoto2 RPM should provide said .fdi file and script and
just install it into /usr/share/hal/fdi/policy/20thirdparty/ - that's what it is
therefore.

Comment 14 Kaj J. Niemi 2005-10-11 14:08:13 EDT
Interestingly enough I have the same problem with a Canon Powershot G5 using
USB. This stopped working 2-3 weeks ago (I know it worked early September).

Comment 15 Kaj J. Niemi 2005-10-11 14:17:23 EDT
The only thing I could find in messages was the following when plugging in the
camera... there used to be more stuff printed out I think.

Oct 10 18:21:24 heidi NetworkManager: <debug info>      [1128957684.543399]  ():
New device added (hal udi is
'/org/freedesktop/Hal/devices/usb_device_4a9_3085_noserial').
Oct 10 18:21:24 heidi NetworkManager: <debug info>      [1128957684.595053]  ():
New device added (hal udi is
'/org/freedesktop/Hal/devices/usb_device_4a9_3085_noserial_if0').

A corresponding entry is found in 10-camera-libgphoto2.fdi

      <match key="usb.vendor_id" int="0x04a9">
        <match key="usb.product_id" int="0x3085">
          <merge key="info.category" type="string">camera</merge>
          <append key="info.capabilities" type="strlist">camera</append>
          <merge key="camera.access_method" type="string">libgphoto2</merge>
        </match>
      </match>

Instead of gphoto2 I use gthumb but I doubt it makes a difference? I'm running
2.6.13-1.1574_FC5 on a IBM T40p laptop.

Any thoughts?
Comment 16 John Ellson 2005-11-12 08:27:26 EST
From the ChangeLog it looked like today's update to gphoto2-2.1.6-6 was supposed
to fix this problem, but it doesn't.   Running "gphoto2 -L" as root
works OK, but when running as a regular user I still get:

*** Error ***
An error occurred in the io-library ('Could not claim the USB device'): Could
not claim interface 0 (Operation not permitted). Make sure no other program or
kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have
read/write access to the device.
*** Error (-53: 'Could not claim the USB device') ***
Comment 17 John Ellson 2005-11-12 09:55:39 EST
Dup of Bug #150985

Fixed by gphoto2-2.1.6-6 + patch from Bug #150985 comment #16

Note You need to log in before you can comment on or make changes to this bug.