<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/12498">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Jenkins Builder: Verified
Harald Welte: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">fix USB enabling<br><br>Change-Id: I22cdd77648ac21490909423bf529fb31f30d6af0<br>---<br>M usb/class/dfu/device/dfudf.c<br>1 file changed, 22 insertions(+), 24 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c</span><br><span>index 7747a23..faf12c1 100644</span><br><span>--- a/usb/class/dfu/device/dfudf.c</span><br><span>+++ b/usb/class/dfu/device/dfudf.c</span><br><span>@@ -46,33 +46,31 @@</span><br><span> </span><br><span> usb_iface_desc_t ifc_desc;</span><br><span> uint8_t * ifc;</span><br><span style="color: hsl(0, 100%, 40%);">- uint8_t i;</span><br><span> </span><br><span> ifc = desc->sod;</span><br><span style="color: hsl(0, 100%, 40%);">- for (i = 0; i < 2; i++) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (NULL == ifc) {</span><br><span style="color: hsl(0, 100%, 40%);">- return ERR_NOT_FOUND;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ifc_desc.bInterfaceNumber = ifc[2];</span><br><span style="color: hsl(0, 100%, 40%);">- ifc_desc.bInterfaceClass = ifc[5];</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (USB_DFU_CLASS == ifc_desc.bInterfaceClass) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (func_data->func_iface == ifc_desc.bInterfaceNumber) { // Initialized</span><br><span style="color: hsl(0, 100%, 40%);">- return ERR_ALREADY_INITIALIZED;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (func_data->func_iface != 0xFF) { // Occupied</span><br><span style="color: hsl(0, 100%, 40%);">- return ERR_NO_RESOURCE;</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- func_data->func_iface = ifc_desc.bInterfaceNumber;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- } else { // Not supported by this function driver</span><br><span style="color: hsl(0, 100%, 40%);">- return ERR_NOT_FOUND;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- // there are no endpoint to install since DFU uses only the control endpoint</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ifc = usb_find_desc(usb_desc_next(desc->sod), desc->eod, USB_DT_INTERFACE);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (NULL == ifc) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return ERR_NOT_FOUND;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ifc_desc.bInterfaceNumber = ifc[2];</span><br><span style="color: hsl(120, 100%, 40%);">+ ifc_desc.bInterfaceClass = ifc[5];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (USB_DFU_CLASS == ifc_desc.bInterfaceClass) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (func_data->func_iface == ifc_desc.bInterfaceNumber) { // Initialized</span><br><span style="color: hsl(120, 100%, 40%);">+ return ERR_ALREADY_INITIALIZED;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (func_data->func_iface != 0xFF) { // Occupied</span><br><span style="color: hsl(120, 100%, 40%);">+ return ERR_NO_RESOURCE;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ func_data->func_iface = ifc_desc.bInterfaceNumber;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ } else { // Not supported by this function driver</span><br><span style="color: hsl(120, 100%, 40%);">+ return ERR_NOT_FOUND;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ // there are no endpoint to install since DFU uses only the control endpoint</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ifc = usb_find_desc(usb_desc_next(desc->sod), desc->eod, USB_DT_INTERFACE);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> // Installed</span><br><span> _dfudf_funcd.enabled = true;</span><br><span> return ERR_NONE;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/12498">change 12498</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/12498"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: osmo-asf4-dfu </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I22cdd77648ac21490909423bf529fb31f30d6af0 </div>
<div style="display:none"> Gerrit-Change-Number: 12498 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Kévin Redon <kredon@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>