Change in osmo-asf4-dfu[master]: make USB descriptor available for the two state machines

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:19 UTC 2019


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

Change subject: make USB descriptor available for the two state machines
......................................................................

make USB descriptor available for the two state machines

this is required to know the DFU bmAttributes since they affect
the state machine

Change-Id: Ib3907423bb9e197f53ed4522e8a5789a3d29489e
---
M usb/class/dfu/device/dfudf.c
M usb/class/dfu/device/dfudf_desc.h
M usb_start.c
3 files changed, 15 insertions(+), 5 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 15a89fc..42b708b 100644
--- a/usb/class/dfu/device/dfudf.c
+++ b/usb/class/dfu/device/dfudf.c
@@ -22,8 +22,9 @@
 
 #include "dfudf.h"
 #include "usb_protocol_dfu.h"
+#include "dfudf_desc.h"
 
-/** USB Device DFU Fucntion Specific Data */
+/** USB Device DFU Function Specific Data */
 struct dfudf_func_data {
 	/** DFU Interface information */
 	uint8_t func_iface;
@@ -34,6 +35,10 @@
 static struct usbdf_driver _dfudf;
 static struct dfudf_func_data _dfudf_funcd;
 
+/** USB DFU functional descriptor (with DFU attributes) */
+static const uint8_t usb_dfu_func_desc_bytes[] = {DFUD_IFACE_DESCB};
+static const usb_dfu_func_desc_t* usb_dfu_func_desc = (usb_dfu_func_desc_t*)&usb_dfu_func_desc_bytes;
+
 enum usb_dfu_state dfu_state = USB_DFU_STATE_DFU_IDLE;
 enum usb_dfu_status dfu_status = USB_DFU_STATUS_OK;
 
diff --git a/usb/class/dfu/device/dfudf_desc.h b/usb/class/dfu/device/dfudf_desc.h
index 5590e16..cd6ba41 100644
--- a/usb/class/dfu/device/dfudf_desc.h
+++ b/usb/class/dfu/device/dfudf_desc.h
@@ -75,6 +75,11 @@
 	                           CONF_USB_DFUD_BMATTRI, \
 	                           CONF_USB_DFUD_BMAXPOWER)
 
+#define DFUD_IFACE_DESCB USB_DFU_FUNC_DESC_BYTES(USB_DFU_ATTRIBUTES_CAN_DOWNLOAD | USB_DFU_ATTRIBUTES_WILL_DETACH, \
+	                     	                     0, /**< detaching makes only sense in run-time mode */ \
+	                     	                     512, /**< transfer size corresponds to page size for optimal flash writing */ \
+	                     	                     0x0110 /**< DFU specification version 1.1 used */ )
+
 #define DFUD_IFACE_DESCES \
 	USB_IFACE_DESC_BYTES(CONF_USB_DFUD_BIFCNUM, \
 	                     CONF_USB_DFUD_BALTSET, \
@@ -83,10 +88,7 @@
 	                     USB_DFU_SUBCLASS, \
 	                     USB_DFU_PROTOCOL_DFU, \
 	                     CONF_USB_DFUD_IINTERFACE), \
-	                     USB_DFU_FUNC_DESC_BYTES(USB_DFU_ATTRIBUTES_CAN_DOWNLOAD | USB_DFU_ATTRIBUTES_WILL_DETACH, \
-	                     	                     0, /**< detaching makes only sense in run-time mode */ \
-	                     	                     1024, /**< transfer size corresponds to page size for optimal flash writing */ \
-	                     	                     0x0110 /**< DFU specification version 1.1 used */ )
+	                     DFUD_IFACE_DESCB
 
 #define DFUD_STR_DESCES \
 	CONF_USB_DFUD_LANGID_DESC \
diff --git a/usb_start.c b/usb_start.c
index 4f9f875..d911db4 100644
--- a/usb_start.c
+++ b/usb_start.c
@@ -39,6 +39,9 @@
 #endif
 };
 
+/** USB DFU functional descriptor (with DFU attributes) */
+static const uint8_t usb_dfu_func_desc_bytes[] = {DFUD_IFACE_DESCB};
+static const usb_dfu_func_desc_t* usb_dfu_func_desc = (usb_dfu_func_desc_t*)&usb_dfu_func_desc_bytes;
 /** Ctrl endpoint buffer */
 static uint8_t ctrl_buffer[64];
 

-- 
To view, visit https://gerrit.osmocom.org/12506
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: Ib3907423bb9e197f53ed4522e8a5789a3d29489e
Gerrit-Change-Number: 12506
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/29585786/attachment.htm>


More information about the gerrit-log mailing list