-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow disabling CDC with -DCDC_DISABLED #383
Conversation
Sometimes Arduino-based USB devices don't work because some hardware (like KVM switches) gets confused by the CDC sub-devices. This change makes it relatively easy to disable CDC at compiletime. Disabling it of course means that the serial console won't work anymore, so you need to use the reset button when flashing. CDC_DISABLED is also used in ArduinoCore-samd for the same purpose. based on https://github.com/gdsports/usb-metamorph/tree/master/USBSerPassThruLine See also NicoHood/HID#225 and arduino/Arduino#6387 and https://forum.arduino.cc/index.php?topic=545288.msg3717028#msg3717028
This rolls back facchinm/ArduinoCore-avr@a1ba49e |
Why was this compiletime-option removed in the first place? It's very useful, after all. |
It looks what was removed was a define to enable/disable the CDC endpoint. My assumption is the current USB capabilities were made to work awaiting further improvement... I can see that around the same period a few changes were made such as PluggableUSB and HID which forces a CDC endpoint. This is restricting and would be nice to be able to expand USB capabilities without blowing up the size of the compiled binaries. However its been like this for 5 years now. |
I'm not sure I understand - with my patch I'm using HID without CDC being enabled? |
@facchinm Could you take a look at this? The problem really exists and affects several projects that are working on boot hid devices. |
I 2nd this PR. It would help a lot of people reporting issue with the HID Keyboard at bios time! |
+1 |
Any chance this can get merged? pinging @facchinm @silvanocerza |
EDIT: The below issue does not effect this patch and is to be ignored. Found an issue with the change. |
Interesting - I didn't have that problem with my cheap Pro Micro clone - do you get it from just disabling CDC or only if you completeley disable USB? |
Also, what changes exactly must be done? |
I was having issues when i removed the USB code and was using hardware serial. The USB interrupts were still firing away and locked up at the first sei(); until i changed those registers. I will do a proper test now using your CDC_DISABLED patch but i suspect the same result as caterina bootloader is leaving usb in a semi initialized state. |
I tested the patch and found no issues as it does still leave USB connected to the host which is different then what I have been doing. |
I've also been using this patch for a while and it really works like a charm, please merge. |
Merged, sorry for the incredibly long delay |
Thanks a lot! :) |
This change makes it relatively easy to disable the CDC at compiletime.
Disabling it of course means that the serial console won't work anymore, and that you can only flash directly after resetting the board, but I think that's not much of a problem.
CDC_DISABLED
is also used in ArduinoCore-samd for the same purpose,see https://github.com/arduino/ArduinoCore-samd/blob/master/cores/arduino/USB/USBDesc.h#L24-L27
Disabling CDC helps making Arduino-based USB devices work with old or otherwise problematic hardware or software.
For example, USB Boot Keyboards don't work with many KVM switches if the CDC sub-devices are there; I'm sure there's other systems with the same problem (BIOS/UEFI implementations? Old operating systems - someone mentioned assistive devices still running Windows XP). Apart from Keyboards, I read that disabling CDC for Arduino-based MIDI devices.
based on https://github.com/gdsports/usb-metamorph/tree/master/USBSerPassThruLine
See also NicoHood/HID#225 and arduino/Arduino#6387 and https://forum.arduino.cc/index.php?topic=545288.msg3717028#msg3717028