Device names

Status
Not open for further replies.

Kaitain

Member
Hello there

I'm trying to use 2 Teensy 3.2 devices simultaneously and I'd like them to have different device names. I've achieved that by using the code on the MIDI_Name example, and it works fine with just one device connected: separately, each one has its own different name.

But the moment I have connected one device and plug in the second, the names change and both devices appear with the name of the last device plugged in.

Have anyone any idea about what am I doing wong?

I've used the forum and read several theards regarding the device name, but until now I haven't found anything helpful.

Cheers!
 
What are you plugging them into? If they change names am I assuming Linux? Where one shows up as /dev/ttyACM0 and the other as /dev/ttyACM1? And the order is somewhat random?

IN cases like this I typically use UDEV Rules. I create a rule that looks for each of them by serial# (yes sort of a pain) and then makes an alias to that device. Example when I am using a Teensy to control Dynamixel Servos...
I might create an alias like: /dev/ttyDXL which my code looks for...

With Windows, it should always create the same COM port for each device, that is it internally looks up to see if has seen this class of device with this serial # and assigns it the same COM port are the previous time.
 
I believe it has to do with the OS caching the name and associating it with the product ID -which will remain unchanged.

https://www.voti.nl/docs/usb-pid.html

Not the best ref.


...as a workaround, you could compile one with serial and one without.... I think that changes the 'pid'
 
Last edited:
Thank you for your replies

Sorry KurtE, I didn't point I'm using Windows 7.

With Windows, it should always create the same COM port for each device, that is it internally looks up to see if has seen this class of device with this serial # and assigns it the same COM port are the previous time.

Okay, is there any way to make Windows to assign a different COM port?

I believe it has to do with the OS caching the name and associating it with the product ID -which will remain unchanged.

Maybe is that... digging into "usb_desc.h" I found this:

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


Ok, but if I change vendorID or product ID, it also says:

"You may edit the Vendor and Product ID numbers, and strings. If
the numbers are changed, Teensyduino may not be able to automatically
find and reboot your board when you click the Upload button in
the Arduino IDE. You will need to press the Program button on
Teensy to initiate programming."


1) What is bcdDevice btw?
2) Let's say I change this numbers and loose automatic reboot. Change to what number? Does it matter the number I choose? Or do I have to buy a number like suggested here:

https://www.voti.nl/docs/usb-pid.html

...as a workaround, you could compile one with serial and one without.... I think that changes the 'pid'

I'm goinna try that.

Thank you!
 
You don't need to buy a number if you're not making a commercial product.

That's why I wasn't happy with the link but it explained vid/pid a bit.
 
Thank you for your replies

Sorry KurtE, I didn't point I'm using Windows 7.

Okay, is there any way to make Windows to assign a different COM port?
Sorry probably others can answer better than I can on this... It also may depend on what type of devices you are creating. Is it a Serial device that creates a COM? Or is it creating some other type of device like Mouse or Keyboard or Midi or...

Maybe also depending on your host program works with these two devices... If it is your own code and the like and simple serial device... You could potentially add some simple protocol to your program and your Teensy devices to do something like: When you open the COM port, you send out a simple serial message like: "#", where when the Teensy receives this, it replies I am 1 or I am 2... But again all depends on your setup.

Good luck
 
Hello all

Oddson:

...as a workaround, you could compile one with serial and one without.... I think that changes the 'pid'

That worked!

My devices are MIDI devices. I've compiled one with "USB Type: MIDI" and the other as "USB Type: serial+ MIDI" and now I have each one with their own name, no matter the order I plug them on.
I can't beleive the solution for this was so simple. Thank you very much!

Just as curiosity, how can I check if Windows has assigned them different PID?
 
how can I check if Windows has assigned them different PID?

Devices & Printers->Properties->Hardware->Details->Device Instance Path

VID_ and PID_ headers in value string precede two-hex characters of the 16-bit IDs.

I saw the chart of Paul's values somewhere online but I'm sure you can trust that every type-combination uses a separate PID.
 
Another question came to my mind. Later you mentioned:

You don't need to buy a number if you're not making a commercial product.

That's why I wasn't happy with the link but it explained vid/pid a bit.

The thing is that I would like to make a comercial product based on Teensy, but as long as PJRC has their own VID/PID numbers and the only thing that the computer will "see" would be the Teensy microcontroller, do I still have to buy a new one?
Wouldn't it be paying twice for the same thing?
 
Technically? -- as long as no other Teensy compiled with the same PID is plugged in at the same time you're fine.

Legally? -- consult your intellectual property lawyer or at least USB.org

Not using any of the official logos might mean you're OK but while I'm not an electrical engineer I'm really not a lawyer.

See also:
https://community.nxp.com/thread/383702
https://hackaday.com/2015/04/03/usb-pids-for-all/


It's funny that to make a simple niche-market USB MIDI controller with the official logos you need to sell thousands of units just to pay off USB.org and MIDI.org for the ID numbers.
 
Technically? -- as long as no other Teensy compiled with the same PID is plugged in at the same time you're fine.

This is not entirely true, you can change the serial number of each device that you have plugged in so it doesn’t use the default (which is 000000000000) and then you can have any number of devices with the same VID/PID plugged in. This is done in the same manner that the device name is changed as well as the manufacturer name, here’s an example name.c with the relevant additions: View attachment name.c
 
Status
Not open for further replies.
Back
Top