1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-24 23:43:08 +02:00

atusb/fw/: support alternative interface names with DFU

This commit is contained in:
Werner Almesberger 2014-03-25 20:54:09 -03:00
parent 8f2f13c30a
commit f1e689eaa6
3 changed files with 18 additions and 6 deletions

View File

@ -100,5 +100,5 @@ const uint8_t config_descriptor[] = {
/* Interface #1 */
DFU_ITF_DESCR(1, 0, dfu_proto_runtime)
DFU_ITF_DESCR(1, 0, dfu_proto_runtime, 0)
};

View File

@ -46,6 +46,18 @@
#define DFU_ALT_SETTINGS 1
#endif
#ifndef DFU_ALT_NAME_0_IDX
#define DFU_ALT_NAME_0_IDX 0
#endif
#ifndef DFU_ALT_NAME_1_IDX
#define DFU_ALT_NAME_1_IDX 0
#endif
#ifndef DFU_ALT_NAME_2_IDX
#define DFU_ALT_NAME_2_IDX 0
#endif
const uint8_t device_descriptor[] = {
18, /* bLength */
@ -82,12 +94,12 @@ const uint8_t config_descriptor[] = {
/* Interface #0 */
DFU_ITF_DESCR(0, 0, dfu_proto_dfu)
DFU_ITF_DESCR(0, 0, dfu_proto_dfu, DFU_ALT_NAME_0_IDX)
#if DFU_ALT_SETTINGS >= 1
DFU_ITF_DESCR(0, 1, dfu_proto_dfu)
DFU_ITF_DESCR(0, 1, dfu_proto_dfu, DFU_ALT_NAME_1_IDX)
#endif
#if DFU_ALT_SETTINGS >= 2
DFU_ITF_DESCR(0, 2, dfu_proto_dfu)
DFU_ITF_DESCR(0, 2, dfu_proto_dfu, DFU_ALT_NAME_2_IDX)
#endif
};

View File

@ -86,7 +86,7 @@ struct dfu {
};
#define DFU_ITF_DESCR(itf, alt, proto) \
#define DFU_ITF_DESCR(itf, alt, proto, idx) \
9, /* bLength */ \
USB_DT_INTERFACE, /* bDescriptorType */ \
(itf), /* bInterfaceNumber */ \
@ -95,7 +95,7 @@ struct dfu {
0xfe, /* bInterfaceClass (application specific) */ \
0x01, /* bInterfaceSubClass (device fw upgrade) */ \
(proto), /* bInterfaceProtocol (dfu_proto_*) */ \
0, /* iInterface */
(idx), /* iInterface */
struct dfu_flash_ops {