pywinusb icon indicating copy to clipboard operation
pywinusb copied to clipboard

How do I send a simple feature report?

Open simonsolnes opened this issue 3 years ago • 2 comments

I have implemented a relay HID USB controller using pyhidapi on macOS. I'm using pywinusb to implement the windows version of the program, but I cannot seem to find out how to send my feature report to the HID.

On pyhidapi I wrote it like this like this:

h = hid.Device(self.vid, self.pid)
message = bytes([0xFF, relay_number]) #where 0xFF means 'turn on'
h.send_feature_report(message)

And I just cannot figure out how to do the same thing in pywinusb. To be clear, I have been able to create the HidDevice object, and opened it using .open() I have looked through the examples, but cannnot for the life of me figure out how to do it. I might just be stupid, but I would be really happy if someone could point me in the right direction on this one.

simonsolnes avatar May 09 '21 18:05 simonsolnes

Just wondering why not stick to pyhidapi? Did you hit into some limitations?

mcuee avatar Aug 12 '21 08:08 mcuee

For pywinusb, I think you can follow this example, find the right feature report and then set/get the feature report. https://github.com/rene-aguirre/pywinusb/blob/master/examples/simple_send.py

                # browse output reports, we could search over feature reports also,
                # changing find_output_reports() to find_feature_reports()

mcuee avatar Aug 12 '21 08:08 mcuee