On Sun, 7 Dec 2003, Mathias Gug wrote:

> The problem happens between 2.4.21-pre4 and pre5.  The following patch 
> breaks things :
> 
> --- include/linux/usb.h.orig  2003-11-12 23:39:28.000000000 +0100
> +++ include/linux/usb.h       2003-11-12 23:41:13.000000000 +0100
> @@ -996,9 +996,9 @@
> #define usb_pipebulk(pipe)    (usb_pipetype((pipe)) == PIPE_BULK)
> 
> /* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
> -#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
> -#define      usb_dotoggle(dev, ep, out)  ((dev)->toggle[out] ^= (1 << (ep)))
> -#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] 
> & ~(1 << (ep))) | ((bit) << (ep)))
> +#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1)
> +#define      usb_dotoggle(dev, ep, out)  ((dev)->toggle[out] ^= (1 << ep))
> +#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] 
> & ~(1 << ep)) | ((bit) << ep))
> 
> /* Endpoint halt control/status ... likewise USE WITH CAUTION */
> #define usb_endpoint_running(dev, ep, out) ((dev)->halted[out] &= ~(1 << (ep)))

Okay, that clears it up!

The only difference is the removal of the parentheses around the ep 
parameter in the macro texts.  Perusal of the kernel code shows that this 
will make a difference in one place.  The following line is from 
proc_resetep() in drivers/usb/devio.c:

        usb_settoggle(ps->dev, ep & 0xf, !(ep & USB_DIR_IN), 0);

That must be what is causing all your problems; without the parens you get 
macro expansions that look like "(1 << ep & 0xf)".  Since the left-shift 
operator binds more tightly than the logical-and operator, the meaning is 
wrong.

This problem was fixed 10 months ago, see

http://linux.bkbits.net:8080/linux-2.4/[EMAIL 
PROTECTED]|src/|src/include|src/include/linux|related/include/linux/usb.h

So if you would try using the most current 2.4.23 kernel, your problem 
should go away.

Alan Stern



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&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