summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Summers <summers.ryan.m@gmail.com>2019-02-13 07:57:51 +0100
committerRyan Summers <summers.ryan.m@gmail.com>2019-02-13 07:57:51 +0100
commit1ab971085e5e456115714ee7c8f9248e00887314 (patch)
treee3d582d3646f38b9b9dd046e0b59c703834df1c1
parentf7f32d8328edfd398ec9c9bff54d913bf18c0ce8 (diff)
downloadpyserial-git-1ab971085e5e456115714ee7c8f9248e00887314.tar.gz
Removing dependency on winerror
-rw-r--r--serial/tools/list_ports_windows.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/serial/tools/list_ports_windows.py b/serial/tools/list_ports_windows.py
index 49d8630..345b39d 100644
--- a/serial/tools/list_ports_windows.py
+++ b/serial/tools/list_ports_windows.py
@@ -21,7 +21,6 @@ from ctypes.wintypes import LONG
from ctypes.wintypes import ULONG
from ctypes.wintypes import HKEY
from ctypes.wintypes import BYTE
-import winerror
import serial
from serial.win32 import ULONG_PTR
from serial.tools import list_ports_common
@@ -137,6 +136,7 @@ DIGCF_PRESENT = 2
DIGCF_DEVICEINTERFACE = 16
INVALID_HANDLE_VALUE = 0
ERROR_INSUFFICIENT_BUFFER = 122
+ERROR_NOT_FOUND = 1168
SPDRP_HARDWAREID = 1
SPDRP_FRIENDLYNAME = 12
SPDRP_LOCATION_PATHS = 35
@@ -172,12 +172,11 @@ def get_parent_serial_number(child_devinst, child_vid, child_pid, depth=0):
# If there is no parent available, the child was the root device. We cannot traverse
# further.
- if win_error == winerror.ERROR_NOT_FOUND:
+ if win_error == ERROR_NOT_FOUND:
return ''
raise ctypes.WinError(win_error)
-
# Get the ID of the parent device and parse it for vendor ID, product ID, and serial number.
parentHardwareID = ctypes.create_unicode_buffer(250)