Skip to content

Commit c20e271

Browse files
committed
configurable USB_VERSION string via define
to allow WebUSB development, provide a way to change the USB_VERSION reported using an additional core. The additional (webUSB) core will survive IDE and AVR core updates
1 parent 2717fbe commit c20e271

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cores/arduino/USBCore.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,15 @@
126126
#define MSC_SUBCLASS_SCSI 0x06
127127
#define MSC_PROTOCOL_BULK_ONLY 0x50
128128

129+
#ifndef USB_VERSION
130+
#define USB_VERSION 0x200
131+
#endif
132+
129133
// Device
130134
typedef struct {
131135
u8 len; // 18
132136
u8 dtype; // 1 USB_DEVICE_DESCRIPTOR_TYPE
133-
u16 usbVersion; // 0x200
137+
u16 usbVersion; // 0x200 or 0x210
134138
u8 deviceClass;
135139
u8 deviceSubClass;
136140
u8 deviceProtocol;
@@ -260,7 +264,7 @@ typedef struct
260264

261265

262266
#define D_DEVICE(_class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs) \
263-
{ 18, 1, 0x200, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs }
267+
{ 18, 1, USB_VERSION, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs }
264268

265269
#define D_CONFIG(_totalLength,_interfaces) \
266270
{ 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED | USB_CONFIG_REMOTE_WAKEUP, USB_CONFIG_POWER_MA(500) }

0 commit comments

Comments
 (0)