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:
- Nokia Lumia 920
- Dell Optical Mouse
- OmniKey Smartcard Reader 3121
Only the mouse is recognized by usb.getDevices
or usb.findDevices
.
Only the mouse is listed by usb.getUserSelectedDevices
.