Python pywinusb在HID上发送一个LED断开_挂钩(0x17)

Python pywinusb在HID上发送一个LED断开_挂钩(0x17),python,pywinusb,Python,Pywinusb,我有以下定义: 电话设备页:0x0B, 电话耳机:0x05, LED页面:0x08, 挂钩上的发光二极管:0x17 我想使用pywinusb-0.3下面的简单发送示例发送一个LED OFF_HOOK=0x17,但收到此错误。找到了目标设备,但请求的用法不存在!。我将感谢任何帮助。谢谢 import pywinusb.hid as hid def click_signal(target_usage, target_vendor_id): all_devices = hid.HidDevi

我有以下定义: 电话设备页:0x0B, 电话耳机:0x05, LED页面:0x08, 挂钩上的发光二极管:0x17

我想使用pywinusb-0.3下面的简单发送示例发送一个LED OFF_HOOK=0x17,但收到此错误。找到了目标设备,但请求的用法不存在!。我将感谢任何帮助。谢谢

import pywinusb.hid as hid

def click_signal(target_usage, target_vendor_id):
    all_devices = hid.HidDeviceFilter(vendor_id = target_vendor_id).get_devices()
    if not all_devices:
        print("Can't find target device (vendor_id = 0x%04x)!" % target_vendor_id)
    else:

        for device in all_devices:
            try:
                device.open()
                DD = device.find_output_reports()
                for report in DD:
                    c = target_usage in report
                    if target_usage in report:
                        report[target_usage] = 1 # yes, changing values is that easy
                       report.send()               
                        report[target_usage] = 0
                        report.send()
                        print("\nUsage clicked!\n")
                        return
            finally:
                device.close()
        print("The target device was found, but the requested usage does not exist!\n")
    #
if __name__ == '__main__':
    target_vendor_id = 0x1395 # just an example, change it to the actual vendor_id
    target_usage = hid.get_full_usage_id(0x0B, 0x17) # generic vendor page, usage_id = 2
     click_signal(target_usage, target_vendor_id)

挂钩上的LED灯应为“返回”主机的信号

为了更改状态,您需要在电话页面上更改HOOK_开关的使用情况