Smartcard Reader and ChromeApp

笑着哭i 提交于 2019-12-01 07:45:42

问题


I want to make a Chrome App that can access a USB SmartCard Reader (HID Global OmniKey 3121).

Did someone ever succeed in doing that?

Unfortunately, I cannot see it using usb.getDevices.

script.js (called by index.html which is itself called by background.js onLaunched):

//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] )
  } )

}

The device is declared in the manifest and recognized by Chrome in the Extensions page.

Thank you by advance for your help.

EDIT

Here is my 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
        }
      ]
    }
  ]
}

The 3 permitted devices are:

  1. Nokia Lumia 920
  2. Dell Optical Mouse
  3. OmniKey Smartcard Reader 3121

Only the mouse is recognized by usb.getDevices or usb.findDevices. Only the mouse is listed by usb.getUserSelectedDevices.


回答1:


The device is not recognized by Chrome when the native driver from HID Global is used.

The workaround is to use an alternate USB driver, for example one provided by the Zadig installer from zadig.akeo.ie:

  • WinUSB
  • libusb-win32
  • libusbK

I opened a case at HID Device but their technical support has not understood the problem yet (they don't know what is the Chrome Platform...) and redirected me to Google.

I opened a case at Google but they answered me I should post on StackOverflow!! They don't seem to mind if their Platform cannot recognize standard USB SmartCard devices, though visible in the Windows device manager...

Update

HID technical support said their driver will support the platform by 2016. Goolge support is still... inapt.

Update for Windows 7-10

On Windows 7 and 10 I don't need to install a generic driver. Instead I just edit the Smartcard Reader in Windows Device Manager and select the Previous Driver. It will revert to the Windows Generic USB CCID driver, that works with both my legacy PC/SC Winscard application and my Chrome App.



来源:https://stackoverflow.com/questions/32737190/smartcard-reader-and-chromeapp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!