Change in osmo-asf4-dfu[master]: fix USB enabling

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Jan 17 12:08:15 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/12498 )

Change subject: fix USB enabling
......................................................................

fix USB enabling

Change-Id: I22cdd77648ac21490909423bf529fb31f30d6af0
---
M usb/class/dfu/device/dfudf.c
1 file changed, 22 insertions(+), 24 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c
index 7747a23..faf12c1 100644
--- a/usb/class/dfu/device/dfudf.c
+++ b/usb/class/dfu/device/dfudf.c
@@ -46,33 +46,31 @@
 
 	usb_iface_desc_t ifc_desc;
 	uint8_t *        ifc;
-	uint8_t          i;
 
 	ifc = desc->sod;
-	for (i = 0; i < 2; i++) {
-		if (NULL == ifc) {
-			return ERR_NOT_FOUND;
-		}
-
-		ifc_desc.bInterfaceNumber = ifc[2];
-		ifc_desc.bInterfaceClass  = ifc[5];
-
-		if (USB_DFU_CLASS == ifc_desc.bInterfaceClass) {
-			if (func_data->func_iface == ifc_desc.bInterfaceNumber) { // Initialized
-				return ERR_ALREADY_INITIALIZED;
-			} else if (func_data->func_iface != 0xFF) { // Occupied
-				return ERR_NO_RESOURCE;
-			} else {
-				func_data->func_iface = ifc_desc.bInterfaceNumber;
-			}
-		} else { // Not supported by this function driver
-			return ERR_NOT_FOUND;
-		}
-
-		// there are no endpoint to install since DFU uses only the control endpoint
-
-		ifc = usb_find_desc(usb_desc_next(desc->sod), desc->eod, USB_DT_INTERFACE);
+	if (NULL == ifc) {
+		return ERR_NOT_FOUND;
 	}
+
+	ifc_desc.bInterfaceNumber = ifc[2];
+	ifc_desc.bInterfaceClass  = ifc[5];
+
+	if (USB_DFU_CLASS == ifc_desc.bInterfaceClass) {
+		if (func_data->func_iface == ifc_desc.bInterfaceNumber) { // Initialized
+			return ERR_ALREADY_INITIALIZED;
+		} else if (func_data->func_iface != 0xFF) { // Occupied
+			return ERR_NO_RESOURCE;
+		} else {
+			func_data->func_iface = ifc_desc.bInterfaceNumber;
+		}
+	} else { // Not supported by this function driver
+		return ERR_NOT_FOUND;
+	}
+
+	// there are no endpoint to install since DFU uses only the control endpoint
+
+	ifc = usb_find_desc(usb_desc_next(desc->sod), desc->eod, USB_DT_INTERFACE);
+
 	// Installed
 	_dfudf_funcd.enabled = true;
 	return ERR_NONE;

-- 
To view, visit https://gerrit.osmocom.org/12498
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-asf4-dfu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I22cdd77648ac21490909423bf529fb31f30d6af0
Gerrit-Change-Number: 12498
Gerrit-PatchSet: 3
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190117/f540a1cc/attachment.htm>


More information about the gerrit-log mailing list