On Tue, 23 Mar 2004, Sean Neakums wrote: > gphoto2 is not too happy with this. Below is the output. > > Also attached is an strace log, in case it is of interest. > > > *** Error *** > Could not apply USB settings > > *** Error *** > An error occurred in the io-library ('Error updating the port settings'): Could > not set config 0/1 (Device or resource busy) > *** Error (-37: 'Error updating the port settings') ***
I'd say gphoto2 could use a little rewriting. In the meantime, here's a compromise patch. It should be acceptable to gphoto2. Does it still result in those suspend_hc/wakeup_hc cycles? If it does then something else is still wrong and needs to be fixed. Both strace and dmesg output will help. Alan Stern ===== drivers/usb/core/devio.c 1.88 vs edited ===== --- 1.88/drivers/usb/core/devio.c Wed Mar 17 14:16:46 2004 +++ edited/drivers/usb/core/devio.c Tue Mar 23 11:27:20 2004 @@ -414,6 +414,8 @@ if (ep & ~(USB_DIR_IN|0xf)) return -EINVAL; + if (!dev->actconfig) + return -ESRCH; for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { iface = dev->actconfig->interface[i]; for (j = 0; j < iface->num_altsetting; j++) { @@ -434,6 +436,8 @@ if (ifn & ~0xff) return -EINVAL; + if (!dev->actconfig) + return -ESRCH; for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { if (dev->actconfig->interface[i]-> altsetting[0].desc.bInterfaceNumber == ifn) @@ -750,9 +754,24 @@ static int proc_setconfig(struct dev_state *ps, void __user *arg) { unsigned int u; + struct usb_host_config *actconfig = ps->dev->actconfig; if (get_user(u, (unsigned int __user *)arg)) return -EFAULT; + if (actconfig && actconfig->desc.bConfigurationValue == u) + return usb_reset_configuration(ps->dev); + + /* Don't change the configuration if any interfaces are claimed. + * It would interfere with other drivers' operations, and if an + * interface is claimed by usbfs it would cause deadlock. */ + if (actconfig) { + int i; + + for (i = 0; i < actconfig->desc.bNumInterfaces; ++i) { + if (usb_interface_claimed(actconfig->interface[i])) + return -EBUSY; + } + } return usb_set_configuration(ps->dev, u); } ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel