0

我有以下定义:电话设备页面:0x0B,电话耳机:0x05,LED 页面:0x08,LED OFF_HOOK: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)
4

1 回答 1

0

LED OFF_HOOK 应该是一个“返回”给主机的信号。

为了更改状态,您需要在电话页面上更改 HOOK_SWITCH 用法。

于 2015-03-21T01:03:56.433 回答