PlatformIO Community

AutodetectUploadPort hit/miss case

I am trying to get AutodetectUploadPort working for my siwigsm platform but its a hit miss case. I explain a bit:
When gsm board’s USB is connected, it always enters the bootloader where it exposes USB COM port for flashing, this com port stays for a second or so for flasher to send sync bytes if flashing is needed else bootloader enters the application.
Now AutodetectUploadPort maybe because its slow not always catches the COM port at the right time. I have to keep trying plugin/plugout USB cable to get it working once in a while.

Even if I run pio device list it takes about 5 secs or maybe more to show results. I believe all these utilities are using https://github.com/platformio/platformio-core/blob/d1b46c838ee984dd242a819d2c4c4ee5c2b10250/platformio/util.py#L127 same function to get port list?