[PATCH 2/4] main: move dfu_if struct definition to header file
Tormod Volden
lists.tormod at gmail.com
Fri May 20 00:03:15 CEST 2011
From: Tormod Volden <debian.tormod at gmail.com>
---
src/dfu.h | 24 ++++++++++++++++++++++++
src/main.c | 24 ------------------------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/dfu.h b/src/dfu.h
index be879af..4bf88e9 100644
--- a/src/dfu.h
+++ b/src/dfu.h
@@ -57,6 +57,16 @@
#define DFU_STATUS_ERROR_STALLEDPKT 0x0f
+/* DFU interface */
+#define DFU_IFF_DFU 0x0001 /* DFU Mode, (not Runtime) */
+#define DFU_IFF_VENDOR 0x0100
+#define DFU_IFF_PRODUCT 0x0200
+#define DFU_IFF_CONFIG 0x0400
+#define DFU_IFF_IFACE 0x0800
+#define DFU_IFF_ALT 0x1000
+#define DFU_IFF_DEVNUM 0x2000
+#define DFU_IFF_PATH 0x4000
+
/* This is based off of DFU_GETSTATUS
*
* 1 unsigned byte bStatus
@@ -72,6 +82,20 @@ struct dfu_status {
unsigned char iString;
};
+struct dfu_if {
+ u_int16_t vendor;
+ u_int16_t product;
+ u_int8_t configuration;
+ u_int8_t interface;
+ u_int8_t altsetting;
+ int bus;
+ u_int8_t devnum;
+ const char *path;
+ unsigned int flags;
+ libusb_device *dev;
+ libusb_device_handle *dev_handle;
+};
+
void dfu_init( const int timeout );
void dfu_debug( const int level );
int dfu_detach( libusb_device_handle *device,
diff --git a/src/main.c b/src/main.c
index 4bea757..247e502 100644
--- a/src/main.c
+++ b/src/main.c
@@ -52,30 +52,6 @@ unsigned short get_int16_le(const void *p)
int debug;
static int verbose = 0;
-#define DFU_IFF_DFU 0x0001 /* DFU Mode, (not Runtime) */
-#define DFU_IFF_VENDOR 0x0100
-#define DFU_IFF_PRODUCT 0x0200
-#define DFU_IFF_CONFIG 0x0400
-#define DFU_IFF_IFACE 0x0800
-#define DFU_IFF_ALT 0x1000
-#define DFU_IFF_DEVNUM 0x2000
-#define DFU_IFF_PATH 0x4000
-
-struct dfu_if {
- u_int16_t vendor;
- u_int16_t product;
- u_int8_t configuration;
- u_int8_t interface;
- u_int8_t altsetting;
- int bus;
- u_int8_t devnum;
- const char *path;
- unsigned int flags;
- libusb_device *dev;
-
- libusb_device_handle *dev_handle;
-};
-
static int _get_first_cb(struct dfu_if *dif, void *v)
{
struct dfu_if *v_dif = v;
--
1.7.0.4
More information about the devel
mailing list