【问题标题】:Chrome USB API no listInterfaces methodChrome USB API 没有 listInterfaces 方法
【发布时间】:2013-07-22 08:57:36
【问题描述】:

我正在尝试在 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 中的描述实现?

【问题讨论】:

    标签: usb google-chrome-app


    【解决方案1】:

    May 28, 2013 上添加了 listInterfaces 方法。那是在 Chrome 28 的 5 月 6 日branch point 之后。请改用开发频道。如果您想针对文档问题提交错误报告,可以在 crbug.com 上提交。

    【讨论】:

    • 谢谢。是的,现在我正在使用开发频道,并且 listInterfaces 效果很好。期待稳定版的到来。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-24
    相关资源
    最近更新 更多