Patchwork [U-Boot,v2,2/2] usb: Add CONFIG to fetch string descriptor

login
register
mail settings
Submitter Puneet Saxena
Date Feb. 27, 2012, 3:36 p.m.
Message ID <1330356992-21297-2-git-send-email-puneets@nvidia.com>
Download mbox | patch
Permalink /patch/143211/
State Superseded
Delegated to: Marek Vasut
Headers show

Comments

Puneet Saxena - Feb. 27, 2012, 3:36 p.m.
Add "CONFIG_USB_STRING_FETCH" to fetch string using descriptor length
then fetch actual bytes, returned in descriptor buffer.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
---

Changes for V2:
   - Change config by "CONFIG_USB_STRING_FETCH"

 common/usb.c                    |    4 ++++
 include/configs/tegra2-common.h |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)
Mike Frysinger - Feb. 27, 2012, 6:28 p.m.
On Monday 27 February 2012 10:36:32 Puneet Saxena wrote:
> Add "CONFIG_USB_STRING_FETCH" to fetch string using descriptor length
> then fetch actual bytes, returned in descriptor buffer.

i'm having a hard time understanding what you're trying to say here

new CONFIG_xxx knobs should be documented in top level README

> --- a/include/configs/tegra2-common.h
> +++ b/include/configs/tegra2-common.h
> 
>  #define CONFIG_TEGRA2_GPIO
>  #define CONFIG_CMD_GPIO
> +
>  #endif /* __TEGRA2_COMMON_H */

please do not include unrelated whitespace changes
-mike

Patch

diff --git a/common/usb.c b/common/usb.c
index 2279459..83c6c5c 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -658,9 +658,13 @@  static int usb_string_sub(struct usb_device *dev, unsigned int langid,
 {
 	int rc;
 
+#ifdef CONFIG_USB_STRING_FETCH
+	rc = -1;
+#else
 	/* Try to read the string descriptor by asking for the maximum
 	 * possible number of bytes */
 	rc = usb_get_string(dev, langid, index, buf, 255);
+#endif
 
 	/* If that failed try to read the descriptor length, then
 	 * ask for just that many bytes */
diff --git a/include/configs/tegra2-common.h b/include/configs/tegra2-common.h
index 266d0e5..420d2a9 100644
--- a/include/configs/tegra2-common.h
+++ b/include/configs/tegra2-common.h
@@ -93,6 +93,8 @@ 
 #define CONFIG_USB_EHCI_TXFIFO_THRESH	10
 #define CONFIG_EHCI_IS_TDI
 #define CONFIG_EHCI_DCACHE
+/* string descriptors must not be fetched using a 255-byte read */
+#define CONFIG_USB_STRING_FETCH
 
 /* include default commands */
 #include <config_cmd_default.h>
@@ -172,4 +174,5 @@ 
 
 #define CONFIG_TEGRA2_GPIO
 #define CONFIG_CMD_GPIO
+
 #endif /* __TEGRA2_COMMON_H */