Skip to content

Commit

Permalink
Faster COM port detection
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kozlowski committed Aug 22, 2023
1 parent aa3d3e4 commit 961b8a5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion software/script/chameleon_cli_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def on_exec(self, args: argparse.Namespace):
PSHEXE=fn
break
if PSHEXE:
process = subprocess.Popen([PSHEXE,"Get-CimInstance -ClassName Win32_serialport | Where-Object {$_.PNPDeviceID -like '*VID_6868&PID_8686*'} | Select -expandproperty DeviceID"],stdout=subprocess.PIPE);
#process = subprocess.Popen([PSHEXE,"Get-CimInstance -ClassName Win32_serialport | Where-Object {$_.PNPDeviceID -like '*VID_6868&PID_8686*'} | Select -expandproperty DeviceID"],stdout=subprocess.PIPE);
process = subprocess.Popen([PSHEXE,"Get-PnPDevice -Class Ports -PresentOnly | where {$_.DeviceID -like '*VID_6868&PID_8686*'} | Select-Object FriendlyName | % FriendlyName | select-string COM\d+ |% { $_.matches.value }"],stdout=subprocess.PIPE);
res = process.communicate()[0]
_comport = res.decode('utf-8').strip()
if _comport:
Expand Down

0 comments on commit 961b8a5

Please sign in to comment.