Arduino joystick library wont work when CDC disabled. why?

Im trying to make my own throttle for DCS using leonardo joystick library but I'm also using DCS-BIOS. I want to disable or make my throttle disappear from COM PORT. and I found it.
just edit some code in USBCore.cpp
from this

//	DEVICE DESCRIPTOR
#define CDC_ENABLED

to this

//	DEVICE DESCRIPTOR
//#define CDC_ENABLED

but my joystick properties in usb game controller not moving at all. when i tried to un comment the CDC_ENABLED and upload it. my joystick works.

is there a way so my joystick works while my throttle do not appear in COM PORT?

That depends on your code and on the way your OS/application detects the joystick. The class, subclass and protocol values changes if CDC is disabled.

I made the following change to remove the CDC ACM port.

USBDesc.h

// Uncomment the following line or pass -DCDC_DISABLED to the compiler
// to disable CDC (serial console via USB).
// That's useful if you want to create an USB device (like an USB Boot Keyboard)
// that works even with problematic devices (like KVM switches).
// Keep in mind that with this change you'll have to use the Arduino's
// reset button to be able to flash it.
#define CDC_DISABLED

This seems to work fine. The USB CDC port (Serial) disappears. I used the JoystickMouseControl.ino example for testing.

Board package: Arduino AVR 1.8.6. Board type: Leonardo

yes indeed its working as I expected. mine was 1.8.13 but my USBDesc.h and USBCore.cpp is different from the arduino github. so I copied both code to both if my files.

for the next person who look for the code:
USBDesc.h
USBCore.cpp

all I did was just change both files
USBCore.cpp(comment the CDC_ENABLED)

//	DEVICE DESCRIPTOR
//#define CDC_ENABLED

USBDesc.h (uncomment the //CDC_DISABLED)

// Uncomment the following line or pass -DCDC_DISABLED to the compiler
// to disable CDC (serial console via USB).
// That's useful if you want to create an USB device (like an USB Boot Keyboard)
// that works even with problematic devices (like KVM switches).
// Keep in mind that with this change you'll have to use the Arduino's
// reset button to be able to flash it.
#define CDC_DISABLED

Thanks Ice!

and yes before I only disabled one of them(USBDesc.h and USBCore.cpp) because i dont think that my files would be the same than yours. so now it works.

Thanks Pylon!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.