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

Thread: Teensy LC. Trying to change the VID/PID and name.

  1. #1

    Teensy LC. Trying to change the VID/PID and name.

    I've read that the only thing one has to do is change those values in the usb_private.h file and viola it's done. This does not seem to be the case or I am missing something.
    The only things I changed are the three mentioned field. Do I have to include it in my sketch or something? Have I changed the proper fields in the proper file? "C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\usb_hid".
    I'm totally stumped.
    BTW, I'm on Windows10 using the latest Arduino and Teensyduino builds.

    Code:
    #ifndef usb_serial_h__
    #define usb_serial_h__
    
    #include <stdint.h>
    
    #ifdef __cplusplus
    extern "C"{
    #endif
    
    /**************************************************************************
     *
     *  Configurable Options
     *
     **************************************************************************/
    
    #define VENDOR_ID               0x1209
    #define PRODUCT_ID              0x5261
    #define TRANSMIT_FLUSH_TIMEOUT  4   /* in milliseconds */
    #define TRANSMIT_TIMEOUT        25   /* in milliseconds */
    
    
    /**************************************************************************
     *
     *  Endpoint Buffer Configuration
     *
     **************************************************************************/
    
    // 0: control				64
    // 1: debug IN				64x2
    // 2: debug OUT				32x2
    // 3: keyboard IN			8x2
    // 4: mouse IN			 	16x2
    // 5: joystick IN			16x2
    // 6: keyboard media IN			8x2
    
    // Some operating systems, especially Windows, may cache USB device
    // info.  Changes to the device name may not update on the same
    // computer unless the vendor or product ID numbers change, or the
    // "bcdDevice" revision code is increased.
    
    //#ifndef STR_PRODUCT
    #define STR_PRODUCT             L"Simple Controls UH-1H Collective"
    //#endif
    
    #define ENDPOINT0_SIZE          64
    
    #define DEBUG_INTERFACE		2
    #define DEBUG_TX_ENDPOINT	1
    #define DEBUG_TX_SIZE		64
    #define DEBUG_TX_BUFFER		EP_DOUBLE_BUFFER
    #define DEBUG_TX_INTERVAL	1
    #define DEBUG_RX_ENDPOINT	2
    #define DEBUG_RX_SIZE		32
    #define DEBUG_RX_BUFFER		EP_DOUBLE_BUFFER
    #define DEBUG_RX_INTERVAL	2
    
    #define KEYBOARD_INTERFACE	0
    #define KEYBOARD_ENDPOINT	3
    #define KEYBOARD_SIZE		8
    #define KEYBOARD_BUFFER		EP_DOUBLE_BUFFER
    #define KEYBOARD_INTERVAL	1
    
    #define MOUSE_INTERFACE		1
    #define MOUSE_ENDPOINT		4
    #define MOUSE_SIZE		8
    #define MOUSE_BUFFER		EP_DOUBLE_BUFFER
    #define MOUSE_INTERVAL		1
    
    #define JOYSTICK_INTERFACE	3
    #define JOYSTICK_ENDPOINT	5
    #define JOYSTICK_SIZE		16
    #define JOYSTICK_BUFFER		EP_DOUBLE_BUFFER
    #define JOYSTICK_INTERVAL	2
    
    #define KEYMEDIA_INTERFACE      4
    #define KEYMEDIA_ENDPOINT       6
    #define KEYMEDIA_SIZE           8
    #define KEYMEDIA_BUFFER         EP_DOUBLE_BUFFER
    #define KEYMEDIA_INTERVAL       4
    
    #define NUM_ENDPOINTS		7
    #define NUM_INTERFACE		5
    
    
    // setup
    void usb_init(void);			// initialize everything
    void usb_shutdown(void);		// shut off USB
    
    // variables
    extern volatile uint8_t usb_configuration;
    extern volatile uint8_t usb_suspended;
    extern volatile uint8_t debug_flush_timer;
    extern uint8_t keyboard_report_data[];
    extern uint8_t keyboard_idle_count;
    extern volatile uint8_t keyboard_leds;
    extern uint8_t mouse_buttons;
    extern uint8_t joystick_report_data[12];
    extern uint8_t keymedia_report_data[8];
    extern uint16_t keymedia_consumer_keys[4];
    extern uint8_t keymedia_system_keys[3];
    
    
    
    #ifdef __cplusplus
    } // extern "C"
    #endif
    
    #endif
    Also my sketch is super simple. But it works.

    Code:
    void setup() {
      // Joystick buttons 1-12
      pinMode(0, INPUT_PULLUP);
      pinMode(1, INPUT_PULLUP);
      pinMode(2, INPUT_PULLUP);
      pinMode(3, INPUT_PULLUP);
      pinMode(4, INPUT_PULLUP);
      pinMode(5, INPUT_PULLUP);
      pinMode(6, INPUT_PULLUP);
      pinMode(7, INPUT_PULLUP);
      pinMode(8, INPUT_PULLUP);
      pinMode(9, INPUT_PULLUP);
      pinMode(10, INPUT_PULLUP);
      pinMode(11, INPUT_PULLUP);
    
      // Hat switch buttons
      pinMode(14, INPUT_PULLUP);
      pinMode(15, INPUT_PULLUP);
      pinMode(16, INPUT_PULLUP);
      pinMode(17, INPUT_PULLUP);
    
      }
    
    void loop() {
      //Joystick buttons
        if (digitalRead(0) == LOW)
      {
                Joystick.button(1, 1);
        } 
        else {
                Joystick.button(1,0);
        }
        if (digitalRead(1) == LOW)
      {
                Joystick.button(2, 1);
        } 
        else {
                Joystick.button(2,0);
        }
        if (digitalRead(2) == LOW)
      {
                Joystick.button(3, 1);
        } 
        else {
                Joystick.button(3,0);
        }
        if (digitalRead(3) == LOW)
      {
                Joystick.button(4, 1);
        } 
        else {
                Joystick.button(4,0);
        }
        if (digitalRead(4) == LOW)
      {
                Joystick.button(5, 1);
        } 
        else {
                Joystick.button(5,0);
        }
        if (digitalRead(5) == LOW)
      {
                Joystick.button(6, 1);
        } 
        else {
                Joystick.button(6,0);
        }
        if (digitalRead(6) == LOW)
      {
                Joystick.button(7, 1);
        } 
        else {
                Joystick.button(7,0);
        }
        if (digitalRead(7) == LOW)
      {
                Joystick.button(8, 1);
        } 
        else {
                Joystick.button(8,0);
        }
        if (digitalRead(8) == LOW)
      {
                Joystick.button(9, 1);
        } 
        else {
                Joystick.button(9,0);
        }
        if (digitalRead(9) == LOW)
      {
                Joystick.button(10, 1);
        } 
        else {
                Joystick.button(10,0);
        }
        if (digitalRead(10) == LOW)
      {
                Joystick.button(11, 1);
        } 
        else {
                Joystick.button(11,0);
        }
        if (digitalRead(11) == LOW)
      {
                Joystick.button(12, 1);
        } 
        else {
                Joystick.button(12,0);
        }
       
     // Hat switch
      int angle =-1;//no angle input
    if (digitalRead(14)==LOW) angle =0;
    if (digitalRead(15)==LOW) angle =90;
    if (digitalRead(16)==LOW) angle =180;
    if (digitalRead(17)==LOW) angle =270;
    if ((digitalRead(14)==LOW) && (digitalRead(15)==LOW)) angle =45;
    if ((digitalRead(15)==LOW) && (digitalRead(16)==LOW)) angle =135;
    if ((digitalRead(16)==LOW) && (digitalRead(17)==LOW)) angle =225;
    if ((digitalRead(17)==LOW) && (digitalRead(14)==LOW)) angle =315;
    Joystick.hat(angle);
    
     // Pitch and throttle axis  
      Joystick.sliderLeft(analogRead(4));
      Joystick.sliderRight(analogRead(5));
                
        }

  2. #2
    Senior Member
    Join Date
    Apr 2020
    Location
    DFW area in Texas
    Posts
    115
    Quote Originally Posted by Doon1 View Post
    I'm totally stumped.
    BTW, I'm on Windows10 using the latest Arduino and Teensyduino builds.
    Doon1:

    Don't know if the same thing applies in your situation, but when I made a change to an existing Audio Library object, I had to restart the Teensyduino utility before the change was actually built into my sketch.

    Good luck & have fun !!

    Mark J Culross
    KD5RXT

  3. #3
    Quote Originally Posted by kd5rxt-mark View Post
    Doon1:

    Don't know if the same thing applies in your situation, but when I made a change to an existing Audio Library object, I had to restart the Teensyduino utility before the change was actually built into my sketch.

    Good luck & have fun !!

    Mark J Culross
    KD5RXT
    I've tried restarting Teensy and Arduino, rebooting the computer, Removing all traces of the VID/PID references from the device manager and the registry. I've tried running the usb_private.h file as a sketch and including it as a library; plus a couple other things.
    I'm beginning to think that it's just not possible to do this. Maybe PaulStoffregen has this ability locked out for some reason. Not sure, but I'm ready to give up on Teensy and cut my losses.

  4. #4
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Posts
    566
    The Teensy LC is part of the teensy3 folder in the core files, the relevant file to change is /teensy/avr/cores/teensy3/usb_desc.h you just have to scroll down to whichever interface you are trying to change and set it there.

  5. #5
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,692
    There are multiple users that changed pid/vid of Teensies.
    Only drawback is that Teensyloader does not recognize Teensy in Automatic mode, so Button press (or equivalently connecting Program line to GND) is necessary to download new programs.

  6. #6
    Quote Originally Posted by vjmuzik View Post
    The Teensy LC is part of the teensy3 folder in the core files, the relevant file to change is /teensy/avr/cores/teensy3/usb_desc.h you just have to scroll down to whichever interface you are trying to change and set it there.
    I've tried that as well. Changing just the name or the vid/pid in various combinations.

    Quote Originally Posted by WMXZ View Post
    There are multiple users that changed pid/vid of Teensies.
    Only drawback is that Teensyloader does not recognize Teensy in Automatic mode, so Button press (or equivalently connecting Program line to GND) is necessary to download new programs.
    I'm pressing the button. Then I disconnect the board, remove it from the device manager, then plug it back in.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,238
    Quote Originally Posted by Doon1 View Post
    I'm pressing the button. Then I disconnect the board, remove it from the device manager, then plug it back in.
    After you save the modified usb_desc.h, but before you press the button on Teensy, you need to click Verify in Arduino and wait for it to recompile the code. Clicking Verify in Arduino starts the process of turning usb_desc.h (and all the other source code) into the .hex file which Teensy Loader reads and sends to your Teensy. If you skip this step, the code Teensy Loader programs onto your Teensy will be the same .hex file as previously compiled.

  8. #8
    Hi Paul,
    Sorry to be such a noob.
    Seem that vjmuzik hit it on the head. I was changing the fields in the wrong file. Then to top it off; sometime last night I selected "serial" as the port. So when I changed the field suggested by vjmuzik I was still having the issue. It wasn't until I took a closer look that I realized the pid was 0487, not 0482.
    Now to see if I can muddle my way through applying for one of those free vid/pid combos. Wish me luck.
    Thanks for all of your help guys.
    Last edited by Doon1; 06-14-2020 at 01:36 PM.

  9. #9
    Now to see if I can turn it into just a joystick without the keyboard and mouse features. Have any tips?
    I think I may have done it but it seemed too easy.
    I commented out the keyboard, keyboard media keys, and mouse. Changed the NUM_ENDPOINTS to 3, the NUM_INTERFACE to 2, and the JOYSTICK_ENDPOINT to 3.
    Could it really be that easy?
    Last edited by Doon1; 06-14-2020 at 02:07 PM.

Posting Permissions

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