ChangeSet 1.2020.1.133, 2005/03/08 00:43:29-08:00, [EMAIL PROTECTED]

[PATCH] USB: Clear endpoint toggles in usb_set_interface

Pete Zaitcev has found some USB devices that don't reset their endpoint
data toggles when they get a SET-INTERFACE request.  Apparently they
interpret the USB specification too literally when it says that the
toggles must be reset whenever the alternate setting is "changed".

Anyway, this patch calls usb_clear_halt for all endpoints in the
altsetting whenever usb_set_interface is called and the new altsetting is
the same as the old one.  It adds some extra overhead for the majority of
devices that don't need it, but fortunately usb_set_interface isn't called
very often.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


 drivers/usb/core/message.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletion(-)


diff -Nru a/drivers/usb/core/message.c b/drivers/usb/core/message.c
--- a/drivers/usb/core/message.c        2005-03-08 16:41:43 -08:00
+++ b/drivers/usb/core/message.c        2005-03-08 16:41:43 -08:00
@@ -1129,10 +1129,29 @@
        /* prevent submissions using previous endpoint settings */
        usb_disable_interface(dev, iface);
 
+       /* 9.1.1.5 says:
+        *
+        *      Configuring a device or changing an alternate setting
+        *      causes all of the status and configuration values
+        *      associated with endpoints in the affected interfaces to
+        *      be set to their default values. This includes setting
+        *      the data toggle of any endpoint using data toggles to
+        *      the value DATA0.
+        *
+        * Some devices take this too literally and don't reset the data
+        * toggles if the new altsetting is the same as the old one (the
+        * command isn't "changing" an alternate setting).  We will manually
+        * reset the toggles when the new and old altsettings are the same.
+        * Most devices won't need this, but fortunately it doesn't happen
+        * often.
+        */
+       if (iface->cur_altsetting == alt)
+               manual = 1;
        iface->cur_altsetting = alt;
 
        /* If the interface only has one altsetting and the device didn't
-        * accept the request, we attempt to carry out the equivalent action
+        * accept the request (or whenever the old altsetting is the same
+        * as the new one), we attempt to carry out the equivalent action
         * by manually clearing the HALT feature for each endpoint in the
         * new altsetting.
         */



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to