public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] usb_storage : scan all interfaces to find a storage device
@ 2015-03-03 21:17 franck.jullien at gmail.com
  2015-03-03 22:28 ` Marek Vasut
  0 siblings, 1 reply; 4+ messages in thread
From: franck.jullien at gmail.com @ 2015-03-03 21:17 UTC (permalink / raw)
  To: u-boot

From: Franck Jullien <franck.jullien@gmail.com>

Mass storage is not necessary present on interface 0. This
patch allow usb_stor_scan to look in every available interface.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
 common/usb_storage.c |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/common/usb_storage.c b/common/usb_storage.c
index 1411737..a9160fd 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -215,7 +215,7 @@ static unsigned int usb_get_max_lun(struct us_data *us)
  */
 int usb_stor_scan(int mode)
 {
-	unsigned char i;
+	unsigned char i, iface;
 	struct usb_device *dev;
 
 	if (mode == 1)
@@ -241,20 +241,22 @@ int usb_stor_scan(int mode)
 		if (dev == NULL)
 			break; /* no more devices available */
 
-		if (usb_storage_probe(dev, 0, &usb_stor[usb_max_devs])) {
-			/* OK, it's a storage device.  Iterate over its LUNs
-			 * and populate `usb_dev_desc'.
-			 */
-			int lun, max_lun, start = usb_max_devs;
-
-			max_lun = usb_get_max_lun(&usb_stor[usb_max_devs]);
-			for (lun = 0;
-			     lun <= max_lun && usb_max_devs < USB_MAX_STOR_DEV;
-			     lun++) {
-				usb_dev_desc[usb_max_devs].lun = lun;
-				if (usb_stor_get_info(dev, &usb_stor[start],
-				    &usb_dev_desc[usb_max_devs]) == 1) {
-					usb_max_devs++;
+		for (iface = 0; iface < dev->config.no_of_if; iface++) {
+			if (usb_storage_probe(dev, 0, &usb_stor[usb_max_devs])) {
+				/* OK, it's a storage device.  Iterate over its LUNs
+				 * and populate `usb_dev_desc'.
+				 */
+				int lun, max_lun, start = usb_max_devs;
+
+				max_lun = usb_get_max_lun(&usb_stor[usb_max_devs]);
+				for (lun = 0;
+				     lun <= max_lun && usb_max_devs < USB_MAX_STOR_DEV;
+				     lun++) {
+					usb_dev_desc[usb_max_devs].lun = lun;
+					if (usb_stor_get_info(dev, &usb_stor[start],
+					    &usb_dev_desc[usb_max_devs]) == 1) {
+						usb_max_devs++;
+					}
 				}
 			}
 		}
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-04 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-03 21:17 [U-Boot] [PATCH] usb_storage : scan all interfaces to find a storage device franck.jullien at gmail.com
2015-03-03 22:28 ` Marek Vasut
2015-03-04  6:34   ` Franck Jullien
2015-03-04 12:36     ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox