智能卡 Reader 和 ChromeApp

Smartcard Reader and ChromeApp

我想制作一个 Chrome 可以访问 USB 智能卡的应用 Reader (HID Global OmniKey 3121)。

有人成功过吗?

不幸的是,我无法使用 usb.getDevices 查看它。

script.js(由 index.html 调用,而 background.jsonLaunched):

//dom elements
var findBtn = document.querySelector( "button#find-btn" )
var deviceInfo = document.querySelector( "p#device-info" )

//{click}
findBtn.addEventListener( "click", findDevice )

/*
 * Try to find HID OmniKey 3x21
 */
function findDevice ()
{
  var options = {
    filters: [
      {
        vendorId: 1899,  //OmniKey AG
        productId: 12321  //CardMan 3121 but PID=0x3021
      }
    ]
  }

  chrome.usb.getDevices( options, function ( devices )
  {
    console.log( devices )
    deviceInfo.innerHTML = JSON.stringify( devices[0] )
  } )

}

设备在清单中声明,并在扩展页面中被 Chrome 识别。

预先感谢您的帮助。

编辑

这是我的manifest.json:

{
  "manifest_version": 2,
  "name": "Card Reader",
  "description": "Smartcard reader",
  "version": "0.0.2",
  "minimum_chrome_version": "43",

  "app": {
    "background": {
      "scripts": [ "js/background.js" ]
    }
  },

  "permissions": [
    "usb",

    {
      "usbDevices": [
        {
          "vendorId": 1057,
          "productId": 1633
        },
        {
          "vendorId": 1133,
          "productId": 49271
        },
        {
          "vendorId": 1899,
          "productId": 12321
        }
      ]
    }
  ]
}

允许的 3 台设备是:

  1. 诺基亚 Lumia 920
  2. 戴尔光电鼠标
  3. OmniKey 智能卡Reader3121

只有鼠标被usb.getDevicesusb.findDevices识别。 usb.getUserSelectedDevices.

仅列出了鼠标

当使用 HID Global 的本机驱动程序时,Chrome 无法识别设备。

解决方法是使用备用 USB 驱动程序,例如由来自 zadig.akeo.ie 的 Zadig 安装程序提供的驱动程序:

  • WinUSB
  • libusb-win32
  • libusbK

我在 HID Device 开了一个案例,但他们的技术支持还没有理解这个问题(他们不知道什么是 Chrome 平台...)并将我重定向到 Google .

我在 Google 开了一个案例,但他们回答我应该 post 在 Whosebug 上!!如果他们的平台无法识别标准 USB 智能卡设备,他们似乎并不介意,尽管在 Windows 设备管理器中可见...

更新

HID 技术支持表示他们的驱动程序将在 2016 年之前支持该平台。 Goolge 支持仍然...不合适。

更新 Windows 7-10

在 Windows 7 和 10 我不需要安装通用驱动程序。相反,我只是在 Windows 设备管理器 中编辑智能卡 Reader 和 select Previous Driver。它将恢复为 Windows 通用 USB CCID 驱动程序,它适用于我的遗留 PC/SC Winscard 应用程序和我的 Chrome 应用程序。