我尚未在计算机上连接此VID / PID设备 但是为什么chrome.runtime.lastError不输入?
var enumerateDevices = function() {
chrome.hid.getDevices({"vendorId":11368,"productId":57349}, onDevicesEnumerated);
chrome.hid.onDeviceAdded.addListener(onDeviceAdded);
chrome.hid.onDeviceRemoved.addListener(onDeviceRemoved);
};
var onDevicesEnumerated = function(devices) {
if (chrome.runtime.lastError) {
console.error("Unable to enumerate devices: " +
chrome.runtime.lastError.message);
return;
}
for (var device of devices) {
onDeviceAdded(device);
}
};
答案 0 :(得分:0)