JS7777
April 2, 2018, 10:34pm
1
Hello,
I found a way here to disable the Serial port that appears in the Device manager for a simple HID exemple
opened 05:14PM - 16 Jun 17 UTC
closed 07:43AM - 19 Jun 17 UTC
feature request
Type: Wontfix
Component: USB Device
USB: CDC serial
Library: HID
Hello! I'm using IDE 1.8.0 and Arduino leonardo. I try the standard USB HID keyb… oard sketch. Please tell me how to disable the serial port that appears in Device manager (Windows 7 x64) when the device is connected (after the bootloader finish) - it's called Arduino Leonardo (COM 40) for example. But i need, that there is only a USB HID keyboard and nothing else.
In this thread, dude seem to have decided this question:
[Link](https://forum.arduino.cc/index.php?topic=262897)
but the structure of the USBDesc.h file in my IDE 1.8.0 is different ...
```cpp
#define PLUGGABLE_USB_ENABLED
#if defined(EPRST6)
#define USB_ENDPOINTS 7 // AtMegaxxU4
#else
#define USB_ENDPOINTS 5 // AtMegaxxU2
#endif
#define ISERIAL_MAX_LEN 20
#define CDC_INTERFACE_COUNT 2
#define CDC_ENPOINT_COUNT 3
#define CDC_ACM_INTERFACE 0 // CDC ACM
#define CDC_DATA_INTERFACE 1 // CDC Data
#define CDC_FIRST_ENDPOINT 1
#define CDC_ENDPOINT_ACM (CDC_FIRST_ENDPOINT) // CDC First
#define CDC_ENDPOINT_OUT (CDC_FIRST_ENDPOINT+1)
#define CDC_ENDPOINT_IN (CDC_FIRST_ENDPOINT+2)
#define INTERFACE_COUNT (MSC_INTERFACE + MSC_INTERFACE_COUNT)
#define CDC_RX CDC_ENDPOINT_OUT
#define CDC_TX CDC_ENDPOINT_IN
#define IMANUFACTURER 1
#define IPRODUCT 2
#define ISERIAL 3
```
Any ideas? Thanks!
But I would like to had a switch on the leonardo that disables serial port when off and enables it when on.
If someone know how to edit the code to do it.
Thanks
1 Like
pylon
April 3, 2018, 4:43pm
2
But I would like to had a switch on the leonardo that disables serial port when off and enables it when on.
This is the case with my Leonardo. It doesn't show a device when the Leonardo is off and it shows one if the Leonardo is on.
I guess you meant something different but you must describe it in more detail so I also get a clue of what you're trying to achieve.
JS7777
April 3, 2018, 9:57pm
3
Thanks for your reply, I mean adding a switch to one of the pins of the leonardo, like for exemple pin 6, if pin 6 is grounded then disable serial port.
This switch would be use if we need to reprogram the leonardo.
Thanks
Press the reset button to put the Leonardo in upload mode for 8 seconds.