Hi Folks,
I am developing a chrome app to communicate to HID device using chrome.usb APIs. I am using below chrome APIs
1. chrome.usb.findDevices
2. chrome.usb.controlTransfer
So far I am not able to make it work. chrome://device-log/ shows below error message.
USBEvent[13:54:01] Failed to open device: Entity not found
I am using right VendorId and ProductId in decimal format, Which I have extracted from device manager info.
Does anyone know about this issue? Any kind of help will be highly appreciated.
Below is the code snippet I am using.
chrome.usb.findDevices(DEVICE_INFO, function (devices) {
if (!devices || !devices.length) {
console.log('device not found');
}
console.log("Devices: " + devices);
console.log(devices[0]);
var TransferData = {
"requestType": "class",
"recipient": "interface",
"direction": "out",
"request": 0xx9,
"value": 0xxx0,
"index": 0,
"data": new Uint8Array([00,05, 47, 76, 66, 48, 47,00]).buffer
};
setTimeout(function () {
chrome.usb.controlTransfer(devices[0], TransferData, function (config) {
if (chrome.runtime.lastError) {
console.log(chrome.runtime.lastError);
} else {
console.log('Data Transfer completed');
}
});
}, 3000);
});