summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2016-08-05 23:35:31 +0200
committerChris Liechti <cliechti@gmx.net>2016-08-05 23:35:31 +0200
commit2c84964936cdbe16c623ff874b7a528cc9d7a50d (patch)
treedac7d23f016d6c67a3a758ee74b5709287008f6c
parent6d00df70f2de3dde57a7937a7ea8fd1e22e22cbc (diff)
downloadpyserial-git-2c84964936cdbe16c623ff874b7a528cc9d7a50d.tar.gz
list_ports_windows: update fix for #144 for Python 3
-rw-r--r--serial/tools/list_ports_windows.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/serial/tools/list_ports_windows.py b/serial/tools/list_ports_windows.py
index 7efdbc4..810417e 100644
--- a/serial/tools/list_ports_windows.py
+++ b/serial/tools/list_ports_windows.py
@@ -128,17 +128,13 @@ DICS_FLAG_GLOBAL = 1
DIREG_DEV = 0x00000001
KEY_READ = 0x20019
-# workaround for compatibility between Python 2.x and 3.x
-Ports = serial.to_bytes([80, 111, 114, 116, 115]) # "Ports"
-PortName = serial.to_bytes([80, 111, 114, 116, 78, 97, 109, 101]) # "PortName"
-
def iterate_comports():
"""Return a generator that yields descriptions for serial ports"""
GUIDs = (GUID * 8)() # so far only seen one used, so hope 8 are enough...
guids_size = DWORD()
if not SetupDiClassGuidsFromName(
- Ports,
+ "Ports",
GUIDs,
ctypes.sizeof(GUIDs),
ctypes.byref(guids_size)):
@@ -170,7 +166,7 @@ def iterate_comports():
port_name_length = ULONG(ctypes.sizeof(port_name_buffer))
RegQueryValueEx(
hkey,
- PortName,
+ "PortName",
None,
None,
ctypes.byref(port_name_buffer),