Date:2014-03-26 00:54:09 (5 years 7 months ago)
Author:Werner Almesberger
Commit:f1e689eaa662a4a3ce83dfa99cb2c00a4202189e
Message:atusb/fw/: support alternative interface names with DFU

Files: atusb/fw/descr.c (1 diff)
atusb/fw/usb/dfu.c (2 diffs)
atusb/fw/usb/dfu.h (2 diffs)

Change Details

atusb/fw/descr.c
100100
101101    /* Interface #1 */
102102
103    DFU_ITF_DESCR(1, 0, dfu_proto_runtime)
103    DFU_ITF_DESCR(1, 0, dfu_proto_runtime, 0)
104104};
atusb/fw/usb/dfu.c
4646#define DFU_ALT_SETTINGS 1
4747#endif
4848
49#ifndef DFU_ALT_NAME_0_IDX
50#define DFU_ALT_NAME_0_IDX 0
51#endif
52
53#ifndef DFU_ALT_NAME_1_IDX
54#define DFU_ALT_NAME_1_IDX 0
55#endif
56
57#ifndef DFU_ALT_NAME_2_IDX
58#define DFU_ALT_NAME_2_IDX 0
59#endif
60
4961
5062const uint8_t device_descriptor[] = {
5163    18, /* bLength */
...... 
8294
8395    /* Interface #0 */
8496
85    DFU_ITF_DESCR(0, 0, dfu_proto_dfu)
97    DFU_ITF_DESCR(0, 0, dfu_proto_dfu, DFU_ALT_NAME_0_IDX)
8698#if DFU_ALT_SETTINGS >= 1
87    DFU_ITF_DESCR(0, 1, dfu_proto_dfu)
99    DFU_ITF_DESCR(0, 1, dfu_proto_dfu, DFU_ALT_NAME_1_IDX)
88100#endif
89101#if DFU_ALT_SETTINGS >= 2
90    DFU_ITF_DESCR(0, 2, dfu_proto_dfu)
102    DFU_ITF_DESCR(0, 2, dfu_proto_dfu, DFU_ALT_NAME_2_IDX)
91103#endif
92104};
93105
atusb/fw/usb/dfu.h
8686};
8787
8888
89#define DFU_ITF_DESCR(itf, alt, proto) \
89#define DFU_ITF_DESCR(itf, alt, proto, idx) \
9090    9, /* bLength */ \
9191    USB_DT_INTERFACE, /* bDescriptorType */ \
9292    (itf), /* bInterfaceNumber */ \
...... 
9595    0xfe, /* bInterfaceClass (application specific) */ \
9696    0x01, /* bInterfaceSubClass (device fw upgrade) */ \
9797    (proto), /* bInterfaceProtocol (dfu_proto_*) */ \
98    0, /* iInterface */
98    (idx), /* iInterface */
9999
100100
101101struct dfu_flash_ops {

Archive Download the corresponding diff file



interactive