77
77
#define STR_SERIAL_NUMBER L"00"
78
78
#endif
79
79
80
- #define STR_MANUFACTURER L"Arduino"
81
- #define STR_PRODUCT L"CNC Arduino "GRBL_VERSION"("GRBL_VERSION_BUILD")"
80
+ #define STR_MANUFACTURER L"Arduino LLC"
81
+ //#define STR_PRODUCT L"Arduino Yun "
82
+ #define STR_PRODUCT L"Arduino CNC "GRBL_VERSION"("GRBL_VERSION_BUILD")"
82
83
83
84
#define LSB (n ) (n & 0xFF)
84
85
#define MSB (n ) ((n >> 8) & 0xFF)
@@ -133,7 +134,7 @@ static const uint8_t PROGMEM device_descriptor[] = {
133
134
18 , // bLength
134
135
1 , // bDescriptorType
135
136
0x00 , 0x02 , // bcdUSB
136
- 0 , // bDeviceClass
137
+ 2 , // bDeviceClass
137
138
0 , // bDeviceSubClass
138
139
0 , // bDeviceProtocol
139
140
ENDPOINT0_SIZE , // bMaxPacketSize0
@@ -146,11 +147,12 @@ static const uint8_t PROGMEM device_descriptor[] = {
146
147
1 // bNumConfigurations
147
148
};
148
149
150
+ #if 1
149
151
#define CONFIG1_DESC_SIZE (9+9+5+5+4+5+7+9+7+7)
150
152
static const uint8_t PROGMEM config1_descriptor [CONFIG1_DESC_SIZE ] = {
151
153
// configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10
152
154
9 , // bLength;
153
- 0 , // bDescriptorType;
155
+ 2 , // bDescriptorType;
154
156
LSB (CONFIG1_DESC_SIZE ), // wTotalLength
155
157
MSB (CONFIG1_DESC_SIZE ),
156
158
2 , // bNumInterfaces
@@ -166,7 +168,93 @@ static const uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
166
168
1 , // bNumEndpoints
167
169
0x02 , // bInterfaceClass
168
170
0x02 , // bInterfaceSubClass
169
- 0x01 , // bInterfaceProtocol
171
+ 0x00 , // bInterfaceProtocol
172
+ 0 , // iInterface
173
+ // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
174
+ 5 , // bFunctionLength
175
+ 0x24 , // bDescriptorType
176
+ 0x00 , // bDescriptorSubtype
177
+ 0x10 , 0x01 , // bcdCDC
178
+ // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
179
+ 5 , // bFunctionLength
180
+ 0x24 , // bDescriptorType
181
+ 0x01 , // bDescriptorSubtype
182
+ 0x01 , // bmCapabilities
183
+ 1 , // bDataInterface
184
+ // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
185
+ 4 , // bFunctionLength
186
+ 0x24 , // bDescriptorType
187
+ 0x02 , // bDescriptorSubtype
188
+ 0x06 , // bmCapabilities
189
+ // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
190
+ 5 , // bFunctionLength
191
+ 0x24 , // bDescriptorType
192
+ 0x06 , // bDescriptorSubtype
193
+ 0 , // bMasterInterface
194
+ 1 , // bSlaveInterface0
195
+ // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
196
+ 7 , // bLength
197
+ 5 , // bDescriptorType
198
+ CDC_ACM_ENDPOINT | 0x80 , // bEndpointAddress
199
+ 0x03 , // bmAttributes (0x03=intr)
200
+ CDC_ACM_SIZE , 0 , // wMaxPacketSize
201
+ 64 , // bInterval
202
+ // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
203
+ 9 , // bLength
204
+ 4 , // bDescriptorType
205
+ 1 , // bInterfaceNumber
206
+ 0 , // bAlternateSetting
207
+ 2 , // bNumEndpoints
208
+ 0x0A , // bInterfaceClass
209
+ 0x00 , // bInterfaceSubClass
210
+ 0x00 , // bInterfaceProtocol
211
+ 0 , // iInterface
212
+ // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
213
+ 7 , // bLength
214
+ 5 , // bDescriptorType
215
+ CDC_RX_ENDPOINT , // bEndpointAddress
216
+ 0x02 , // bmAttributes (0x02=bulk)
217
+ CDC_RX_SIZE , 0 , // wMaxPacketSize
218
+ 0 , // bInterval
219
+ // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
220
+ 7 , // bLength
221
+ 5 , // bDescriptorType
222
+ CDC_TX_ENDPOINT | 0x80 , // bEndpointAddress
223
+ 0x02 , // bmAttributes (0x02=bulk)
224
+ CDC_TX_SIZE , 0 , // wMaxPacketSize
225
+ 0 , // bInterval
226
+ };
227
+ #else
228
+ #define CONFIG1_DESC_SIZE (9 +8+ 9+5+5+4+5+7+9+7+7 +9+9+7)
229
+ static const uint8_t PROGMEM config1_descriptor [CONFIG1_DESC_SIZE ] = {
230
+ // configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10
231
+ 9 , // bLength;
232
+ 2 , // bDescriptorType;
233
+ LSB (CONFIG1_DESC_SIZE ), // wTotalLength
234
+ MSB (CONFIG1_DESC_SIZE ),
235
+ 3 , // bNumInterfaces
236
+ 1 , // bConfigurationValue
237
+ 0 , // iConfiguration
238
+ 0x80 , // bmAttributes (Bus powered)
239
+ 0xFA , // bMaxPower (500ma/2) = 0xFA
240
+ // aaaaaaaaaaaaaa
241
+ 8 , // bLength
242
+ 0x0B , // bDescriptorType
243
+ 0 , // bFirstInterface
244
+ 2 , // bInterfaceCount
245
+ 2 , // bFunctionClass
246
+ 2 , // bFunctionSubClass
247
+ 1 , // bFunctionProtocol
248
+ 0 , // iFunction
249
+ // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
250
+ 9 , // bLength
251
+ 4 , // bDescriptorType
252
+ 0 , // bInterfaceNumber
253
+ 0 , // bAlternateSetting
254
+ 1 , // bNumEndpoints
255
+ 0x02 , // bInterfaceClass
256
+ 0x02 , // bInterfaceSubClass
257
+ 0x00 , // bInterfaceProtocol
170
258
0 , // iInterface
171
259
// CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
172
260
5 , // bFunctionLength
@@ -220,8 +308,37 @@ static const uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
220
308
CDC_TX_ENDPOINT | 0x80 , // bEndpointAddress
221
309
0x02 , // bmAttributes (0x02=bulk)
222
310
CDC_TX_SIZE , 0 , // wMaxPacketSize
223
- 0 // bInterval
311
+ 0 , // bInterval
312
+ // Interface Descriptor 2/0 HID, 1 Endpoint
313
+ 9 ,
314
+ 4 ,
315
+ 2 ,
316
+ 0 ,
317
+ 1 ,
318
+ 3 ,
319
+ 0 ,
320
+ 0 ,
321
+ 0 ,
322
+
323
+ // HID Descriptor
324
+ 9 ,
325
+ 21 ,
326
+ 01 , 01 ,
327
+ 0 ,
328
+ 1 ,
329
+ 22 ,
330
+ 00 , 65 ,
331
+
332
+ // Endpoint Descriptor 84 4 In, Interrupt, 1 ms
333
+ 7 ,
334
+ 5 ,
335
+ 84 ,
336
+ 3 ,
337
+ 0x00 , 0x40 ,
338
+ 1 ,
339
+
224
340
};
341
+ #endif
225
342
226
343
static const uint8_t PROGMEM endpoint_config_table [] = {
227
344
0 ,
@@ -278,7 +395,7 @@ static const descriptor_list_struct_t PROGMEM descriptor_list[] = {
278
395
{0x0300 , 0x0000 , (const uint8_t * )& string0 , 4 },
279
396
{0x0301 , 0x0409 , (const uint8_t * )& string1 , sizeof (STR_MANUFACTURER )},
280
397
{0x0302 , 0x0409 , (const uint8_t * )& string2 , sizeof (STR_PRODUCT )},
281
- {0 , 0 , NULL , 0 },
398
+ {0xFFFF , 0 , NULL , 0 },
282
399
};
283
400
284
401
// Returns the number of bytes used in the RX serial buffer.
@@ -479,7 +596,7 @@ get_descriptor(uint16_t value, uint16_t index, uint16_t len)
479
596
uint8_t i , n ;
480
597
481
598
for (buf = (uint8_t * )descriptor_list ;
482
- (val = pgm_read_word (& buf [0 ]));
599
+ (val = pgm_read_word (& buf [0 ])) != 0xFFFF ;
483
600
buf += sizeof (* descriptor_list )) {
484
601
485
602
idx = pgm_read_word (& buf [2 ]);
0 commit comments