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

Thread: Device names

  1. #1
    Junior Member
    Join Date
    Jan 2018
    Posts
    19

    Device names

    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!

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,901
    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.

  3. #3
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,376
    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 by oddson; 04-15-2018 at 03:49 PM.

  4. #4
    Junior Member
    Join Date
    Jan 2018
    Posts
    19
    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!

  5. #5
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,376
    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.

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,901
    Quote Originally Posted by Kaitain View Post
    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

  7. #7
    Junior Member
    Join Date
    Jan 2018
    Posts
    19
    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?

  8. #8
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,376
    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.

  9. #9
    Junior Member
    Join Date
    Jan 2018
    Posts
    19
    Got it. Thank you!

  10. #10
    Junior Member
    Join Date
    Jan 2018
    Posts
    19
    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?

  11. #11
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,376
    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.

  12. #12
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Posts
    688
    Quote Originally Posted by oddson View Post
    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: name.c

Posting Permissions

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