Open erixyuan opened 1 year ago
What is the USB device you are connecting to?
Does it work if you set device.oninputreport
before calling device.open()
?
device.oninputreport = ({device, reportId, data}) => {
console.log(`Input report ${reportId} from ${device.productName}:`, new Uint8Array(data.buffer));
};
await device.open();
What is the USB device you are connecting to?
Does it work if you set
device.oninputreport
before callingdevice.open()
?device.oninputreport = ({device, reportId, data}) => { console.log(`Input report ${reportId} from ${device.productName}:`, new Uint8Array(data.buffer)); }; await device.open();
It is a hardware device developed by ourselves. There is no abnormality in Chrome communication on Windows. This abnormality only occurs on Mac. The first time the data is sent, it cannot be received and returned, only the second time. I tried your way of writing and the result is the same.
Another phenomenon is that when sending for the first time, receiving data fails. The second time you send it, you receive the result of the first time.
The oninputreport event has been registered, but the data cannot be received when it is sent for the first time. Only the second time it is sent can the data be received. Continuous one success and one failure;