Properly do port enumeration on Windows

This commit is contained in:
James Bowman 2019-03-03 13:01:37 -08:00
parent e1b3826432
commit 85229642b9
1 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,8 @@ import re
import threading import threading
from functools import partial from functools import partial
import serial.tools.list_ports as slp
import wx import wx
import wx.lib.newevent as NE import wx.lib.newevent as NE
@ -242,7 +244,9 @@ class Frame(wx.Frame):
self.stop() self.stop()
def devices(self): 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/" devdir = "/dev/"
pattern = "^cu.usbserial-(.*)" pattern = "^cu.usbserial-(.*)"
else: else:
@ -312,7 +316,6 @@ class Frame(wx.Frame):
def set_speed(self, e): def set_speed(self, e):
w = e.EventObject w = e.EventObject
s = int(w.GetString(w.GetCurrentSelection())) s = int(w.GetString(w.GetCurrentSelection()))
print(s)
self.sd.setspeed(s) self.sd.setspeed(s)
def hot(self, i, s): def hot(self, i, s):