From 5f506117354d8763b7d6356d3c00ecc0b64af198 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Fri, 10 Jun 2011 23:15:51 -0300 Subject: [PATCH] atusb/fw/usb/: DFU_ITF_DESCR also needs a protocol argument - dfu.h (enum dfu_itf_proto): bInterfaceProtocol values for DFU functional descriptor - dfu.h (DFU_ITF_DESCR): added protocol argument - dfu.c (config_descriptor): pass protocol to DFU_ITF_DESCR --- atusb/fw/usb/dfu.c | 2 +- atusb/fw/usb/dfu.h | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/atusb/fw/usb/dfu.c b/atusb/fw/usb/dfu.c index ef3f66e..83c52d5 100644 --- a/atusb/fw/usb/dfu.c +++ b/atusb/fw/usb/dfu.c @@ -76,7 +76,7 @@ const uint8_t config_descriptor[] = { /* Interface #0 */ - DFU_ITF_DESCR(0) + DFU_ITF_DESCR(0, dfu_proto_dfu) }; diff --git a/atusb/fw/usb/dfu.h b/atusb/fw/usb/dfu.h index fec269d..0670012 100644 --- a/atusb/fw/usb/dfu.h +++ b/atusb/fw/usb/dfu.h @@ -62,6 +62,11 @@ enum dfu_state { dfuERROR }; +enum dfu_itf_proto { + dfu_proto_runtime = 1, /* Runtime protocol */ + dfu_proto_dfu = 2, /* DFU mode protocol */ +}; + #define DFU_DT_FUNCTIONAL 0x21 /* DFU FUNCTIONAL descriptor type */ @@ -78,7 +83,7 @@ struct dfu { }; -#define DFU_ITF_DESCR(itf) \ +#define DFU_ITF_DESCR(itf, proto) \ 9, /* bLength */ \ USB_DT_INTERFACE, /* bDescriptorType */ \ (itf), /* bInterfaceNumber */ \ @@ -86,7 +91,7 @@ struct dfu { 0, /* bNumEndpoints */ \ 0xfe, /* bInterfaceClass (application specific) */ \ 0x01, /* bInterfaceSubClass (device fw upgrade) */ \ - 0x02, /* bInterfaceProtocol (DFU mode protocol) */ \ + (proto), /* bInterfaceProtocol (dfu_proto_*) */ \ 0, /* iInterface */