我正在尝试在 Google Chrome v.28.0.1500.71/MacOSX 10.8.4 上使用 USB api。FindDevices 方法找到我的设备(USB CCID 类),但是在执行 chrome.usb.listInterfaces(device,callback) 时出现错误
未捕获的类型错误:对象 # 没有方法“listInterfaces”。代码见下:
chrome.usb.findDevices( DEVICE_INFO,
function(devices) {
if (!devices || !devices.length) {
console.log('device not found');
return;
}
console.log('Found device: ' + devices[0].handle);
console.log(devices[0]);
powerMateDevice = devices[0];
console.log('listing ifcs...');
chrome.usb.listInterfaces(powerMateDevice, function(ifcs){
console.log('interfaces '+ifcs.length);
console.log(ifcs);
});
});
我的问题是,我是否以错误的方式使用此 API,或者 listInterfaces 尚未按照http://developer.chrome.com/apps/usb.html中的描述实现?