Hi @ivankravets , Congratulations!! looking forward to the release and might test too.
There is one issue not related to platformio but pyserial which take good amount of time (probably for windows user?) for scanning and opening the ports when bluetooth COM ports are installed on the system. I have probably 6 BT COM ports on my system and pio device list takes about ~12.5s to list all the devices. Pyserial validate all the com ports be opening(?) so maybe that is why it is taking time.
This issue has been posted on pyserial too but since the repo is frozen for over years now, no one is looking at the issue.
opened 12:24AM - 02 Aug 19 UTC
Hey all,
So there is an issue where Bluetooth ports appearing as COM ports on… Windows 10 that serial.tools.list_ports.comports() to have a significant lag.
```
import serial.tools.list_ports
import time
t0 = time.time()
print(list(serial.tools.list_ports.comports()))
te = time.time()
print("time taken:", round(te-t0,2))
>> This returns with 10.32s for 4 Bluetooth COM ports (~2.5s per device)
```
This is particularly noticeable on the Lenovo ThinkPad (tested specifically on Lenovo Thinkpad with i7-7500U core, Qualcomm Atheros QCA61x4 Bluetooth 4.1), however other Lenovo ThinkPad's I have worked with also have the same issue).
I am not sure if other devices have similar issues, due to Bluetooth devices not automatically attached to COM ports.
This appeared recently with pyserial tag 3.4, however pyserial tag 3.2.1 did NOT have this issue.
From what I can tell, this is happening as COM ports are being opened and closed to verify whether they are valid or not.
Since Python is GIL locked, this locks all python threads and has caused multiple crashes on software I have been developing.
Can you please implement a workaround or solution to this?
A suggestion I have is to have serial.tools.list_ports.comports() take in a "verify" flag that enables or disables the verification of COM ports.
Such that:
`serial.tools.list_ports.comports(include_links=False, verify=True)`
(or similar) is default, and user can set verify to False if they want to quickly read ports list.
Thankyou,
CaptainJL
opened 07:01AM - 01 Aug 19 UTC
Hey all,
I am using serial.tools.list_ports.comports() to bring up a list of … COM ports on WIndows 10.
However it appears that the lastest pyserial takes a very long time to run this in Win10.
I have read that it attempts to open the COM ports to check whether they are valid or not, however Bluetooth devices take a significant time to open which is causing massive issues as it blocks the python threads (all thanks to our mate the GIL)…
Is there anyway to get serial.tools.list_ports.comports() to either not verify via opening the port, or to ignore all Bluetooth ports?
Eg. Some flags or timeouts as such?
Thanks,
CaptainJL
pyserial:master
← aivarannamaa:master
opened 09:08AM - 12 Jan 18 UTC
If `p` is a Serial over Bluetooth link, then `os.path.islink(p)` may take severa… l seconds.
In two of my Windows 10 computers following code used to take 5 seconds:
```
from serial.tools.list_ports import comports
for p in comports():
print(p)
```
I found out that the delay was caused by `os.path.islink('COM5')`. COM5 is one of the "Bluetooth over serial" ports backed by LogiLink Bluetooth dongle.
After my change it takes 0.01 seconds.
If I'm not mistaken, then `list_ports_windows` can't list symlinks anyway, so this time consuming check can be turned off for Windows.
Since pyserial is very core part of PlatformIO, solving this would be helpful to solve problem like this:
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 c…
1 Like