pywinusb

Simple reading/writing from/to a USB HID device in Python?

梦想与她 提交于 2019-12-24 09:12:25
问题 I've got a fairly simple USB HID device that I've been trying to figure out how to read from and write to using Python. I've been able to read from it using PyWinUSB, but the problem comes in when I try to write to it. Trying to write to it makes things explode. For example: device = hid.HidDeviceFilter(vendor_id = 0x0003, product_id = 0x1001).get_devices()[0] This works fine. Then for reading raw data, which is all that I care about right now (I'll work with that once I can figure out how to

How to send hid data to device using python / pywinusb?

点点圈 提交于 2019-12-21 21:25:31
问题 I'm trying to use pywinusb to send output report to a pic18f4550. The device can receive data, and I've tested it with a C# application, which worked fine. Also, I can read data from the device with pywinusb just fine, but I have a problem trying to send data. Here's the code I'm running: from pywinusb import hid filter = hid.HidDeviceFilter(vendor_id = 0x0777, product_id = 0x0077) devices = filter.get_devices() if devices: device = devices[0] print "success" device.open() out_report = device

What do I pass as the last value to the function SetupAPI.DLL.SetupDiEnumDeviceInterfaces()?

谁说我不能喝 提交于 2019-12-12 03:56:40
问题 I'm working in Python trying to create a simple program that reads and write from and to a fairly simple USB device. The problem I'm having is that since PyWinUSB and PyUSB don't seem to have what I need (trying to write to the device makes things explode), I have to work from scratch using the ctypes python module and the raw dll functions in WinUSB and SetupAPI. I've been able to get my question answered about how to define the structure that I'm passing to the function, but the problem