Re: [Libusb-devel] [PATCH 1/4] linux: Stop the kernel from re-attaching in kernel drivers after a reset

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

 



Hi,

On 02/09/2011 04:35 PM, Peter Stuge wrote:
Hans de Goede wrote:
the kernel will not do the device attach after reset, if no
driver was bound to the interface before the reset.

Hmm!

I'm a little tempted to try to push this "workaround" into the kernel
instead..


I know the feeling, which is why I first did a more generic thread
about this including linux-usb@xxxxxxxxxxxxxxx in the CC, see the
thread titled "usbfs/libusb and resetting usb devices"

Here is a quote from my mail with Alan Stern's reply:

"
> I was wondering if it wouldn't be even
> better to add a .pre_reset and .post_reset code to the usbfs
> driver, so that 2 changes into just:
>
> 2:
> -the linux kernel does the reset
>
> IOW the usbfs driver does not get detached for a reset.
>
> So what do others think. Would it be a good idea to change things
> this way, or is the usbfs driver detaching intended / expected
> behavior?

It is intended/expected, because in general there is no way for usbfs
to inform its users that a reset has occurred.  The only safe thing it
can do is release the interfaces it owns.

The situation is the same for kernel drivers that don't have pre_reset
and post_reset methods; the core has no way to inform them about resets
so instead it unbinds them.

Alan Stern
"

Actually I'm pretty happy with my current patch, my first fix for
this involved claiming the usb hub port before the reset, which
required finding the hub to which the device is attached. I've
saved my code doing that in case it comes in handy later. Trust
me when I say that the patch I actually send is a lot prettier then
the hub port claiming stuff :)

And what is the situation like on systems other than Linux?

I don't know. I'm assuming that the desired behavior is that interfaces
claimed before a reset stay claimed over the reset, and that is what
my current patch accomplishes. Other systems may need some work to
achieve the same result, but I think it is best to define the desired
semantics and then try to implement them.

Regards,

Hans
--
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