How to change Teensy 3.0 PRODUCT_NAME ?

How would I change the serial name/description to "a40h-456" ?

Ok nevermind, this was so simple I can't believe I didn't see how to do it. :) Changing the serial may be enough to build a teensynome (teensy driven monome-like adafruit untz), that looks just like a monome so one can use all the monome software.
 
I tried this code, and it is not working for Teensy 3.2.
It appears that to get this to work, the struct in usb_names.h needs to have an explicit size defined.

For example, if I change usb_names.h to
Code:
struct usb_string_descriptor_struct {
        uint8_t bLength;
        uint8_t bDescriptorType;
        uint16_t wString[10];
};
then the code in the parent works. This is Teensy 3.2, and something may have changed since 3.0. Is there a different way to do this now?
If I compile with the original code, I get this error:
Code:
Arduino: 1.6.7 (Linux), TD: 1.27, Board: "Teensy 3.2 / 3.1, Serial, 72 MHz optimized, US English"

product:12: error: too many initializers for 'uint16_t [0] {aka short unsigned int [0]}'
};
^
product:17: error: too many initializers for 'uint16_t [0] {aka short unsigned int [0]}'
};
^
exit status 1
too many initializers for 'uint16_t [0] {aka short unsigned int [0]}'

To use these, you must create a new tab in Arduino. Use the button on the right hand side of the tabs toolbar, then select "New Tab". It will ask for you for "Name for new file". It must end in ".c". For example, "myname.c". If you use .ino, .pde or .cpp, this will not work.

In the new tab, try this:

Code:
#include "usb_names.h"

#define PRODUCT_NAME		{'M','e','t','a','M','I','D','I'}
#define PRODUCT_NAME_LEN	8

struct usb_string_descriptor_struct usb_string_product_name = {
  2 + PRODUCT_NAME_LEN * 2,
  3,
  PRODUCT_NAME
};
 
The USB serial number is handled differently that the product name. The memory is written at startup by the usb_init_serialnumber() function in usb_desc.c. This is done because the serial number is stored in a special "write once" memory within Teensy (which PJRC programs with a unique 32 bit number). This code reads the serial number from that memory and converts it to string for the USB descriptor array.

If you want a custom USB serial number, you'll need to edit that code. At first glance it looks complex, but the first part just reads the special memory, so you can delete that. The 2nd part converts a 32 bit number to a string. Simple stuff.
 
It appears that Windows caches the Product names for a specific Vendor ID and Product ID for Joysticks. (i.e. Computer\HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\OEM\VID_16C0&PID_0482)
I am using multiple teensy 3.2 in joystick mode where this gets an annoying issue.
For joysticks it would be helpful if there is a way to define a custom VID&PID without the need to edit the core library directly.


I tried this code, and it is not working for Teensy 3.2.
If I compile with the original code, I get this error:
Code:
Arduino: 1.6.7 (Linux), TD: 1.27, Board: "Teensy 3.2 / 3.1, Serial, 72 MHz optimized, US English"

product:12: error: too many initializers for 'uint16_t [0] {aka short unsigned int [0]}'
};
^
product:17: error: too many initializers for 'uint16_t [0] {aka short unsigned int [0]}'
};
^
exit status 1
too many initializers for 'uint16_t [0] {aka short unsigned int [0]}'
I know this is an old question, but i ran into this issue today as well. The problem for me was, that i created a .cpp file (out of habit). The file needs to be a .c file in order to work
 
Hi all,

I am building multiple custom usb hid controllers for a Unity experience and we will need each controller to have a unique product name. This ensures we can force Unity to make each controller's mappings persistent if cables get swapped, etc.


1. What is the most current and simplest method of changing the HID product name for a Teensy Joystick controller on a Windows 10 and Windows 11 device?

2. Is it still using the usb_names.h method?

3. Are changing the vendor and product id's also required?
 
Back
Top