Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 1 | /* |
| 2 | * usb_desc_app.c |
| 3 | * |
| 4 | * Copyright (C) 2019-2020 Sylvain Munaut <tnt@246tNt.com> |
| 5 | * SPDX-License-Identifier: GPL-3.0-or-later |
| 6 | */ |
| 7 | |
| 8 | #include <no2usb/usb_proto.h> |
Sylvain Munaut | b9d9363 | 2021-05-31 14:03:44 +0200 | [diff] [blame] | 9 | #include <no2usb/usb_cdc_proto.h> |
Sylvain Munaut | 4ea7d27 | 2020-10-29 13:17:11 +0100 | [diff] [blame] | 10 | #include <no2usb/usb_dfu_proto.h> |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 11 | #include <no2usb/usb.h> |
| 12 | |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 13 | #include "usb_desc_ids.h" |
| 14 | |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 15 | #define NULL ((void*)0) |
| 16 | #define num_elem(a) (sizeof(a) / sizeof(a[0])) |
| 17 | |
| 18 | |
Sylvain Munaut | b9d9363 | 2021-05-31 14:03:44 +0200 | [diff] [blame] | 19 | usb_cdc_union_desc_def(1); |
| 20 | |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 21 | static const struct { |
| 22 | /* Configuration */ |
| 23 | struct usb_conf_desc conf; |
| 24 | |
| 25 | /* E1 */ |
| 26 | struct { |
Harald Welte | 30fc560 | 2020-12-14 15:56:28 +0100 | [diff] [blame] | 27 | /* Two altsettings are required, as isochronous |
| 28 | * interfaces must have a setting where they don't |
Sylvain Munaut | 9674436 | 2022-01-03 17:03:26 +0100 | [diff] [blame] | 29 | * transceive any data. We just remove the isochronous |
| 30 | * endpoints in the 'off' altsetting */ |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 31 | struct { |
| 32 | struct usb_intf_desc intf; |
Harald Welte | 805f2cf | 2020-12-14 17:31:03 +0100 | [diff] [blame] | 33 | struct usb_ep_desc ep_interrupt; |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 34 | } __attribute__ ((packed)) off; |
| 35 | struct { |
| 36 | struct usb_intf_desc intf; |
| 37 | struct usb_ep_desc ep_data_in; |
| 38 | struct usb_ep_desc ep_data_out; |
| 39 | struct usb_ep_desc ep_fb; |
Harald Welte | 805f2cf | 2020-12-14 17:31:03 +0100 | [diff] [blame] | 40 | struct usb_ep_desc ep_interrupt; |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 41 | } __attribute__ ((packed)) on; |
Sylvain Munaut | 41c98b6 | 2022-01-05 21:11:35 +0100 | [diff] [blame] | 42 | } __attribute__ ((packed)) e1[2]; |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 43 | |
| 44 | /* CDC */ |
| 45 | #if 0 |
| 46 | struct { |
| 47 | struct usb_intf_desc intf_ctl; |
Sylvain Munaut | b9d9363 | 2021-05-31 14:03:44 +0200 | [diff] [blame] | 48 | struct usb_cdc_hdr_desc cdc_hdr; |
| 49 | struct usb_cdc_acm_desc cdc_acm; |
| 50 | struct usb_cdc_union_desc__1 cdc_union; |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 51 | struct usb_ep_desc ep_ctl; |
| 52 | struct usb_intf_desc intf_data; |
| 53 | struct usb_ep_desc ep_data_out; |
| 54 | struct usb_ep_desc ep_data_in; |
| 55 | } __attribute__ ((packed)) cdc; |
| 56 | #endif |
| 57 | |
| 58 | /* DFU Runtime */ |
| 59 | struct { |
| 60 | struct usb_intf_desc intf; |
Sylvain Munaut | 4ea7d27 | 2020-10-29 13:17:11 +0100 | [diff] [blame] | 61 | struct usb_dfu_func_desc func; |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 62 | } __attribute__ ((packed)) dfu; |
| 63 | } __attribute__ ((packed)) _app_conf_desc = { |
| 64 | .conf = { |
| 65 | .bLength = sizeof(struct usb_conf_desc), |
| 66 | .bDescriptorType = USB_DT_CONF, |
| 67 | .wTotalLength = sizeof(_app_conf_desc), |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 68 | .bNumInterfaces = USB_INTF_NUM, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 69 | .bConfigurationValue = 1, |
| 70 | .iConfiguration = 4, |
| 71 | .bmAttributes = 0x80, |
| 72 | .bMaxPower = 0x32, /* 100 mA */ |
| 73 | }, |
Sylvain Munaut | 41c98b6 | 2022-01-05 21:11:35 +0100 | [diff] [blame] | 74 | .e1[0] = { |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 75 | .off = { |
| 76 | .intf = { |
| 77 | .bLength = sizeof(struct usb_intf_desc), |
| 78 | .bDescriptorType = USB_DT_INTF, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 79 | .bInterfaceNumber = USB_INTF_E1(0), |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 80 | .bAlternateSetting = 0, |
Sylvain Munaut | 9674436 | 2022-01-03 17:03:26 +0100 | [diff] [blame] | 81 | .bNumEndpoints = 1, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 82 | .bInterfaceClass = 0xff, |
| 83 | .bInterfaceSubClass = 0xe1, |
| 84 | .bInterfaceProtocol = 0x00, |
| 85 | .iInterface = 5, |
| 86 | }, |
Harald Welte | 805f2cf | 2020-12-14 17:31:03 +0100 | [diff] [blame] | 87 | .ep_interrupt = { |
| 88 | .bLength = sizeof(struct usb_ep_desc), |
| 89 | .bDescriptorType = USB_DT_EP, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 90 | .bEndpointAddress = USB_EP_E1_INT(0), |
Harald Welte | 805f2cf | 2020-12-14 17:31:03 +0100 | [diff] [blame] | 91 | .bmAttributes = 0x03, |
| 92 | .wMaxPacketSize = 10, |
Sylvain Munaut | 1d98709 | 2022-01-05 21:04:09 +0100 | [diff] [blame] | 93 | .bInterval = 4, /* every 4 ms */ |
Harald Welte | 805f2cf | 2020-12-14 17:31:03 +0100 | [diff] [blame] | 94 | }, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 95 | }, |
| 96 | .on = { |
| 97 | .intf = { |
| 98 | .bLength = sizeof(struct usb_intf_desc), |
| 99 | .bDescriptorType = USB_DT_INTF, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 100 | .bInterfaceNumber = USB_INTF_E1(0), |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 101 | .bAlternateSetting = 1, |
Harald Welte | 805f2cf | 2020-12-14 17:31:03 +0100 | [diff] [blame] | 102 | .bNumEndpoints = 4, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 103 | .bInterfaceClass = 0xff, |
| 104 | .bInterfaceSubClass = 0xe1, |
| 105 | .bInterfaceProtocol = 0x00, |
Sylvain Munaut | 41c98b6 | 2022-01-05 21:11:35 +0100 | [diff] [blame] | 106 | .iInterface = 6, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 107 | }, |
| 108 | .ep_data_in = { |
| 109 | .bLength = sizeof(struct usb_ep_desc), |
| 110 | .bDescriptorType = USB_DT_EP, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 111 | .bEndpointAddress = USB_EP_E1_IN(0), |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 112 | .bmAttributes = 0x05, |
Sylvain Munaut | 1d98709 | 2022-01-05 21:04:09 +0100 | [diff] [blame] | 113 | .wMaxPacketSize = 292, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 114 | .bInterval = 1, |
| 115 | }, |
| 116 | .ep_data_out = { |
| 117 | .bLength = sizeof(struct usb_ep_desc), |
| 118 | .bDescriptorType = USB_DT_EP, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 119 | .bEndpointAddress = USB_EP_E1_OUT(0), |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 120 | .bmAttributes = 0x05, |
Sylvain Munaut | 1d98709 | 2022-01-05 21:04:09 +0100 | [diff] [blame] | 121 | .wMaxPacketSize = 292, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 122 | .bInterval = 1, |
| 123 | }, |
| 124 | .ep_fb = { |
| 125 | .bLength = sizeof(struct usb_ep_desc), |
| 126 | .bDescriptorType = USB_DT_EP, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 127 | .bEndpointAddress = USB_EP_E1_FB(0), |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 128 | .bmAttributes = 0x11, |
Sylvain Munaut | 1d98709 | 2022-01-05 21:04:09 +0100 | [diff] [blame] | 129 | .wMaxPacketSize = 3, |
| 130 | .bInterval = 3, /* every 2^(3-1) = 4 ms */ |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 131 | }, |
Harald Welte | 805f2cf | 2020-12-14 17:31:03 +0100 | [diff] [blame] | 132 | .ep_interrupt = { |
| 133 | .bLength = sizeof(struct usb_ep_desc), |
| 134 | .bDescriptorType = USB_DT_EP, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 135 | .bEndpointAddress = USB_EP_E1_INT(0), |
Harald Welte | 805f2cf | 2020-12-14 17:31:03 +0100 | [diff] [blame] | 136 | .bmAttributes = 0x03, |
| 137 | .wMaxPacketSize = 10, |
Sylvain Munaut | 1d98709 | 2022-01-05 21:04:09 +0100 | [diff] [blame] | 138 | .bInterval = 4, /* every 4 ms */ |
Harald Welte | 805f2cf | 2020-12-14 17:31:03 +0100 | [diff] [blame] | 139 | }, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 140 | }, |
| 141 | }, |
Sylvain Munaut | 41c98b6 | 2022-01-05 21:11:35 +0100 | [diff] [blame] | 142 | .e1[1] = { |
| 143 | .off = { |
| 144 | .intf = { |
| 145 | .bLength = sizeof(struct usb_intf_desc), |
| 146 | .bDescriptorType = USB_DT_INTF, |
| 147 | .bInterfaceNumber = USB_INTF_E1(1), |
| 148 | .bAlternateSetting = 0, |
| 149 | .bNumEndpoints = 1, |
| 150 | .bInterfaceClass = 0xff, |
| 151 | .bInterfaceSubClass = 0xe1, |
| 152 | .bInterfaceProtocol = 0x00, |
| 153 | .iInterface = 7, |
| 154 | }, |
| 155 | .ep_interrupt = { |
| 156 | .bLength = sizeof(struct usb_ep_desc), |
| 157 | .bDescriptorType = USB_DT_EP, |
| 158 | .bEndpointAddress = USB_EP_E1_INT(1), |
| 159 | .bmAttributes = 0x03, |
| 160 | .wMaxPacketSize = 10, |
| 161 | .bInterval = 4, /* every 4 ms */ |
| 162 | }, |
| 163 | }, |
| 164 | .on = { |
| 165 | .intf = { |
| 166 | .bLength = sizeof(struct usb_intf_desc), |
| 167 | .bDescriptorType = USB_DT_INTF, |
| 168 | .bInterfaceNumber = USB_INTF_E1(1), |
| 169 | .bAlternateSetting = 1, |
| 170 | .bNumEndpoints = 4, |
| 171 | .bInterfaceClass = 0xff, |
| 172 | .bInterfaceSubClass = 0xe1, |
| 173 | .bInterfaceProtocol = 0x00, |
| 174 | .iInterface = 8, |
| 175 | }, |
| 176 | .ep_data_in = { |
| 177 | .bLength = sizeof(struct usb_ep_desc), |
| 178 | .bDescriptorType = USB_DT_EP, |
| 179 | .bEndpointAddress = USB_EP_E1_IN(1), |
| 180 | .bmAttributes = 0x05, |
| 181 | .wMaxPacketSize = 292, |
| 182 | .bInterval = 1, |
| 183 | }, |
| 184 | .ep_data_out = { |
| 185 | .bLength = sizeof(struct usb_ep_desc), |
| 186 | .bDescriptorType = USB_DT_EP, |
| 187 | .bEndpointAddress = USB_EP_E1_OUT(1), |
| 188 | .bmAttributes = 0x05, |
| 189 | .wMaxPacketSize = 292, |
| 190 | .bInterval = 1, |
| 191 | }, |
| 192 | .ep_fb = { |
| 193 | .bLength = sizeof(struct usb_ep_desc), |
| 194 | .bDescriptorType = USB_DT_EP, |
| 195 | .bEndpointAddress = USB_EP_E1_FB(1), |
| 196 | .bmAttributes = 0x11, |
| 197 | .wMaxPacketSize = 3, |
| 198 | .bInterval = 3, /* every 2^(3-1) = 4 ms */ |
| 199 | }, |
| 200 | .ep_interrupt = { |
| 201 | .bLength = sizeof(struct usb_ep_desc), |
| 202 | .bDescriptorType = USB_DT_EP, |
| 203 | .bEndpointAddress = USB_EP_E1_INT(1), |
| 204 | .bmAttributes = 0x03, |
| 205 | .wMaxPacketSize = 10, |
| 206 | .bInterval = 4, /* every 4 ms */ |
| 207 | }, |
| 208 | }, |
| 209 | }, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 210 | #if 0 |
| 211 | .cdc = { |
| 212 | .intf_ctl = { |
| 213 | .bLength = sizeof(struct usb_intf_desc), |
| 214 | .bDescriptorType = USB_DT_INTF, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 215 | .bInterfaceNumber = USB_INTF_GPS_CDC_CTL, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 216 | .bAlternateSetting = 0, |
| 217 | .bNumEndpoints = 1, |
Sylvain Munaut | b9d9363 | 2021-05-31 14:03:44 +0200 | [diff] [blame] | 218 | .bInterfaceClass = USB_CLS_CDC_CONTROL, |
| 219 | .bInterfaceSubClass = USB_CDC_SCLS_ACM, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 220 | .bInterfaceProtocol = 0x00, |
Sylvain Munaut | 41c98b6 | 2022-01-05 21:11:35 +0100 | [diff] [blame] | 221 | .iInterface = 9, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 222 | }, |
Sylvain Munaut | b9d9363 | 2021-05-31 14:03:44 +0200 | [diff] [blame] | 223 | .cdc_hdr = { |
| 224 | .bLength = sizeof(struct usb_cdc_hdr_desc), |
| 225 | .bDescriptorType = USB_CS_DT_INTF, |
| 226 | .bDescriptorsubtype = USB_CDC_DST_HEADER, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 227 | .bcdCDC = 0x0110, |
| 228 | }, |
Sylvain Munaut | b9d9363 | 2021-05-31 14:03:44 +0200 | [diff] [blame] | 229 | .cdc_acm = { |
| 230 | .bLength = sizeof(struct usb_cdc_acm_desc), |
| 231 | .bDescriptorType = USB_CS_DT_INTF, |
| 232 | .bDescriptorsubtype = USB_CDC_DST_ACM, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 233 | .bmCapabilities = 0x02, |
| 234 | }, |
Sylvain Munaut | b9d9363 | 2021-05-31 14:03:44 +0200 | [diff] [blame] | 235 | .cdc_union = { |
| 236 | .bLength = sizeof(struct usb_cdc_union_desc) + 1, |
| 237 | .bDescriptorType = USB_CS_DT_INTF, |
| 238 | .bDescriptorsubtype = USB_CDC_DST_UNION, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 239 | .bMasterInterface = 1, |
Sylvain Munaut | b9d9363 | 2021-05-31 14:03:44 +0200 | [diff] [blame] | 240 | .bSlaveInterface = { 2 }, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 241 | }, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 242 | .ep_ctl = { |
| 243 | .bLength = sizeof(struct usb_ep_desc), |
| 244 | .bDescriptorType = USB_DT_EP, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 245 | .bEndpointAddress = USB_EP_GPS_CDC_CTL, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 246 | .bmAttributes = 0x03, |
| 247 | .wMaxPacketSize = 64, |
| 248 | .bInterval = 0x40, |
| 249 | }, |
| 250 | .intf_data = { |
| 251 | .bLength = sizeof(struct usb_intf_desc), |
| 252 | .bDescriptorType = USB_DT_INTF, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 253 | .bInterfaceNumber = USB_INTF_GPS_CDC_DATA, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 254 | .bAlternateSetting = 0, |
| 255 | .bNumEndpoints = 2, |
Sylvain Munaut | b9d9363 | 2021-05-31 14:03:44 +0200 | [diff] [blame] | 256 | .bInterfaceClass = USB_CLS_CDC_DATA, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 257 | .bInterfaceSubClass = 0x00, |
| 258 | .bInterfaceProtocol = 0x00, |
Sylvain Munaut | 41c98b6 | 2022-01-05 21:11:35 +0100 | [diff] [blame] | 259 | .iInterface = 10, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 260 | }, |
| 261 | .ep_data_out = { |
| 262 | .bLength = sizeof(struct usb_ep_desc), |
| 263 | .bDescriptorType = USB_DT_EP, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 264 | .bEndpointAddress = USB_EP_GPS_CDC_OUT, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 265 | .bmAttributes = 0x02, |
| 266 | .wMaxPacketSize = 64, |
| 267 | .bInterval = 0x00, |
| 268 | }, |
| 269 | .ep_data_in = { |
| 270 | .bLength = sizeof(struct usb_ep_desc), |
| 271 | .bDescriptorType = USB_DT_EP, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 272 | .bEndpointAddress = USB_EP_GPS_CDC_IN, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 273 | .bmAttributes = 0x02, |
| 274 | .wMaxPacketSize = 64, |
| 275 | .bInterval = 0x00, |
| 276 | }, |
| 277 | }, |
| 278 | #endif |
| 279 | .dfu = { |
| 280 | .intf = { |
| 281 | .bLength = sizeof(struct usb_intf_desc), |
| 282 | .bDescriptorType = USB_DT_INTF, |
Sylvain Munaut | 8a5a9d4 | 2022-01-03 18:44:33 +0100 | [diff] [blame] | 283 | .bInterfaceNumber = USB_INTF_DFU, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 284 | .bAlternateSetting = 0, |
| 285 | .bNumEndpoints = 0, |
| 286 | .bInterfaceClass = 0xfe, |
| 287 | .bInterfaceSubClass = 0x01, |
| 288 | .bInterfaceProtocol = 0x01, |
Sylvain Munaut | 41c98b6 | 2022-01-05 21:11:35 +0100 | [diff] [blame] | 289 | .iInterface = 11, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 290 | }, |
| 291 | .func = { |
Sylvain Munaut | 4ea7d27 | 2020-10-29 13:17:11 +0100 | [diff] [blame] | 292 | .bLength = sizeof(struct usb_dfu_func_desc), |
| 293 | .bDescriptorType = USB_DFU_DT_FUNC, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 294 | .bmAttributes = 0x0d, |
Sylvain Munaut | 3c3ae79 | 2022-01-05 20:55:37 +0100 | [diff] [blame] | 295 | .wDetachTimeOut = 0, |
Sylvain Munaut | bc9f5c4 | 2020-09-14 10:22:29 +0200 | [diff] [blame] | 296 | .wTransferSize = 4096, |
| 297 | .bcdDFUVersion = 0x0101, |
| 298 | }, |
| 299 | }, |
| 300 | }; |
| 301 | |
| 302 | static const struct usb_conf_desc * const _conf_desc_array[] = { |
| 303 | &_app_conf_desc.conf, |
| 304 | }; |
| 305 | |
| 306 | static const struct usb_dev_desc _dev_desc = { |
| 307 | .bLength = sizeof(struct usb_dev_desc), |
| 308 | .bDescriptorType = USB_DT_DEV, |
| 309 | .bcdUSB = 0x0200, |
| 310 | .bDeviceClass = 0, |
| 311 | .bDeviceSubClass = 0, |
| 312 | .bDeviceProtocol = 0, |
| 313 | .bMaxPacketSize0 = 64, |
| 314 | .idVendor = 0x1d50, |
| 315 | .idProduct = 0x6145, |
| 316 | .bcdDevice = 0x0003, /* v0.3 */ |
| 317 | .iManufacturer = 2, |
| 318 | .iProduct = 3, |
| 319 | .iSerialNumber = 1, |
| 320 | .bNumConfigurations = num_elem(_conf_desc_array), |
| 321 | }; |
| 322 | |
| 323 | #include "usb_str_app.gen.h" |
| 324 | |
| 325 | const struct usb_stack_descriptors app_stack_desc = { |
| 326 | .dev = &_dev_desc, |
| 327 | .conf = _conf_desc_array, |
| 328 | .n_conf = num_elem(_conf_desc_array), |
| 329 | .str = _str_desc_array, |
| 330 | .n_str = num_elem(_str_desc_array), |
| 331 | }; |