summaryrefslogtreecommitdiff
path: root/hid/patches
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-11-15 16:35:13 +0300
committerDevaev Maxim <[email protected]>2020-11-15 16:35:13 +0300
commit37d9518bc8212b84781b3fd4867e7450338db074 (patch)
tree0abde48cb1c460e848b24a8debea8ba611c503ef /hid/patches
parent0955e03cd3f4567f30aea3b371f449f3a7cd5f33 (diff)
fixed serial port disabling
Diffstat (limited to 'hid/patches')
-rw-r--r--hid/patches/optional-serial.patch53
-rw-r--r--hid/patches/serial.patch24
2 files changed, 53 insertions, 24 deletions
diff --git a/hid/patches/optional-serial.patch b/hid/patches/optional-serial.patch
new file mode 100644
index 00000000..94dd1d72
--- /dev/null
+++ b/hid/patches/optional-serial.patch
@@ -0,0 +1,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_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_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_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_SERIAL
+ CDC_GetInterface(&interfaces);
++#endif
+
+ #ifdef PLUGGABLE_USB_ENABLED
+ PluggableUSB().getInterface(&interfaces);
diff --git a/hid/patches/serial.patch b/hid/patches/serial.patch
deleted file mode 100644
index 16ba3811..00000000
--- a/hid/patches/serial.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-https://github.com/arduino/Arduino/issues/6387
---- a/cores/arduino/USBCore.cpp 2019-09-20 15:48:38.000000000 +0300
-+++ b/cores/arduino/USBCore.cpp 2020-11-11 19:56:49.233690476 +0300
-@@ -375,8 +375,10 @@
- {
- u8 i = setup.wIndex;
-
-+#ifndef NO_SERIAL
- if (CDC_ACM_INTERFACE == i)
- return CDC_Setup(setup);
-+#endif
-
- #ifdef PLUGGABLE_USB_ENABLED
- return PluggableUSB().setup(setup);
-@@ -466,7 +468,9 @@
- {
- u8 interfaces = 0;
-
-+#ifndef NO_SERIAL
- CDC_GetInterface(&interfaces);
-+#endif
-
- #ifdef PLUGGABLE_USB_ENABLED
- PluggableUSB().getInterface(&interfaces);