Automatic Com port Select

For general Flowcode discussion that does not belong in the other sections.
stefan.erni
Valued Contributor
Posts: 771
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 151 times
Been thanked: 173 times

Re: Automatic Com port Select

Post by stefan.erni »

Hi Oscar, Hi Ben, Hi Steve

On my board (a mobile recorder).I have a bluetooth module
microchip RN4677-V/RM100.
This works very well with Flowcode. Fortunately, the automatic detection also works nice.

But I have connected several recorders to my computer. These have the same "_VID & 00010039_PID & 5050"

Can I somehow differentiate them with the bluetooth name? The bluetooth name is unique.

regards

Stefan
Comport_2021-06-29_17-28-09.png
Comport_2021-06-29_17-28-09.png (16.2 KiB) Viewed 3497 times

Steve-Matrix
Matrix Staff
Posts: 1280
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 170 times
Been thanked: 287 times

Re: Automatic Com port Select

Post by Steve-Matrix »

Hi Stefan,

I'm about to finish for the day (there's a certain football match about to start ;) ), so I will look into this tomorrow.

Steve-Matrix
Matrix Staff
Posts: 1280
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 170 times
Been thanked: 287 times

Re: Automatic Com port Select

Post by Steve-Matrix »

Hi Stefan,

Sorry, I've spent a while looking into it this morning without success. Without the hardware, it is difficult for me to see where the information is stored within Windows.

What is listed in the COM port dropdown in Ben's example program when these devices are connected?

stefan.erni
Valued Contributor
Posts: 771
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 151 times
Been thanked: 173 times

Re: Automatic Com port Select

Post by stefan.erni »

Hi Steve

For now I removed all recorders, except one recorder.

For one Bt modull the computer shows always 2 comport.

So the program from Ben found the recorder, choosed the correct comport (com4) and not the wrong comport (com3) from the BT device.
and started recording and stoped the recording after 10 seconds.

So with one recorder perfect!

In the dropdown menue is this.. If it's posible to show more info in the dropdown panel, like the VID PID will also help to choose from hand.

regards
Stefan
PS. You dont need to rush, I also watch the swiss team this evening
auto_2021-07-02_11-54-46.png
auto_2021-07-02_11-54-46.png (16.84 KiB) Viewed 3472 times
Attachments
AutoDetect COM Port_SE1.fcsx
(12.68 KiB) Downloaded 138 times

Steve-Matrix
Matrix Staff
Posts: 1280
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 170 times
Been thanked: 287 times

Re: Automatic Com port Select

Post by Steve-Matrix »

We could add the VID/PID to the list, but I think for your BT module this will show the same VID/PID for the 2 COM ports associated with it. And if you had multiple modules of the same product connected, these would also show the same VID/PID.

I've looked into this and I think Windows stores COM port info in a complex way. It depends on the type of COM port. For example, my PC identifies 2 COM port entries in the registry (Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter\Devices) - one under "ACPI" and one under "USB". More details of these can be found by finding each entry in "Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum".

If you have a look at these areas of your registry and find a way of differentiating them for your needs, then I might be able to find a way of exposing this information in Flowcode.

Otherwise you may need to find another way of achieving what you want.

For example, we have a Bluetooth product - our Formula AllCode robot buggy. When more than one of these are connected to the same PC, the only way for us to differentiate them is to open each COM port and ask it for it's name.

stefan.erni
Valued Contributor
Posts: 771
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 151 times
Been thanked: 173 times

Re: Automatic Com port Select

Post by stefan.erni »

Hi Steve

From all my Modul i now the Bluetooth_uniqueID .
From this modul is 801F12B866AC. From this I generate the BT name EMG-66AC (the BT modul has a command to creat the name with a string and the last 4 numbers of the ID)


How can I read the Bluetooth_uniqueID in the computer?

I tried with getprop, but it's not working.I did something wrong


regards

Stefan
Decice_2021-07-02_15-04-02.png
Decice_2021-07-02_15-04-02.png (5.34 KiB) Viewed 3466 times
Bluetooth_2021-07-02_14-50-50.png
Bluetooth_2021-07-02_14-50-50.png (117.98 KiB) Viewed 3466 times
id_2021-07-02_14-53-19.png
id_2021-07-02_14-53-19.png (132.22 KiB) Viewed 3466 times

stefan.erni
Valued Contributor
Posts: 771
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 151 times
Been thanked: 173 times

Re: Automatic Com port Select

Post by stefan.erni »

Hi to All

Atomatic Com Port Select is a good idea and working fine if you know the VID and PID

As a sample for the Microchip Bluetooth Modul RN4677 the HWID is working with "_VID&00010039_PID&5050"

But what is the HWID for the ESP32? I can not found a VID or PID

regards

Stefan

Steve-Matrix
Matrix Staff
Posts: 1280
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 170 times
Been thanked: 287 times

Re: Automatic Com port Select

Post by Steve-Matrix »

I think you can find the vid/pid of a device attached to a PC using Windows Device Manager. Find the device in the list and then right click and select "properties". In the details tab there should be a "Hardware ID" entry.

Post Reply