Javascript Web usb将数据从设备传输到浏览器不工作

Javascript Web usb将数据从设备传输到浏览器不工作,javascript,webusb,Javascript,Webusb,上面是我的设备配置。我试图从中获取数据,我使用下面的代码来获取数据 document.getElementById("request").onclick = function() { navigator.usb.requestDevice({ filters: [{ vendorId: 1659 }] }) .then((requestedDevice) => { device = request

上面是我的设备配置。我试图从中获取数据,我使用下面的代码来获取数据

document.getElementById("request").onclick = function() {

  navigator.usb.requestDevice({
      filters: [{
        vendorId: 1659
      }]
    })
    .then((requestedDevice) => {
      device = requestedDevice;
    }).then(() => {
      console.log(device);
      console.log(JSON.stringify(device));
      return device.open();
    }).then(() => device.selectConfiguration(1)) // Select configuration #1 for the device.
    .then(() => {

      return device.reset();
    }).then(() => device.claimInterface(0))
    .then(() => {

      return device.transferIn(3, 64)
    })
    .then((data) => {
      debugger;
      console.log(data)

    }).catch(err => {
      console.log(err);
    });

}
我正在选择endPointnumber,接口正确,但似乎不起作用,我是否遗漏了什么。请帮助。我没有收到任何错误,设备似乎已连接,但从机器到浏览器的数据传输没有发生

我看到这个问题,它和我的情况完全一样

但就我而言,我甚至没有得到任何数据

我在NodeJS中尝试了这个驱动程序,它成功了,但我想在web usb api中实现它

编辑-我在it上工作,现在数据似乎持续不断

async function Get()
{

  let device= await navigator.usb.requestDevice({ filters: [{ vendorId: 0x067b,productId:0x2303 }]})
console.log(device);
  await device.open({ baudRate: 9600 });
  await device.selectConfiguration(1);
  await device.claimInterface(0);

while(true)
{

  let result =  await device.transferIn(3,64);
  
  var string = new TextDecoder("utf-8").decode(result.data.buffer);

console.log("hii",string);
}

我现在面临的唯一问题是,数据传输直到一些数据被发送到设备时才开始,当我使用node js驱动程序发送数据时,它工作,我接收数据,但只有使用web usb api它不工作

您如何知道设备将在该端点上生成数据?是否需要先在端点2上发送命令?当按下按钮时,它会产生数据吗?我已经检查了手册,数据流是连续的。没有数据要首先发送@ReillyGrant:(如果你查看Tidepool代码,需要一个初始化序列来配置具有波特率和其他参数的设备。这些行是什么?`console.log(设备);console.log(JSON.stringify(device));`print?随附图像中的信息