Change Joystick USB Name

Status
Not open for further replies.

carcaes1

Well-known member
Hi again

I have 2 questions.

1) I would like to change the USB Device name of teensy LC when i compile this example sketch.


Code:
/* Basic USB Joystick Example
   Teensy becomes a USB joystick

   You must select Joystick from the "Tools > USB Type" menu

   Pushbuttons should be connected to digital pins 0 and 1.
   Wire each button between the digital pin and ground.
   Potentiometers should be connected to analog inputs 0 to 1.

   This example code is in the public domain.
*/

void setup() {
  pinMode(0, INPUT_PULLUP);
  pinMode(1, INPUT_PULLUP);
}

void loop() {
  // read analog inputs and set X-Y position
  Joystick.X(analogRead(0));
  Joystick.Y(analogRead(1));

  // read the digital inputs and set the buttons
  Joystick.button(1, digitalRead(0));
  Joystick.button(2, digitalRead(1));

  // a brief delay, so this runs 20 times per second
  delay(50);
}


I have tried changing the name and lenght in usb-desc.h (folder arduino/hardware/teensy/cores/teensy3)

#define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
#define PRODUCT_NAME_LEN 23

And it works, but when i click in properties of the device, the original name appears again (Only i see my modified name in Devices&printers in Windows).

sli6j5.jpg

Do i need to make other more changes?


2) Is possible to change the device icon by default? The joystick device appears as a keyboard, but i don't know how change it.

Thanks in advance
 
Last edited:
1) I would like to change the USB Device name of teensy LC when i compile this example sketch.

The latest beta has an example. It's for MIDI, but the same approach should work for HID like joystick.

Look in File > Examples > Teensy > USB_MIDI > MIDI_name.

Of course, you must install 1.31-beta2 (or later...) to have this example.


2) Is possible to change the device icon by default? The joystick device appears as a keyboard, but i don't know how change it.

You have 2 options, but neither is simple and easy to do from only the Arduino sketch.

The easier method would be to edit usb_desc.h to create a custom USB type without the other non-joystick stuff. This gives you relatively little control over the appearance, but maybe it's enough.

The harder way involves creating a custom INF to install in Windows. INFs let you customize (or "brand") quite a lot about how your custom USB device appears. All modern versions of Windows (anything after XP) give the absolutely lowest priority to unsigned INFs, so this won't work unless you also use the WDK to sign your INF. Signing requires a code signing cert, which isn't free. Usually the best prices are Comodo through resellers.
 
Thanks a lot Paul.

But i have same problem making the names.c

I see in devices the name that i have selected, but when i click in configure game device, i see the teensy/josytick...

sli6j5.jpg
 

Attachments

  • td_joystick_sc2.png
    td_joystick_sc2.png
    25.7 KB · Views: 165
Last edited:
Perhaps the name really has changed, but Windows is caching the old name from the Windows Registry? Maybe try on other PC?
 
Status
Not open for further replies.
Back
Top