Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (24 sloc) 990 Bytes
# Full blog post:
import sys, re
import subprocess
import time
def grep(regexp):
for port, desc, hwid in
if, port, re.I) or, desc) or, hwid):
yield port, desc, hwid
# Discover all COM ports and show them
port_list_initial =
for port, desc, hwid in port_list_initial:
print('-', port, desc)
print('\nWaiting for new USB to SERIAL device to be plugged in...\n')
# Wait for new device to be plugged in and show it
while True:
port_list_poll =
for p in port_list_poll:
if p not in port_list_initial:
print('-', p)
input('\nAll done, press enter to quit')
time.sleep(0.5) # Don't poll too often