diff options
author | Chris Liechti <cliechti@gmx.net> | 2015-08-04 15:27:36 +0200 |
---|---|---|
committer | Chris Liechti <cliechti@gmx.net> | 2015-08-04 15:27:36 +0200 |
commit | 5c4d2d83c8f711b9704b4ee159207db61d45a93f (patch) | |
tree | cb83c3cb167e29914c492d85e18bbc9a526d4a8a | |
parent | 779b1a29594b9f6c69e73e02ab1e95b8dbb3e8b7 (diff) | |
download | pyserial-git-5c4d2d83c8f711b9704b4ee159207db61d45a93f.tar.gz |
[Patch pyserial:36 / 38] Make USB information work in python 3.4 and 2.7
-rw-r--r-- | CHANGES.rst | 1 | ||||
-rw-r--r-- | serial/tools/list_ports_osx.py | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 5b866f5..70880a8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -520,4 +520,5 @@ Version 3.x 2015-xx-xx Bugfixes (posix): - fix setXON +- [Patch pyserial:36 / 38] Make USB information work in python 3.4 and 2.7 diff --git a/serial/tools/list_ports_osx.py b/serial/tools/list_ports_osx.py index 1de4da3..fbce6f2 100644 --- a/serial/tools/list_ports_osx.py +++ b/serial/tools/list_ports_osx.py @@ -87,7 +87,7 @@ def get_string_property(device_t, property): output = None if CFContainer: - output = cf.CFStringGetCStringPtr(CFContainer, 0) + output = cf.CFStringGetCStringPtr(CFContainer, 0).decode('mac_roman') return output @@ -133,6 +133,7 @@ def GetParentDeviceByType(device, parent_type): @return Pointer to the parent type, or None if it was not found. """ # First, try to walk up the IOService tree to find a parent of this device that is a IOUSBDevice. + parent_type = parent_type.encode('mac_roman') while IORegistryEntryGetName(device) != parent_type: parent = ctypes.c_void_p() response = iokit.IORegistryEntryGetParentEntry( @@ -156,7 +157,7 @@ def GetIOServicesByType(service_type): response = iokit.IOServiceGetMatchingServices( kIOMasterPortDefault, - iokit.IOServiceMatching(service_type), + iokit.IOServiceMatching(service_type.encode('mac_roman')), ctypes.byref(serial_port_iterator) ) |