Re: What does physical disconnect do that driver unload doesn't?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 30 Aug 2009, Tilman Schmidt wrote:

> While working on the driver for the device:
> 
> ID 0681:0002 Siemens Information and Communication Products Gigaset 3075 Passive ISDN
> 
> I have repeatedly encountered an error state I can only clear
> by disconnecting and reconnecting the USB cable. The device
> just stops responding to commands. (Specifically, the USB OUT
> transfer sending the command to the device is successful but
> the expected reply from the device is never signalled.) This
> state persists even if I unload the driver and load it again:
> the driver probes the device just fine, switches the altsetting
> successfully, but none of the initialization commands get any
> response. When I unplug and replug the USB cable, however, the
> device immediately starts responding normally again.
> 
> I should mention that this device is self-powered, so unplugging
> the USB cable does not power down the device. In fact, its main
> function (ISDN PABX and DECT base) is unaffected by the error or
> by the unplugging.
> 
> I'd like to spare the users of the driver the hassle of pulling
> the plug. So what does disconnecting the USB cable do that even
> unbinding the driver doesn't?

Unplugging the cable removes the +5V power line.  Even though your 
device is self-powered, it may monitor this voltage.

More significantly, when the cable is plugged back in again the system 
will reset the device.  Unloading and reloading a driver does not do 
this.

> What can I do programmatically
> from within the driver to get as near to an actual physical
> disconnect as possible?

You can call usb_reset_device() or usb_queue_reset_device().  See the
kerneldoc for those functions in drivers/usb/core/hub.c; using them 
correctly can be a little tricky.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux