From 85229642b99dc29e41dc4047ed087f5703bde26b Mon Sep 17 00:00:00 2001 From: James Bowman Date: Sun, 3 Mar 2019 13:01:37 -0800 Subject: [PATCH] Properly do port enumeration on Windows --- python/samples/i2cgui.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/samples/i2cgui.py b/python/samples/i2cgui.py index b832459..a2c5852 100644 --- a/python/samples/i2cgui.py +++ b/python/samples/i2cgui.py @@ -6,6 +6,8 @@ import re import threading from functools import partial +import serial.tools.list_ports as slp + import wx import wx.lib.newevent as NE @@ -242,7 +244,9 @@ class Frame(wx.Frame): self.stop() def devices(self): - if sys.platform == 'darwin': + if sys.platform == 'win32': + return {pi.device: pi.device for pi in slp.comports()} + elif sys.platform == 'darwin': devdir = "/dev/" pattern = "^cu.usbserial-(.*)" else: @@ -312,7 +316,6 @@ class Frame(wx.Frame): def set_speed(self, e): w = e.EventObject s = int(w.GetString(w.GetCurrentSelection())) - print(s) self.sd.setspeed(s) def hot(self, i, s):