1

The AdaFruit 'Trinket' library identifies itself as "Trinket HID Combo" when using as USB Keyboard. Is it possible to change this name to more useful name (with some code, constant etc)?

I'm using Arduino 1.0.4 IDE. Take a look in the source of this library but cannot find this name hard coded.

Any ideas to override this?

egilhh
  • 6,464
  • 1
  • 18
  • 19
Codebeat
  • 6,501
  • 6
  • 57
  • 99

1 Answers1

0

You have to change the Trinket library.
Search for USB_CFG_DEVICE_NAME in usbconfig.h

#define USB_CFG_DEVICE_NAME 'T', 'r', 'i', 'n', 'k', 'e', 't', ' ', 'H', 'I', 'D', ' ', 'C', 'o', 'm', 'b', 'o',

Here is the reference to the adafruit library: Adafruit-Trinket-USB

codeflag
  • 191
  • 8
  • Thanks to point me into the right direction. Ah man, this is really stupid to change a library to change it's name! It's a library! I have tried to remove the defines (as is possible, comment describes it) and define it in a separated file, for example "myApp.h" and include it BEFORE "TrinketHidCombo.h" but still results in a "unknown device" name. I really NEED to change the library. That's really a stupid thing. Is there way to make it optional by project without the need to change the library over and over again? – Codebeat Jun 11 '16 at 02:03
  • "The GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users." Feel free to change the library, that is not a stupid thing, it is intentional. So of course you could make it optional by a project. Customize the library and you'll see the solution. – codeflag Jun 11 '16 at 10:41
  • It's a problem of the C-compiler, read that the compiler compiles parts of the code individually before all code 'merged' together. The problem with this is that you cannot make something optional easily because the options must be included into the library, so you HAVE to include an optional header file. I have created a user_usbconfig.h file and include this in the usbconfig.h that can be symlinked to a project header file to be able override settings in the library with some ease. This is really a stupid way to change options because when you update the library it can be overwritten. – Codebeat Jun 11 '16 at 16:29
  • See also new question: http://stackoverflow.com/questions/37769451/arduino-make-a-library-more-optional-by-project – Codebeat Jun 11 '16 at 23:56