Open zolinux opened 7 years ago
I ran into the same issue, needing to fix indentation and the GUID size.
Furthermore, the api is not finding my USB devices either - I get an invalid handle when trying to invoke SetupDiGetClassDevs and SetupDiEnumDeviceInterfaces.
This fork https://github.com/Vlastbia/WinUsbPy are working in python 3, but
in winusbutils.py
def is_device(vid, pid, path):
#example: vid, pid = "VID_13AB","PID_0050" #strings to find in path.upper()
path = path.upper()
return path.find(vid) != -1 and path.find(pid) != -1
in winusbpy.py
def read(self, pipe_id, length_buffer):
read_buffer = create_string_buffer(length_buffer)
bytes_read = c_ulong(0)
result = self.api.exec_function_winusb(WinUsb_ReadPipe, self.handle_winusb,
c_ubyte(pipe_id), read_buffer, c_ulong(length_buffer), byref(bytes_read), None)
if result != 0:
return read_buffer[:bytes_read.value]
else:
return None
these two issues make it not importable in the source code. Please fix it. I uploaded my corrected version as attachment. winusbpy.txt
However the API seems not to work for me, because it does not find any of my USB devices which I can have access in C++ using the WinUsbApi.