summaryrefslogtreecommitdiff
path: root/hid/patches/arduino-optional-usb-serial.patch
blob: 0d4a0b37346e8ea9ac1985fbd7c45a963723a6f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
https://github.com/arduino-libraries/MIDIUSB/issues/50#issuecomment-451427496
--- a/cores/arduino/PluggableUSB.cpp	2019-05-16 15:52:01.000000000 +0300
+++ b/cores/arduino/PluggableUSB.cpp	2020-11-14 21:14:03.084063731 +0300
@@ -103,8 +103,13 @@
 	return obj;
 }
 
+#ifndef NO_USB_SERIAL
 PluggableUSB_::PluggableUSB_() : lastIf(CDC_ACM_INTERFACE + CDC_INTERFACE_COUNT),
                                  lastEp(CDC_FIRST_ENDPOINT + CDC_ENPOINT_COUNT),
+#else
+PluggableUSB_::PluggableUSB_() : lastIf(0),
+                                 lastEp(1),
+#endif
                                  rootNode(NULL)
 {
 	// Empty
diff -u -r a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp
--- a/cores/arduino/USBCore.cpp	2019-09-20 15:48:38.000000000 +0300
+++ b/cores/arduino/USBCore.cpp	2020-11-14 21:08:27.473519254 +0300
@@ -329,9 +329,11 @@
 {
 	0,                      // Control Endpoint
 	
+#ifndef NO_USB_SERIAL
 	EP_TYPE_INTERRUPT_IN,   // CDC_ENDPOINT_ACM
 	EP_TYPE_BULK_OUT,       // CDC_ENDPOINT_OUT
 	EP_TYPE_BULK_IN,        // CDC_ENDPOINT_IN
+#endif
 
 	// Following endpoints are automatically initialized to 0
 };
@@ -375,8 +377,10 @@
 {
 	u8 i = setup.wIndex;
 
+#ifndef NO_USB_SERIAL
 	if (CDC_ACM_INTERFACE == i)
 		return CDC_Setup(setup);
+#endif
 
 #ifdef PLUGGABLE_USB_ENABLED
 	return PluggableUSB().setup(setup);
@@ -466,7 +470,9 @@
 {
 	u8 interfaces = 0;
 
+#ifndef NO_USB_SERIAL
 	CDC_GetInterface(&interfaces);
+#endif
 
 #ifdef PLUGGABLE_USB_ENABLED
 	PluggableUSB().getInterface(&interfaces);