import usb.core
import usb.util
import usb.control
# find our device
dev = usb.core.find(idVendor=0x1a86, idProduct=0xe041)
# was it found?
if dev is None:
raise ValueError('Device not found')
# usb.control.set_configuration(dev, 0)
bmRequestType = usb.util.build_request_type(usb.util.CTRL_OUT, usb.util.CTRL_TYPE_STANDARD, usb.util.CTRL_RECIPIENT_DEVICE) #// should be 0x00
bRequest = 0x09
bConfigurationValue = 1
wIndex = 0
wLength = 0
dev.ctrl_transfer(bmRequestType, bRequest, bConfigurationValue)
dev.ctrl_transfer(bmRequestType, bRequest, bConfigurationValue)
Doesn't work though. PyUSB sent out a message that was 64 long instead of the 36.
Unless that is libusb doing the padding, IDK.
I don't know if the device keys off the length, or if it is missing the other hid messages first.
The mystery exe runs in wine and puts the icon in the panel, but doesn't send off any usb communication though.
I noticed that the last SET_REPORT differed from the previous pile of SET_REPORT
Then55 02 00 00 00 00 00 00
Switching to hid I guess.
libhidapi-hidraw0 won't open the device, and libhidapi-libusb.so.0 won't accept the buffer "ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type"
import hid
hid.lib
# libhidapi-hidraw0
# hid.HIDException: unable to open device
h = hid.Device(vid, pid)
h.open(vid, pid)
buf = [0]*8
buf[0] = 0x55
buf[1] = 0x01
#libhidapi-libusb.so.0
#ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type
h.send_feature_report([0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
h.send_feature_report([0x55, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.