Closed baerwolf closed 7 years ago
We should not flags
to 0
either, because the documentation claims that the default is to take the descriptor from flash memory. The bug is that USB_PROP_IS_RAM
is not honored for USB_CFG_DESCR_PROPS_UNKNOWN
. Should be fixed now.
From b7cf38b05b5e69b94d916b977b31786922a3cd1c Mon Sep 17 00:00:00 2001 From: Stephan Baerwolf stephan.baerwolf@tu-ilmenau.de Date: Wed, 17 Jul 2013 00:46:17 +0200 Subject: [PATCH] bugfix: usbFunctionDescriptor() may address flash
In case "USB_CFG_DESCR_PROPS_UNKNOWN" is configured to be "USB_PROP_IS_DYNAMIC", then "usbFunctionDescriptor()" is called with initial value of "flags" ("USB_FLG_MSGPTR_IS_ROM"). Since "usbMsgFlags" always is set to "flags" after "usbFunctionDescriptor" returns, the dynamic RAM address within "usbMsgPtr" may be interpreted as flash pointer! The result is inconsitent data to be transmitted to the host!
This patch workarounds this issue by removing flag "USB_FLG_MSGPTR_IS_ROM" in this special condition. As a result addresses always will be interpreted as RAM ones.
Signed-off-by: Stephan Baerwolf stephan.baerwolf@tu-ilmenau.de
usbdrv/usbdrv.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/usbdrv/usbdrv.c b/usbdrv/usbdrv.c index d838935..23fccb7 100644 --- a/usbdrv/usbdrv.c +++ b/usbdrv/usbdrv.c @@ -345,6 +345,7 @@ uchar flags = USB_FLG_MSGPTR_IS_ROM;
endif