Is there a way to get the number assigned to a COM port emulated by CDC?
Is there a way to get the number assigned to a COM port emulated by CDC?
Hi!
My current project ESP32-S3 uses CDC and it's working properly.
But the only way to know the number assigned to the COM port (example: COM10) is referring to the device manager, what makes it inconvenient to a remote application that intends to be fully user-independent.
So, the question is: is there a way to programmatically get the number assigned to the COM or to specify the desired number during CDC setup time?
My current project ESP32-S3 uses CDC and it's working properly.
But the only way to know the number assigned to the COM port (example: COM10) is referring to the device manager, what makes it inconvenient to a remote application that intends to be fully user-independent.
So, the question is: is there a way to programmatically get the number assigned to the COM or to specify the desired number during CDC setup time?
Last edited by sraposo on Sat Oct 19, 2024 11:51 am, edited 1 time in total.
Re: Is there a way to get the number assigned to a COM port emulated by CDC?
Hi, there is no way to find out, unless you can check in your app VID and PID of each USB device connected and filter it.
Re: Is there a way to get the number assigned to a COM port emulated by CDC?
If I get you right, it would be enough to receive (part of) descriptor of the current USB devices attached to the PC!
How can I do it?
How can I do it?
Re: Is there a way to get the number assigned to a COM port emulated by CDC?
Yes, thats exactly what i am mean.
How to do it? I dont know, it all depends how you are creating your application.
How to do it? I dont know, it all depends how you are creating your application.
Re: Is there a way to get the number assigned to a COM port emulated by CDC?
This COM port number is likely assigned by Windows, exclusively.
I could not find any data structure in TinyUSB that contains an obvious, nor intuitive, reference to this.
I could not find any data structure in TinyUSB that contains an obvious, nor intuitive, reference to this.
Re: Is there a way to get the number assigned to a COM port emulated by CDC?
Thats true. Do, like i mentioned, you have to get somehow VID and PID on windows and then select the port which match your esp32 device.sraposo wrote: This COM port number is likely assigned by Windows, exclusively.
I could not find any data structure in TinyUSB that contains an obvious, nor intuitive, reference to this.
Im pretty sure you can do it with command line script, for sure with windows app if you build one etc.
You can also filter by name, since your device will have device name string descriptor. But all of this is a windows related problem.
Re: Is there a way to get the number assigned to a COM port emulated by CDC?
when connecting microcontrollers to PCs where the Windows COM port or Linux /dev/ttyUSB* port is unknown I usually have the host software (implemented in C++, C#, Java, etc) cycle thru the connected serial ports transmitting a prompt (e.g. a "?") to each device in turn
the target device would be programmed to respond with a specific acknowledgement (e.g. "ESP32 Klystron simulator")
the target device would be programmed to respond with a specific acknowledgement (e.g. "ESP32 Klystron simulator")
Re: Is there a way to get the number assigned to a COM port emulated by CDC?
I see, but I can't depend on some resident sw running on PC to help on this... I mean, it's not a option for while...horace99 wrote: ↑Sat Oct 19, 2024 12:47 pmwhen connecting microcontrollers to PCs where the Windows COM port or Linux /dev/ttyUSB* port is unknown I usually have the host software (implemented in C++, C#, Java, etc) cycle thru the connected serial ports transmitting a prompt (e.g. a "?") to each device in turn
the target device would be programmed to respond with a specific acknowledgement (e.g. "ESP32 Klystron simulator")
Thanks for your suggestion!
Re: Is there a way to get the number assigned to a COM port emulated by CDC?
what software are you running on the PC?
how do you tell it which COM port to use?
how do you tell it which COM port to use?
-
- Posts: 112
- Joined: Thu Oct 03, 2019 10:52 pm
- Contact:
Re: Is there a way to get the number assigned to a COM port emulated by CDC?
Some languages have APIs to get USB's hwid and USB's vid.If I get you right, it would be enough to receive (part of) descriptor of the current USB devices attached to the PC!
How can I do it?
This is hwid and vid of ESP32's CDC port.
Code: Select all
device=COM24
hwid=USB VID:PID=303A:4001 SER=8
vid=12346
Who is online
Users browsing this forum: No registered users and 66 guests