Serial Port teensy Identification/Recognize

Status
Not open for further replies.

Svenson

Member
Hi,
i'm working on a project using teensy3.2 and teensy4.0 that comminicate with a PC, i'm trying with Windows 10.

Everything work fine but I would to improve the Serial port identification.
I'm using this project to conenct a VST to my teensy:
https://github.com/cpr2323/juce_serialport

I would to recognize which port is used by my Teensy. Now on my laptop I can use COM15 for teensy3.2 and COM5 for teensy4, but I guess that in other pc with other connected device these port could be different.
Now my teensy3.2 PORT for example seems to have just these information COM15 and USBSER000.

So i'm looking for how to identify that on COM5 there is a teensy with my code!!

Is it possibile? It's about Windows-side code or something else?

Sorry but i'm not familiar with Serial Communication.

Thk!!
 
This is certainly possible see e.g. TeensySharp https://github.com/luni64/TeensySharp which is a c# library you can use to find all connected Teensies. It returns Board, Serialnumber and COM port of the found boards and detects newly connected or removed Teensies. However, it is not quite clear from your question if you

  1. want to do a stand alone tool spitting out that information or if you
  2. want to integrate the code into your juce framework which seems to be writtten in c++.

1) can be done with TeensySharp in a couple of lines. If you head for 2) you probably need to dive into the SetupDI API. You'll find a lot of examples in the web. Here a pointer to the documentation: https://docs.microsoft.com/en-us/wi...ons#ddk-setupdi-device-interface-functions-dg. Basically you want to read the device properties (HardwareID / DeviceID) with SetupDiGetDeviceProperty. The IDs contain the VID/PID which you can use to identify the Teensy Boards. It also contains its serialnumber which can come in handy if you have more than one board connected.

All in all this is quite tedious if you are not used to this kind of low level programming -> If possible use the high level approach with TeenySharp or any other library
 
Thank you guys, your advices are really interesting.

After a couple of day of study I decide to move to a more complete c++ serial lib that use friendly name.
Similar to teensySharp.

Thank
 
Status
Not open for further replies.
Back
Top