Option to Not include all the USB libraries (Leonardo & compatibles)

Hi all,

I wanted to mention that there is a case where omitting HID support is functionally required - or at least, much more convenient than the alternatives. I am controlling an Arduino Micro-based device from an Android tablet, and if I don't un-define HID_ENABLED, the Micro is claimed as an HID input device by Android. When this happens, the Android on-screen keyboard is disabled because Android's Linux kernel thinks there is a physical keyboard connected, and typing becomes impossible. There does not seem to be a way to make Android ignore the Micro without rooting the tablet, which I would prefer not to require users to do. So in this case, it is necessary to disable HID support in order to avoid rendering the tablet unusable while the Arduino is connected.

This thread was the most relevant hit for my searches while I was trying to resolve this problem, so I want to include a description of the solution here (on Linux):

Edit /usr/share/arduino/hardware/arduino/cores/arduino/USBDesc.h, and comment out the line

#define HID_ENABLED

so that it reads instead:

/* #define HID_ENABLED */

This is part of the code that gets compiled into each sketch to enable USB support, and this change will prevent HID support from being compiled into future sketches. You will need to be root or use sudo in order to write your changes to the file. (Is it necessary to restart the Arduino IDE after making this change? Not sure.) On Windows or OS X, you will need to figure out where Arduino's support files are installed and edit the analogous file.

Keywords: Android soft keyboard disabled while Arduino is connected

  • JK