chrome.hid.send 不发送数据包



我正在开发一个需要连接到自定义 HID 设备的 chrome 应用程序。我能够从设备接收数据。我确实有隐藏和USB总线的写入权限。然而,该设备没有收到任何数据。
我成功地在单独的程序中通过hidapi发送数据。你能建议任何方法来检查chrome.hid.send是否正常工作吗?
操作系统 : Arch Linux
铬版本 : 46.0.2490.22 测试版(64 位)

好吧,以下代码片段似乎对我有用:(取自 chrome-app-samples 中的 HID 示例应用程序)

    function sendHid(){
        var bytes = new Uint8Array(63);
        bytes[0] = 0x01;//to send 0x01 to HID device
        chrome.hid.send(connectionId,0,bytes.buffer,function(){
        if (chrome.runtime.lastError) {
            console.log(chrome.runtime.lastError.message);
            return;
           }
        else {
            console.log("Sent!");
            }
        });
       }

最新更新