Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Change Joystick USB Name

  1. #1
    Member
    Join Date
    Mar 2014
    Location
    Valencia
    Posts
    58

    Change Joystick USB Name

    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).

    Click image for larger version. 

Name:	sli6j5.jpg 
Views:	163 
Size:	36.0 KB 
ID:	8686

    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 by carcaes1; 11-01-2016 at 09:03 AM.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,278
    Quote Originally Posted by carcaes1 View Post
    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.

  3. #3
    Member
    Join Date
    Mar 2014
    Location
    Valencia
    Posts
    58
    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...

    Click image for larger version. 

Name:	sli6j5.jpg 
Views:	81 
Size:	36.0 KB 
ID:	8690
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	td_joystick_sc2.png 
Views:	70 
Size:	25.7 KB 
ID:	8689  
    Last edited by carcaes1; 11-01-2016 at 12:07 PM.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,278
    Perhaps the name really has changed, but Windows is caching the old name from the Windows Registry? Maybe try on other PC?

  5. #5
    Member
    Join Date
    Mar 2014
    Location
    Valencia
    Posts
    58
    Quote Originally Posted by PaulStoffregen View Post
    Perhaps the name really has changed, but Windows is caching the old name from the Windows Registry? Maybe try on other PC?
    Ok, I will try it in other PC. Thanks

  6. #6
    Junior Member
    Join Date
    Sep 2017
    Location
    Anaheim, CA
    Posts
    1
    I used this to help me easily display the USB information.
    http://www.uwe-sieber.de/usbtreeview_e.html#download

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •