Bug 5063 - usb camera failing in 2.6.13-rc6 (usbfs claim device issue)
Summary: usb camera failing in 2.6.13-rc6 (usbfs claim device issue)
Status: REJECTED DOCUMENTED
Alias: None
Product: Drivers
Classification: Unclassified
Component: USB (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Greg Kroah-Hartman
URL:
Keywords:
: 5525 (view as bug list)
Depends on:
Blocks: USB
  Show dependency tree
 
Reported: 2005-08-14 03:18 UTC by Con Kolivas
Modified: 2005-10-29 16:31 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.13-rc6
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Con Kolivas 2005-08-14 03:18:21 UTC
Distribution: Mandriva 10.2
Hardware Environment: ASUS P4PE motherboard, pentium4 3.06, uhci_hcd usb
Software Environment: Digikam 0.6.2 (although all digicam software shows it)
Problem Description:
A digital camera which was working fine in 2.6.11/12 now fails on 2.6.13-rc6 
(not sure when it started failing).

All the messages seem to indicate that it's working but the digikam 
application now says it fails to initialise the camera.

The relevant info from dmesg says:
usb 3-1: new full speed USB device using uhci_hcd and address 2
usb 3-1: usbfs: interface 0 claimed by usbfs while 'digikamcameracl' sets 
config #1
usb 3-1: USB disconnect, address 2


the only difference from previously is this:
-usb 3-1: usbfs: interface 0 claimed while 'digikamcameracl' sets config #1
+usb 3-1: usbfs: interface 0 claimed by usbfs while 'digikamcameracl' sets 
config #1


dmesg difference does not show any significant difference either apart from 
this:
+usbmon: debugs is not available
-drivers/usb/input/hid-core.c: v2.0:USB HID core driver
+drivers/usb/input/hid-core.c: v2.01:USB HID core driver


lsusb -v shows no difference, here is the relevant section:
Bus 003 Device 003: ID 04a9:3077 Canon, Inc. PowerShot S50
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          0x3077 PowerShot S50
  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


relevant dmesg of 2.6.13-rc6 follows:
drivers/usb/input/hid-core.c: v2.01:USB HID core driver
USB Universal Host Controller Interface driver v2.3
uhci_hcd 0000:00:1d.0: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) 
USB UHCI Controller #1
uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 1
hub 1-0:1.0: USB hub found
uhci_hcd 0000:00:1d.1: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) 
USB UHCI Controller #2
uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 2
hub 2-0:1.0: USB hub found
uhci_hcd 0000:00:1d.2: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) 
USB UHCI Controller #3
uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 3
hub 3-0:1.0: USB hub found
ehci_hcd 0000:00:1d.7: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI 
Controller
usb 1-1: new low speed USB device using uhci_hcd and address 2
input: USB HID v1.00 Mouse [Microsoft Microsoft IntelliMouse
Comment 1 Andrew Morton 2005-08-14 11:12:53 UTC
 http://bugzilla.kernel.org/show_bug.cgi?id=5063

            Summary: usb camera failing in 2.6.13-rc6

Comment 2 Pete Zaitcev 2005-08-14 12:43:18 UTC
It's probably this (cut from -rc6.patch):

--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -579,7 +582,7 @@ static int proc_control(struct dev_state
 		if ((i > 0) && ctrl.wLength) {
 			if (usbfs_snoop) {
 				dev_info(&dev->dev, "control read: data ");
-				for (j = 0; j < ctrl.wLength; ++j)
+				for (j = 0; j < i; ++j)
 					printk ("%02x ", (unsigned char)(tbuf)[j]);
 				printk("\n");
 			}
@@ -784,16 +790,16 @@ static int proc_setconfig(struct dev_sta
  		for (i = 0; i < actconfig->desc.bNumInterfaces; ++i) {
  			if (usb_interface_claimed(actconfig->interface[i])) {
 				dev_warn (&ps->dev->dev,
-					"usbfs: interface %d claimed "
+					"usbfs: interface %d claimed by %s "
 					"while '%s' sets config #%d\n",
 					actconfig->interface[i]
 						->cur_altsetting
 						->desc.bInterfaceNumber,
+					actconfig->interface[i]
+						->dev.driver->name,
 					current->comm, u);
-#if 0	/* FIXME:  enable in 2.6.10 or so */
  				status = -EBUSY;
 				break;
-#endif
 			}
  		}
  	}

Waiting for confirmation from Con.
Comment 3 Alan Stern 2005-08-14 13:57:25 UTC
Pete is correct.  This is a change that has been in the offing for over a year.

What this means is that the problem is a bug in the digikam application.  The
program needs to set the USB configuration _before_ claiming an interface,
instead of _after_.  This should be brought to the attention of the digikam
maintainers.
Comment 4 Con Kolivas 2005-08-14 16:28:52 UTC
Confirmed, reversing this patch fixes it.
Comment 5 Greg Kroah-Hartman 2005-08-14 16:50:47 UTC
> Confirmed, reversing this patch fixes it.

Then the userspace application is broken, and needs to be fixed.

Comment 6 Con Kolivas 2005-08-15 00:46:14 UTC
This change to the kernel in 2.6.13 needs libgphoto2 2.1.6 or later to work.
Suggest this url as a FAQ for those who have this problem.
Comment 7 David Brownell 2005-08-15 03:03:38 UTC
This first came up in something like March 2004, at which 
point that "wait till 2.6.10 or so" workaround was put in 
to give gPhoto2 "more than enough time to deploy the fix 
to their part of the bug".  Clearly, no fix was deployed, 
even with over a year's advance notice. 
 
(The issue has to do with various paths that can self-deadlock 
code that abuses set_configuration.  The kernel fix removed 
one of the last known paths that could self-deadlock.) 
Comment 8 Greg Kroah-Hartman 2005-10-29 16:30:09 UTC
*** Bug 5525 has been marked as a duplicate of this bug. ***

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